#编辑/etc/netplan/目录下的yaml文件,文件名可能不一样
vim /etc/netplan/50-cloud-init.yaml
#按以下格式设置IP信息
network:
ethernets:
ens33:
addresses: [10.10.10.20/24]
gateway4: 10.10.10.2
nameservers:
addresses: [223.5.5.5,223.6.6.6]
search: []
dhcp4: no
optional: true
version: 2
#重启网卡
netplan apply 或 service networking restart
ubuntu 18.04 静态 IP 设置方法
最新推荐文章于 2024-06-29 11:12:55 发布