1. 编辑 01-network-manager-all.yaml 文件:
1 sudo vim /etc/netplan/01-network-manager-all.yaml
加入下面内容:
1 # Let NetworkManager manage all devices on this system 2 network: 3 version: 2 4 renderer: NetworkManager 5 ethernets: 6 eno1: 7 dhcp4: no 8 dhcp6: no 9 addresses: [172.16.21.166/24] 10 gateway4: 172.16.21.254 11 nameservers: 12 addresses: [8.8.8.8, 114.114.114.114]
eno1为网卡名。
需要指定的内容为(从上而下)ip、gateway、dns server。
2. 应用修改
1 sudo netplan apply
标签:ubuntu20.04,network,ip,sudo,manager,固定,addresses From: https://www.cnblogs.com/wq242424/p/17441020.html