参考链接:
https://cloud.tencent.com/developer/article/1711887
https://www.psay.cn/toss/182.html

文件位置:

1
/etc/netplan

文件:

1
00-installer-config.yaml

里面的内容:

1
2
3
4
5
6
7
8
9
10
# This is the network config written by 'subiquity'
network:
ethernets:
enp1s0:
dhcp4: no
addresses: [192.168.1.204/24]
optional: true
nameservers:
addresses: [192.168.1.1,114.114.114.114]
version: 2

生效:

1
sudo netplan apply

修改后

1
2
3
4
5
6
7
8
9
10
# This is the network config written by 'subiquity'
network:
ethernets:
enp1s0:
dhcp4: no
addresses: [192.168.1.204/24]
optional: true
nameservers:
addresses: [192.168.1.1]
version: 2

修改前

1
2
3
4
5
6
# This is the network config written by 'subiquity'
network:
ethernets:
enp1s0:
dhcp4: true
version: 2