前些天在xubuntu 18.04 desktop上设置了下静态IP,发现与centos/linux中区别极大。
1、首先查看网卡名
$ ip a / ifconfig
2、 cp一份yaml文件,改个名字
$ sudo cp /etc/netplan/*.yaml /etc/netplan/网卡名.yaml
3、修改yaml文件内容,如下:
# Let NetworkManager manage all devices on this system
network:version: 2renderer: NetworkManagerethernets:网卡名:dhcp4: noaddresses: [ip/prefix]gateway4: gatewaynameservers:addresses: [dns]
4、启动
$ sudo netplan apply
5、验证
$ ip a / ifconfig