1、编辑网卡

sudo vim /etc/netplan/00-network-manager-all.yaml

image1.png

network:

  version: 2

ethernets:

eth0:

addresses: [***.***.***.***/**]

dhcp4: no

optional: true

gateway4: ***.***.***.***

nameservers:

addresses: [***.***.***.***]

 

2、配置生效

sudo netplan apply

3、查看ip

ip addr

image2.png

4、ping baidu

image3.png