技术解析
# /etc/network/interfaces### Hetzner Online GmbH - installimage# Loopback device:auto lo iface lo inet loopback## device: eth0auto eth0 iface eth0 inet static address <Main IP> netmask 255.255.255.255 pointopoint <Gateway> gateway <Gateway>#iface eth0 inet6 static address <Address from the IPv6 Subnet> #eg: 2001:db8::2 netmask 128 gateway fe80::1 up sysctl -p# for single IPsauto vmbr0 iface vmbr0 inet static address 10.0.1.1 netmask 255.255.255.0 bridge_ports none bridge_stp off bridge_fd 0#iface vmbr0 inet6 static address <Address from the IPv6 Subnet> #eg: 2001:db8::2 netmask 64
关于Nat链接网络请使用iptables实现。
主网卡中默认配置请不要修改,仅需将IPV6ADDR的/64换为/128
例如:IPV6ADDR= 2001:db8::2/128
然后将桥接网卡更改为:
DEVICE=br0ONBOOT=yesTYPE=BridgeBOOTPROTO=staticIPADDR=10.0.1.1NETMASK=255.255.255.0IPV6ADDR=2001:db8::2/64
关于联网与端口映射请使用iptables
这里拿2001:db8::此ipv6做示范
Debian or Ubuntu:
iface eth0 inet6 static address 2001:db8::f001 netmask 64 gateway 2001:db8::2
Centos:
IPV6INIT=yesIPV6ADDR=2001:db8::f001/64IPV6_DEFAULTGW=2001:db8::2