I would like to create host-only IPv6 networks on two hosts and then routebetween them. On each host, there will be a dummy interface, atipv6_prefix::9. I would like to be able to ping that interface from theother host.Is there a well-developed best practice for this? It seems reasonable that onecould do it with 6in4 tunnels. Below, I'll work through the setup I tried recently in EC2, using 6in4 totunnel. The two hosts are 10.239.143.35 and 10.238.249.113. First, let'sset up the dummy interfaces. We'll use these Bash functions:function dummy {  local name=$1 ipv6=$2  ip link add $name type dummy  ip -6 addr add $ipv6 dev $name  ip link set $name up}function calc6to4 {  printf '2002:%02x%02x:%02x%02x::\n' $(tr '.' ' ' <<<$@)}function eth0ipv4 {  ip addr list dev eth0 | egrep -o 'inet [^/]+' | head -n1 | cut -d' ' -f2}(You can just paste these straight in to your shell session.)On the first host, we run::;  ipv4=$(eth0ipv4):;  ipv6=$(calc6to4 $ipv4):;  echo ipv4 = $ipv4 ipv6 = $ipv6ipv4 = 10.239.143.35 ipv6 = 2002:0aef:8f23:::;  dummy dummy9 $ipv69:;  ip addr show dev dummy969: dummy9: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN     link/ether e2:69:75:10:04:2c brd ff:ff:ff:ff:ff:ff    inet6 2002:aef:8f23::9/128 scope global        valid_lft forever preferred_lft forever    inet6 fe80::e069:75ff:fe10:42c/64 scope link        valid_lft forever preferred_lft foreverPinging seems to work okay::;  ping6 -q -c1 $ipv69PING 2002:0aef:8f23::9(2002:aef:8f23::9) 56 data bytes--- 2002:0aef:8f23::9 ping statistics ---1 packets transmitted, 1 received, 0% packet loss, time 0msrtt min/avg/max/mdev = 0.040/0.040/0.040/0.000 msNow it's on to the second host::;  ipv4=$(eth0ipv4):;  ipv6=$(calc6to4 $ipv4):;  echo ipv4 = $ipv4 ipv6 = $ipv6ipv4 = 10.238.249.113 ipv6 = 2002:0aee:f971:::;  dummy dummy9 $ipv69Ping check checks out::;  ping6 -q -c1 $ipv69PING 2002:0aee:f971::9(2002:aee:f971::9) 56 data bytes--- 2002:0aee:f971::9 ping statistics ---1 packets transmitted, 1 received, 0% packet loss, time 0msrtt min/avg/max/mdev = 0.037/0.037/0.037/0.000 msNow it's time for the exciting bit: connecting the hosts with 6in4 tunnels. Weuse the following Bash function on both hosts:function tunnel {  local name=$1 self_ipv4=$2 ipv4=$3 ipv6=$4  ip tunnel add $name mode sit ttl 64 remote $ipv4 local $self_ipv4  ip -6 addr add $ipv61 dev $name  ip -6 route add $ipv6/64 dev $name metric 1  ip link set $name up}On the first host:################################### IPv4 and IPv6 from host 2 ##:;  tunnel tun6in4 10.239.143.35 10.238.249.113 2002:0aee:f971::On the second:################################### IPv4 and IPv6 from host 1 ##:;  tunnel tun6in4 10.238.249.113 10.239.143.35 2002:0aef:8f23::When we try to find a route from the first host to 2002:aee:f971::9, boundto the dummy device on the second, we get a hit::;  ip -6 route get 2002:aee:f971::92002:aee:f971::9 from :: dev tun6in4  src 2002:aee:f971::1  metric 0     cache But pings don't work::;  ping6 -q -c1 2002:aee:f971::9PING 2002:aee:f971::9(2002:aee:f971::9) 56 data bytes--- 2002:aee:f971::9 ping statistics ---1 packets transmitted, 0 received, 100% packet loss, time 0msMaybe I need to add an address to eth0?
How do I create an IPv6 overlay network?
linux;networking;ip;ping;ipv6
It turns out that the tunnel should have an IPv6 address on the source host, not the target host (the peer), for this simple ping test to work.function tunnel {  local name=$1 self_ipv4=$2 self_ipv6=$3 ipv4=$4 ipv6=$5  ip tunnel add $name mode sit ttl 64 remote $ipv4 local $self_ipv4  ip -6 addr add $self_ipv61 dev $name  ip -6 route add $ipv6/64 dev $name metric 1  ip link set $name up}The tunnel setup commands would then be::;  tunnel tun6in4 10.239.143.35 2002:0aef:8f23:: 10.238.249.113 2002:0aee:f971:::;  tunnel tun6in4 10.238.249.113 2002:0aee:f971:: 10.239.143.35 2002:0aef:8f23::