注:配置/etc/network/interfaces已无用
root@ubuntu:~# vim /etc/netplan/50-cloud-init.yaml
network: ethernets: enp0s31f6: addresses: - 192.168.1.244/24 gateway4: 192.168.1.1 nameservers: addresses: - 223.5.5.5 search: [] optional: true version: 2
执行命令 使配置生效
root@ubuntu:~# netplan apply