先用ifconfg查询网卡名称 例如以下的是enp10s0 enp10s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.159 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::127c:61ff:fe4c:ab6b prefixlen 64 scopeid 0x20<link> ether 10:7c:61:4c:ab:6b txqueuelen 1000 (Ethernet) RX packets 6944 bytes 5404329 (5.4 MB) RX errors 0 dropped 16 overruns 0 frame 0 TX packets 6190 bytes 969425 (969.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 2. 修改conifg sudo nano /etc/netplan/00-installer-config.yaml 写入: network: version: 2 renderer: networkd ethernets: enp10s0: dhcp4: false addresses: - 192.168.100.10/24 gateway4: 192.168.100.1 ----------------------------- 这是改为192.168.100.10的范例 ctrl+X 保存后退出 3. sudo netplan apply 改为后可能上不了网,如果要改回来 修改dhcp4为true dhcp4: true 然后 sudo netplan apply即可