想起来就折腾折腾,感觉很简单,一直不成功,最近终于搞定了,搜索了一下,网上没人写过相关的,记录一下需要避的坑。
1:因为 wireguard server 没开在主路由上,是在 esxi 里面新建了个 alpine ,本身有 v6 能力。
2:alpine 本身需要开 net.ipv6.conf.all.forwarding=1 这个参数,单独加这个参数会导致 alpine 分配不到公网 ipv6 地址,完整的参数如下
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.autoconf=1
net.ipv6.conf.eth0.autoconf=1
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.default.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2
3:wireguard 配置中,v6 地址子网掩码要写 128
Address = 10.7.0.1/24, fd86::1/128
防火墙也要添加 v6 规则
PostUp = ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = ip6tables -t nat -D POSTROUTING 1; iptables -t nat -D POSTROUTING 1
1:因为 wireguard server 没开在主路由上,是在 esxi 里面新建了个 alpine ,本身有 v6 能力。
2:alpine 本身需要开 net.ipv6.conf.all.forwarding=1 这个参数,单独加这个参数会导致 alpine 分配不到公网 ipv6 地址,完整的参数如下
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.autoconf=1
net.ipv6.conf.eth0.autoconf=1
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.default.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2
3:wireguard 配置中,v6 地址子网掩码要写 128
Address = 10.7.0.1/24, fd86::1/128
防火墙也要添加 v6 规则
PostUp = ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = ip6tables -t nat -D POSTROUTING 1; iptables -t nat -D POSTROUTING 1