“Ubuntu配置网络和hostname”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
docker>Evan
 
(导入1个版本)

2019年10月14日 (一) 13:55的版本

18.04 server

sudo hostnamectl set-hostname "k8s-master"

vi /etc/cloud/cloud.cfg
preserve_hostname: false  ---> 改成 true

vi /etc/hostname

reboot

如何在Ubuntu 18.04中配置网络静态IP地址

Ubuntu 18.04 Server 设置静态IP

ubuntu server 18.04版本netplan网络配置

网络

ubuntu18.04

 cat /etc/netplan/50-cloud-init.yaml 
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens18:
            addresses: 
            - 192.168.88.59/24
            gateway4: 192.168.88.1
            nameservers: 
                addresses: [8.8.4.4]
            optional: true    
    version: 2




 netplan apply#,可以立即生效 此处ip 为192.168.88.59

ubuntu16.04

root@ubuntu16:~# cat /etc/network/interfaces
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens18
#iface ens18 inet dhcp
iface ens18 inet static 
address 192.168.88.30 
netmask 255.255.255.0 
gateway 192.168.88.1
dns-nameserver 8.8.4.4

Ubuntu 18.04 Server安装过程详解

Ubuntu 18.04 Server 版安装过程图文详解

Ubuntu 18.04-安装图文教程