Netplan network configuration had been first introduced to Ubuntu 18.04 LTS Bionic Beaver. It is available to all new Ubuntu 18.04 installations.
当前的 netplan
配置文件在 /etc/netplan/
目录下,查看当前的配置文件:
1 | cat /etc/netplan/01-network-manager-all.yaml |
这里的
01-network-manager-all.yaml
桌面版和服务器版的名字不一样
结果如下:
1 | # This file describes the network interfaces available on your system |
可以看到默认的 IP 配置是 DHCP,将其改为静态 IP:
1 | # Let NetworkManager manage all devices on this system |
然后是配置生效:
1 | sudo netplan apply |
或者:
1 | sudo netplan --debug apply |