Ubuntu 22.04 配置 netplan
Configuring netplan on Ubuntu 22.04
————————————————————
Ubuntu 22.04 配置 netplan
在22.04版本中,gateway4的办法已经弃用,需要换成下面这种方式:
编辑配置文件:
sudo vim /etc/netplan/01-network-manager-all.yaml
改成下面这样:
network:
ethernets:
eth0:
dhcp4: yes
dhcp6: yes
eth1:
dhcp4: no
dhcp6: no
addresses: [192.168.100.100/24]
optional: true
routes:
- to: default
via: 192.168.100.8
nameservers:
addresses: [192.168.8.8,114.114.114.114]
eth2:
dhcp4: yes
dhcp6: no
addresses: [10.10.0.1/24]
optional: true
eth3:
dhcp4: yes
dhcp6: no
addresses: [10.10.1.1/24]
optional: true
version: 2
renderer: networkd
应用网络配置:
sudo netplan apply