Ubuntu 18.04 LTS \n \l 配置网卡IP

一定要按照 格式来,不然各种报错,  : 回车 进行第二行配置,

1,修改 配置文件 :

sudo vim /etc/netplan/50-cloud-init.yaml


network:

        version: 2
        ethernets:
                enp5s0:     #网卡名称 不是之前的了  ip  a 查看
                        addresses:  [192.168.88.217/24]
                        gateway4:  192.168.88.1
                        nameservers:

                                addresses: [114.114.114.114, 8.8.8.8]

2,启用

sudo netplan apply 

3,查看IP

ip a
2: enp5s0: mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 9c:5c:8e:4f:08:07 brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.217/24 brd 192.168.88.255 scope global enp5s0
       valid_lft forever preferred_lft forever
    inet6 fe80::9e5c:8eff:fe4f:807/64 scope link
       valid_lft forever preferred_lft forever

你可能感兴趣的:(Ubuntu 18.04 LTS \n \l 配置网卡IP)