nulige@ubuntu:/etc/netplan$ cd /etc/netplan
请根据自己的情况,修改网卡的名字,例如你的是eth0
请根据自己的情况,修改网卡的名字,例如你的是ens18
重要的事情说三遍
nulige@ubuntu:/etc/netplan$ sudo vi 01-network-manager-all.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens33:
addresses: [192.168.1.130/24]
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.108]
dhcp4: no
optional: no
nulige@ubuntu:/etc/netplan$ sudo netplan apply