Run dual stack and prove which one the host prefers

applied · 45 min · Objective 1.8

Task

Give both lab hosts IPv6 addresses alongside their IPv4 ones, then find out experimentally which protocol a connection actually uses when both are available. "Dual stack" is a one-line definition that hides a preference rule worth seeing in action.

Steps

  1. Add a unique local IPv6 address to each host on network 1 and 2 respectively: sudo ip -6 addr add fd00:10::10/64 dev eth0 on Host A, and fd00:20::10/64 on Host B. Give the router fd00:10::1/64 and fd00:20::1/64 on its two interfaces.
  2. Enable IPv6 forwarding on the router: sudo sysctl -w net.ipv6.conf.all.forwarding=1. Add default routes on the hosts pointing at the router's IPv6 address on their own segment.
  3. Confirm both stacks work independently: ping -c 2 192.168.20.10 and ping6 -c 2 fd00:20::10 from Host A.
  4. Now give the destination a name both stacks can resolve. Add to Host A's /etc/hosts two lines for the same name — one with the IPv4 address, one with the IPv6 address.
  5. Start a capture on Host A filtering for that name's traffic, then connect by name — curl http://hostb/ or ssh hostb — and read which protocol was used. Predict it first.

Verify

ip -6 addr show eth0 | grep inet6
ping6 -c 2 fd00:20::10
getent ahosts hostb
sudo tcpdump -i eth0 -n -c 4 'host fd00:20::10 or host 192.168.20.10'

getent ahosts prints the resolver's ordered answer, and the capture shows which one was actually used. On a correctly configured dual-stack host the IPv6 address comes first and the capture shows IPv6 traffic.

Notes

The preference is not arbitrary: RFC 6724 defines a destination address selection policy, and by default it ranks IPv6 above IPv4 for equivalent destinations. That is why a broken IPv6 path is such a painful fault — hosts try it first and fall back slowly, so everything feels sluggish rather than broken.

The three transition mechanisms in the objective are worth placing against what you just built. Dual stack is this: both protocols, side by side, and the cleanest approach. Tunnelling carries IPv6 inside IPv4 where the path between does not support it. NAT64 with DNS64 lets an IPv6-only client reach an IPv4-only server, and is how modern mobile networks work.