首先配置IP,修改 /etc/network/interfaces
为如下
### Hetzner Online GmbH installimage
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
iface lo inet6 loopback
auto enp7s0
iface enp7s0 inet static
address 65.108.xxx.xx
netmask 255.255.255.192
gateway 65.108.xxx.xx
# route 65.108.230.64/26 via 65.108.230.65
up route add -net 65.108.230.64 netmask 255.255.255.192 gw 65.108.230.65 dev enp7s0
iface enp7s0 inet6 static
address 2a01:4f9:1a:bb6f::192/128
gateway fe80::1
# 配置 bridge 桥接
auto br-nat
iface br-nat inet static
address 10.0.0.1
netmask 255.255.255.0
bridge-ports none
bridge-stp off
bridge-fd 0
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o enp7s0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o enp7s0 -j MASQUERADE
iface br-nat inet6 static
address 2a01:4f9:1a:bb6f::1/64
配置转发,修改 /etc/sysctl.conf
> 最后增加
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
修改完成后重启网络即可systemctl restart networking