ubuntu22.04 参考以下配置[注意yaml的格式,否则容易出错,每个字如何对准的]:
network:
ethernets:
ens33:
dhcp4: no
dhcp6: no
addresses:
- 192.168.0.10/24
routes:
- to: default
via: 192.168.0.1
nameservers:
addresses:
- 114.114.114.114
- 8.8.8.8
version: 2
renderer: networkd
配置完毕后输入命令重启网络即可:sudo netplan apply