我想路由一个ipv6 ip到一个lxc容器,但数据包不转发。 我不想将lxc容器连接到eth0,我不想使用autoconfig。 此外,我只有一个/64的主机,所以我需要使用一个较小的虚拟机networking。 我现在select了/112 ,也许我可以使用一个更大的networking,如果需要的话。
我想问题是路由,而不是容器。 这是我的设置:
主办:
# the host already has working ipv6, empty ip6tables FORWARD table with policy ACCEPT ip -6 addr add prefix::1/112 dev lxcbr ip -6 route show|grep prefix # prefix::/112 dev lxcbr proto kernel metric 256 sysctl net.ipv6.conf.eth0.forwarding # net.ipv6.conf.eth0.forwarding = 1 sysctl net.ipv6.conf.lxcbr.forwarding # net.ipv6.conf.lxcbr.forwarding = 1
VM:
ip -6 addr add prefix::2/112 dev eth0 ip -6 route add default via fe80:: dev eth0 # routing via prefix::1 does not work either ip -6 route show # prefix::/112 dev eth0 proto kernel metric 256 # fe80::/64 dev eth0 proto kernel metric 256 # default via fe80:: dev eth0 metric 1024
工作(VM):
ping6 prefix::1 # host
工作(主持人):
ping6 prefix::2 # vm
不工作(VM):
ping6 google.com # PING google.com (2a00:1450:4001:805::1007): 48 data bytes # --- google.com ping statistics --- # 7 packets transmitted, 0 packets received, 100% packet los
主机上的tcpdump:
tcpdump -i lxcbr icmp6 # 13:20:44.088814 IP6 prefix::1 > fra07s32-in-x07.1e100.net: ICMP6, echo request, seq 0, length 56 # 13:20:45.089268 IP6 prefix::1 > fra07s32-in-x07.1e100.net: ICMP6, echo request, seq 1, length 56 # [...] tcpdump -i eth0 icmp6 # [no output]
使用-A FORWARD -j LOG ip6tables -A FORWARD -j LOG也不会logging任何数据包。
编辑:因为每个人都抱怨小于/64 :问题仍然存在/64接口。 问题是,使用从一个(虚拟)接口到另一个(物理)接口的静态路由时,没有数据包进入iptables的FORWARD队列。
小型networking的设置是什么,当它的工作,因为我的提供者想要一个相当大的费用更多的网(接近50%的服务器租金)。 但是为了testing,我可以使用fd/8的整个/64或大networking,如果它有助于testing。
我不会在生产环境中使用您的设置。 正如其他人所提到的,打破/ 64将会产生意想不到的影响。 如果您的提供商无法获得更多的地址,我build议您使用NDP代理来允许/ 112中的容器到达IPv6networking。 您可以使用NDP代理守护程序或在命令行中创build静态条目。
我在这里写了一个关于如何用docker做这个的详细描述。 lxc也适用同样的逻辑。
我得到了它的工作…但它仍然很奇怪。
设置转发为“全部”,但然后禁用它为每个单独的界面工作:
cd /proc/sys/net/ipv6/conf/ echo 1 >all/forwarding;for i in */forwarding;do test $i = all/forwarding || echo 0 > $i;done
相反(全部设置/转发到0,并将每个接口转发到1)不起作用。
另一个有趣的问题是:有时你需要添加路由后,接口添加到桥梁,使其工作,同样的问题,在这里: https : //www.rivy.org/2013/02/ipv6-ping-sendmsg-network-是向下/
多亏了jeff-loughridge的docker链接,这个howto的第一部分让我find了这个解决scheme。
我仍然在调查这里发生了什么(如果它仍然在工作),在我结束这个问题之前。