- 编辑
50-cloud-init.yam
:vim /etc/netplan/50-cloud-init.yaml
修改前
network:
ethernets:
ens33:
dhcp4: true
version: 2
修改后
network:
ethernets:
ens33:
addresses: [192.168.80.134/24]
gateway4: 192.168.80.2
dhcp4: no
nameservers:
addresses: [192.168.80.2]
version: 2
重启网卡
netplan apply
修改主机名
修改文件 : vim /etc/cloud/cloud.cfg
修改内容: preserve_hostname: true
修改主机名: hostnamectl set-hostname paas
配置host:
cat >> /etc/hosts << EOF
192.168.80.135 paas
EOF
修改DNS:vim /etc/systemd/resolved.conf
DNS=114.114.114.114