Ubuntu配置网络和hostname
跳到导航
跳到搜索
18.04 server
sudo hostnamectl set-hostname "k8s-master" vi /etc/cloud/cloud.cfg preserve_hostname: false ---> 改成 true vi /etc/hostname reboot
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