Ubuntu网络配置

适用于 Ubuntu 20.04 及以上使用 netplan 的版本

static:

network:
renderer: networkd
ethernets:
enp1s0:
addresses:
- 192.168.1.10/24
nameservers:
addresses: [192.168.1.1]
routes:
- to: default
via: 192.168.1.1
version: 2

DHCP:

network:
ethernets:
enp1s0:
dhcp4: true
nameservers:
addresses: [223.6.6.6,223.5.5.5]
version: 2

bridge:

network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: false
dhcp6: false
bridges:
br0:
macaddress: aa:bb:cc:11:22:33
dhcp4: false
dhcp6: false
addresses:
- 192.168.110.161/24
routes:
- to: default
via: 192.168.110.1
metric: 100
on-link: true
nameservers:
addresses:
- 223.6.6.6
interfaces:
- enp1s0
parameters:
stp: true
forward-delay: 4