{"canonical_url":"https://engineer.company/glossary/ipv6/","content_markdown":"# IPv6\n\n## What it is\n\nIPv6, written out as Internet Protocol version 6, is the version of the Internet\nProtocol designed as the successor to IPv4, the version described in RFC 791.\nIts current specification is RFC 8200 from July 2017, an Internet Standard\n(STD 86) that replaced RFC 2460. The change everyone notices is the size of an\naddress: 128 bits instead of IPv4's 32. The whole of IPv4 has 4,294,967,296\naddresses; a single IPv6 subnet of the usual size, a /64, holds that number\nsquared.\n\nThe rest of the packet changed too. RFC 8200 drops some IPv4 header fields or\nmakes them optional to cut processing cost, carries optional information in\nseparate extension headers placed after the main one, and renames Time to Live\nto Hop Limit, which every forwarding node lowers by one. There is no header\nchecksum. Routers never split a packet: fragmentation in IPv6 is done only by\nthe source, every link must carry packets of at least 1280 octets, and senders\nare strongly encouraged to use Path MTU Discovery to find out how large a packet\na path will carry.\n\nAn address is written as eight groups of 16 bits in hexadecimal, separated by\ncolons. RFC 4291 lets you drop the leading zeros in a group and replace one run\nof all-zero groups with a double colon, which may appear only once, so\n2001:db8:0:0:8:800:200c:417a can be written 2001:db8::8:800:200c:417a. Because\nthat leaves many ways to write the same address, RFC 5952 from August 2010 picks\none: lower case, no leading zeros, and the double colon on the longest run of\nzero groups (the first one if two are equally long), never on a single group.\nApart from special addresses such as loopback and link-local ones, every example\naddress and prefix in this article comes from a documentation range:\n2001:db8::/32, which RFC 3849 sets aside, or for IPv4 the blocks reserved by\nRFC 5737.\n\nRFC 4291 also changes what an address is attached to. Addresses belong to\ninterfaces, not to machines, and one interface can have several at once. Every\ninterface must have a link-local address under fe80::/10, valid only on its own\nlink. The loopback address is ::1. There is no broadcast: multicast does that\njob, and ff02::1 reaches all nodes on the link. Unique local addresses under\nfc00::/7, defined in RFC 4193, serve inside a site. Global unicast addresses are used for communication\nbeyond the local site. For most addresses the last 64 bits are the interface\nidentifier, which is why an ordinary network segment is a /64.\n\nHosts usually number themselves. Under stateless address autoconfiguration, RFC\n4862, routers announce the prefixes of a link in periodic Router Advertisements,\neach host combines a prefix with its own interface identifier, and before using\nthe result it runs Duplicate Address Detection, sending Neighbor Solicitation\nmessages to check that no other node holds the address. DHCPv6 is the\nalternative where a site wants tighter control over exact assignments, and the\ntwo can run side by side.\n\n## Why it matters\n\nFor many teams IPv6 is not a project they decide to start. The point of RFC 4862\nis that a host needs nobody to type an address into it: put a server on a link\nwhere a router advertises a prefix, and it can pick up a global IPv6 address by\nitself. Any allow-list, firewall rule, log parser or health check written with\nonly IPv4 in mind then has a blind spot of exactly the size of the new address\nspace.\n\nThat blind spot is easy to miss, because the two versions are separate protocols\nthat share nothing on the wire. A packet filter matches their headers\nseparately, a rate limit keyed on IPv4 addresses never sees an IPv6 client, and\na test that only connects to 127.0.0.1 says nothing about ::1. A host that is\nlocked down on one version and open on the other has, in practice, no firewall.\n\nIPv6 also leans on its control messages more than IPv4 does. Neighbour\ndiscovery, router advertisements and Path MTU Discovery all travel as ICMPv6, so\na habit carried over from IPv4, dropping ICMP at the edge, breaks IPv6 in ways\nthat may only show up once a connection starts moving data. And because one\naddress has many valid spellings, code that compares addresses as strings will\ndisagree with itself.\n\n## What it looks like in practice\n\nPython's standard `ipaddress` module parses every valid spelling and prints a\nshort form, with leading zeros dropped and the longest run of zero groups\ncollapsed, so it is a quick way to plan a prefix and to check that two spellings\nare the same address. The session below is this article's illustration, run on\nPython 3.15 with addresses from the documentation prefix:\n\n```text\n\u003e\u003e\u003e import ipaddress\n\u003e\u003e\u003e site = ipaddress.ip_network(\"2001:db8:42::/48\")\n\u003e\u003e\u003e site.num_addresses == 2**80\nTrue\n\u003e\u003e\u003e lans = site.subnets(new_prefix=64)\n\u003e\u003e\u003e next(lans), next(lans)\n(IPv6Network('2001:db8:42::/64'), IPv6Network('2001:db8:42:1::/64'))\n\u003e\u003e\u003e len(list(site.subnets(new_prefix=64)))\n65536\n\u003e\u003e\u003e a = ipaddress.ip_address(\"2001:0DB8:0000:0000:0001:0000:0000:0001\")\n\u003e\u003e\u003e a\nIPv6Address('2001:db8::1:0:0:1')\n\u003e\u003e\u003e a.exploded\n'2001:0db8:0000:0000:0001:0000:0000:0001'\n\u003e\u003e\u003e a == ipaddress.ip_address(\"2001:db8:0:0:1::1\")\nTrue\n\u003e\u003e\u003e ipaddress.ip_address(\"fe80::1%eth0\").scope_id\n'eth0'\n```\n\nA /48 leaves 80 bits free, and split into /64 segments it gives 65,536 of them,\nnumbered by the fourth group. The address typed in upper case with every zero\nspelled out comes back in the short form, 2001:db8::1:0:0:1, where the double\ncolon covers the first of two equally long runs of zeros, and it compares equal\nto 2001:db8:0:0:1::1, a different but valid spelling of the same 128 bits. The\nlast line shows a link-local address carrying its zone, the `%eth0` that says\nwhich link it belongs to.\n\nOn a Linux host running nftables, the second part of this illustration is a rule\nset that admits SSH from an office over both versions. The nft(8) manual\ndescribes `inet` as a hybrid family whose tables see IPv4 and IPv6 packets\nalike, while `ip saddr` reads the IPv4 header and `ip6 saddr` the IPv6 one:\n\n```text\nadd table inet filter\nadd chain inet filter input { type filter hook input priority filter; }\nadd rule inet filter input ip saddr 198.51.100.0/24 tcp dport 22 accept\nadd rule inet filter input ip6 saddr 2001:db8:42::/48 tcp dport 22 accept\nadd rule inet filter input tcp dport 22 drop\n```\n\nWithout the fourth line, an administrator connecting from the office's IPv6\nprefix matches neither accept rule and is dropped, which at least fails loudly.\nThe quieter failure is the reverse: a rule set built in the `ip` family alone,\non a host that also has an IPv6 address, never looks at IPv6 packets at all.\n\nThe portfolio entry\n[Provisioned a second server from code](/portfolio/provisioned-a-second-server-from-code/),\nfrom September 2026, deals with the same exposure from the provisioning side.\nThe first machine had been created by hand and given its firewall afterwards,\nwhich left a window in which a fresh host with a default password policy was\nreachable from the internet. The second is created only after its firewall: the\nfirewall play runs before the server play, and both providers' firewalls are\nwritten directly against their REST APIs. That page does not mention IPv6, so\nthe rules above are this article's illustration and not that host's. What this\narticle adds is that the firewall has to cover every address the host will have,\nIPv6 included, before the host exists.\n\n## Where it goes wrong\n\n**A firewall that only knows IPv4.** Rules written in the `ip` family, or\nallow-lists holding only IPv4 prefixes, leave every IPv6 address of the host to\nwhatever comes next. Write the rule set in the `inet` family or keep `ip` and\n`ip6` tables in step, pair every `ip saddr` rule with an `ip6 saddr` rule, and\ntest each service by connecting to its IPv6 address as well as its IPv4 one.\n\n**Dropping ICMPv6 wholesale.** RFC 4890, on filtering these messages in\nfirewalls, puts it plainly: \"ICMPv6 is essential to the functioning of IPv6\". A\nrouter that cannot forward a packet because it is too large for the next link\ndiscards it and returns a Packet Too Big message, and RFC 8201 notes that if\nfiltering stops those messages, the source never learns the path MTU. The result\nis what it calls a black-hole connection: the TCP handshake succeeds, then the\ntransfer hangs. RFC 4890 also lists Neighbor Solicitation and Advertisement and\nRouter Solicitation and Advertisement as messages a node must not drop if it is\nto take part in an IPv6 network. Accept the types nft calls `packet-too-big`,\n`nd-neighbor-solicit`, `nd-neighbor-advert`, `nd-router-solicit` and\n`nd-router-advert` before any broader drop.\n\n**Comparing addresses as text.** RFC 5952 gives the example of a spreadsheet\nsearch for 2001:db8:0:0:1::1 that misses an entry written 2001:db8::1:0:0:1,\nwhich matters when the list is searched before a new address is assigned, to\ncheck that it is not already in use. Parse addresses before comparing them, and\nstore and print one canonical form, such as the short form Python's `ipaddress`\nreturns from `str()`.\n\n**An address and a port run together.** 2001:db8::1:80 could be an address, or\nan address followed by port 80; RFC 5952 calls that form ambiguous and\nrecommends square brackets, [2001:db8::1]:80, as in URLs. Always write the\nbrackets, and in code split a host and port on the closing bracket rather than\non the last colon.\n\n**A link prefix that is not a /64.** Autoconfiguration needs the prefix and the\ninterface identifier to add up to 128 bits, and with 64-bit identifiers RFC 4862\nhas a host ignore an advertised prefix of any other length, so hosts on a link\nwhose Router Advertisements carry a /72 or a /56 form no address from that\nprefix. Plan each link as a /64 and split larger allocations into /64s, as the\nsession above does.\n\n**Link-local addresses without their zone.** Every interface has an address in\nfe80::/10, and RFC 4291 limits those addresses to a single link, so on a host\nwith several interfaces the address alone does not say which link is meant.\nPython's documentation notes that two addresses differing only in their zone are\nnot equal. Keep the zone with the address (fe80::1%eth0), or give services a\nglobal or unique local address and keep link-local ones for the link.\n\n## Further reading\n\n- [RFC 8200: Internet Protocol, Version 6 (IPv6) Specification](https://www.rfc-editor.org/rfc/rfc8200.html)\n  — the current IPv6 standard, with the header format, extension headers and the\n  rules for fragmentation and packet size.\n- [RFC 4291: IP Version 6 Addressing Architecture](https://www.rfc-editor.org/rfc/rfc4291.html)\n  — address types, the text forms, link-local and multicast addresses, and\n  64-bit interface identifiers.\n- [RFC 5952: A Recommendation for IPv6 Address Text Representation](https://www.rfc-editor.org/rfc/rfc5952.html)\n  — the canonical way to write an address, and the trouble that many spellings\n  cause.\n- [RFC 4862: IPv6 Stateless Address Autoconfiguration](https://www.rfc-editor.org/rfc/rfc4862.html)\n  — how hosts form their own addresses from advertised prefixes and check them\n  for duplicates.\n- [RFC 4890: Recommendations for Filtering ICMPv6 Messages in Firewalls](https://www.rfc-editor.org/rfc/rfc4890.html)\n  — which ICMPv6 messages a firewall must let through, and why.\n- [ipaddress: IPv4/IPv6 manipulation library](https://docs.python.org/3/library/ipaddress.html)\n  — Python's reference for parsing, comparing and splitting IPv6 addresses and\n  networks.\n\n\u003chttps://engineer.company/glossary/ipv6/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"What IPv6 is, how its addresses are written and handed out, and where it goes wrong, from firewalls that only see IPv4 to blocked ICMPv6 messages.","formats":{"gemtext":"https://engineer.company/glossary/ipv6/index.gmi","gopher":"https://engineer.company/glossary/ipv6/gophermap","html":"https://engineer.company/glossary/ipv6/","json":"https://engineer.company/glossary/ipv6/index.json","markdown":"https://engineer.company/glossary/ipv6/index.md","pdf":"https://engineer.company/glossary/ipv6/index.pdf"},"kind":"page","language":"en","title":"What is IPv6?","url":"https://engineer.company/glossary/ipv6/","version":1}