unbuntu18 netplan 配置固定IP
编辑文件
sudo vim /etc/netplan/50-cloud-init.yaml
内容
network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: no addresses: [192.168.1.myip/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8,8.8.4.4]
网络设置生效
sudo netplan apply