1. 定位配置文件
ls /etc/netplan/*.yaml # 通常为 00-installer-config.yaml
2.编辑配置文件,注意空格
# This is the network config written by 'subiquity'
network:ethernets:ens5f0:dhcp4: falseaddresses: [ 192.168.0.251/24 ]gateway4: 192.168.0.1nameservers:addresses:- 223.5.5.5- 8.8.8.8ens5f1:dhcp4: trueens5f2:dhcp4: trueens5f3:dhcp4: trueversion: 2
dhcp4: false #禁用动态IP
3.应用Netplan配置:
sudo netplan apply
4.重启网络服务(可选):
sudo systemctl restart systemd-networkd
5.验证配置:
ip addr