DEVOPS, SRE AND CLOUD · PART 2 · NETWORKING FOR DEVOPS · ADVANCED · 44 OF 187

IPv6, MTU, BGP and Anycast for DevOps Engineers

The advanced topics that explain strange outages: IPv6 addresses, prefixes and dual stack; MTU and path MTU discovery measured in our lab (a 1,472-byte ping with do-not-fragment got "Frag needed and DF set (mtu = 1400)", 1,372 bytes passed), why blocked ICMP makes connections hang; and how BGP and anycast route the internet, CDNs and DNS, with lessons from real BGP outages.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
1 / 12

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • 128-bit v6, /64 subnets
  • dual stack
  • DF ping: mtu = 1400
  • allow ICMP
  • BGP announces prefixes
  • anycast

Notes

IPv6 addresses

IP version six addresses are a hundred and twenty eight bits, written as eight groups of hexadecimal. Leading zeros drop and one run of zero groups becomes a double colon, so Python shortened our long example to two thousand and one colon d b eight colon colon one. A typical site gets a slash forty eight: sixty five thousand five hundred and thirty six subnets of slash sixty four, the standard subnet size. Colon colon one is loopback, fe eighty is link-local, and fd ranges are private.

Python ipaddress (ours)
2001:0db8:0000:0000:0000:
  0000:0000:0001
  → 2001:db8::1
a /48 site: 2^80 addresses
  = 65,536 /64 subnets
::1        loopback
fe80::/10  link-local
fd00::/8   private (ULA)
2001:db8::/32 docs only

Living with IPv6

Most networks run dual stack, both versions side by side. If a name has an AAAA record, clients usually try IP version six first, so a broken v six path causes slow or failed connections even though v four works. There is usually no NAT, so every host can be globally routable, and your firewall must cover v six too. Neighbour discovery over ICMP v six replaces ARP, so ICMP v six must not be blocked. Our lab kernel had IP version six disabled, a reminder to test both stacks.

In practice
  • dual stack: v4 and v6 side by side; clients prefer v6
  • AAAA records → v6 attempts
  • no NAT: every host routable → firewall v6 too
  • NDP replaces ARP; ICMPv6 must not be blocked
  • cloud: dual-stack VPCs, egress-only IGW

MTU

MTU is the largest packet a link carries. We set the second link in our namespace lab to fourteen hundred bytes and sent a ping that filled a fifteen hundred byte packet with the do not fragment flag. The router refused: fragmentation needed and DF set, MTU fourteen hundred. A ping with thirteen hundred and seventy two bytes of data, plus eight of ICMP header and twenty of IP header, is exactly fourteen hundred, and it passed.

Our lab: one 1400 link
$ ping -M do -s 1472 host
From 10.0.1.1: Frag needed
  and DF set (mtu = 1400)
$ ping -M do -s 1372 host
1380 bytes from host: ttl=63

1372 + 8 ICMP + 20 IP
  = 1400 exactly

Path MTU discovery

That error message is how path MTU discovery works. TCP sends with do not fragment set; a router with a smaller link replies with the MTU, and the sender remembers it. After our test, ip route get showed a cached route with MTU fourteen hundred, valid for about ten minutes. Now the classic outage: a firewall blocks all ICMP, the message never arrives, and large packets silently disappear. Handshakes and small requests work; big responses hang forever.

How it should work
send with DF set
router: ICMP "frag needed,
  mtu 1400"
sender lowers its size
$ ip route get 10.0.2.20
  cache expires 599sec
  mtu 1400
block that ICMP → large
  packets vanish: "black hole"

Where it bites

Where does this bite? Every tunnel adds headers, so VPNs, VXLAN overlays and GRE have a smaller inner MTU than fifteen hundred. AWS uses jumbo frames of up to nine thousand and one bytes inside a VPC, but traffic to the internet or over a VPN is limited to fifteen hundred or less. Kubernetes network plugins must set the pod MTU to match. Fixes: allow the ICMP messages, clamp TCP's maximum segment size on the tunnel, and set MTUs consistently.

Typical sizes
  • Ethernet 1500
  • VPNs, VXLAN, GRE: overhead → inner MTU smaller
  • AWS inside a VPC: up to 9001 (jumbo), but 1500 to the internet and over VPN
  • Kubernetes CNIs set pod MTU
  • fixes: allow ICMP, MSS clamping, set MTU right

BGP

Between organisations, the internet is routed by BGP. Each network, an autonomous system with its own number, announces the address prefixes it can reach to its neighbours, who pass them on. Routers choose paths by policy and path length. If your network withdraws its announcements, the rest of the internet forgets how to reach you. You meet BGP in the cloud too, in Direct Connect, VPN gateways and transit gateways, and some Kubernetes networking uses it inside the cluster.

The internet's routing
  • networks = autonomous systems (AS numbers)
  • each announces its prefixes to neighbours
  • routers pick paths by policy and AS-path length
  • withdraw a route → the world forgets how to reach you
  • cloud: Direct Connect, TGW

BGP outages

BGP mistakes have caused some of the largest outages. A faulty change can withdraw a company's own prefixes, making its DNS servers and every service unreachable at once, including the tools engineers need to fix it, which is why out of band access matters. Route leaks and hijacks happen when another network announces your prefixes. Defences include RPKI route validation, strict filters, and rolling out network changes in stages.

Lessons
  • a config change withdraws your own prefixes → DNS and services unreachable, remote tools too
  • leaks/hijacks: someone else announces your prefix
  • defences: RPKI, filters, out-of-band access, staged network changes

Anycast

Anycast uses BGP cleverly: the same address is announced from many locations, and routing sends each user to the nearest one, in network terms. Root DNS servers, public resolvers and CDNs work this way, and it absorbs DDoS attacks by spreading them across sites. The trade-off: if routes shift mid-connection, a user may land on another site, so anycast suits DNS and short connections, and CDNs engineer around it for longer ones.

One address, many sites
  • announce one prefix from many locations
  • BGP sends each user to the nearest (in routing terms)
  • used by: root DNS servers, public resolvers, CDNs, DDoS protection
  • mostly UDP / short TCP; a route change moves users

Common mistakes

Mistakes. Blocking all ICMP, which breaks path MTU discovery, and all ICMP v six, which breaks IP version six entirely. Publishing AAAA records without a working v six path. Forgetting v six firewall rules. Leaving tunnel interfaces at fifteen hundred. And making network changes without a staged rollout or another way in when the network breaks.

Avoid these
  • blocking all ICMP / ICMPv6
  • AAAA record without a working v6 path
  • no v6 firewall rules
  • tunnel MTU left at 1500
  • network changes without staged rollout or out-of-band access

Say it like this

In the interview: small requests working while large ones hang points to an MTU black hole: a link with a smaller MTU, often a VPN or overlay, and the ICMP fragmentation needed messages are blocked, so path MTU discovery fails. I confirm with ping and the do not fragment flag at decreasing sizes, then allow that ICMP, clamp MSS on the tunnel or set the right MTU. If the name has an AAAA record, I also check the IP version six path.

In the interview
  • "That smells like an MTU black
  • hole: a smaller link, often a tunnel, and ICMP frag-needed
  • blocked. I test with ping -M do
  • at decreasing sizes, then allow
  • the ICMP, clamp MSS or set the right MTU. I also check IPv6 if the name has AAAA."

Interview questions

Q1How is an IPv6 address written and shortened?

Eight groups of four hex digits; leading zeros in a group are dropped and one run of all-zero groups becomes "::", e.g. 2001:db8::1.

Q2What is path MTU discovery?

Senders set Don't Fragment; routers with smaller links reply with ICMP "fragmentation needed" (or ICMPv6 Packet Too Big) including the MTU, and the sender lowers its size.

Q3What is an MTU black hole?

When ICMP fragmentation-needed messages are blocked, large packets are silently dropped, so connections establish but hang on big transfers.

Q4What is MSS clamping?

Rewriting the TCP maximum segment size in SYN packets on a router or tunnel so endpoints never send segments larger than the path allows.

Q5What is BGP?

Border Gateway Protocol: autonomous systems announce reachable prefixes to neighbours, and routers choose paths by policy and AS path; it routes the internet.

Q6What is anycast?

Announcing the same IP prefix from many locations so BGP delivers each client to a nearby one; used by DNS roots, public resolvers and CDNs.

Q7Why can adding an AAAA record cause problems?

Clients may prefer IPv6; if the IPv6 path, firewall or listener is broken, users see slow fallbacks or failures even though IPv4 works.