本文最后更新于 143 天前,其中的信息可能已经有所发展或是发生改变。
Ubuntu 22.04
network:
ethernets:
ens160:
addresses:
- 192.168.1.1/24
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
search: []
routes:
- to: default
via: 192.168.1.1
version: 2
Ubuntu 20.04
network:
ethernets:
ens160:
addresses:
- 192.168.1.1/24
gateway4: 192.168.1.1
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
search: []
version: 2
Debian11
auto lo
iface lo inet loopback
auto ens18
iface ens18 inet static
address 192.168.1.1/24
gateway 192.168.1.1
dns-nameservers 1.1.1.1,8.8.8.8
iface ens18 inet6 dhcp
Debian11 桥接网卡
auto lo
iface lo inet loopback
iface enp88s0 inet manual
auto vmbr0
iface vmbr0 inet static
address 192.168.1.1/24
gateway 192.168.1.1
bridge-ports enp88s0
bridge-stp off
bridge-fd 0
auto wlo1
iface wlo1 inet dhcp
wpa-ssid "wifi-name"
wpa-psk "wifi-password"
auto vmbr1
iface vmbr1 inet static
address 192.168.2.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.1.0/24' -o wlo1 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o wlo1 -j MASQUERADE