Computer Networking Cheatsheet
IPv6
Use this Computer Networking reference while you build software engineering projects, review code, or refresh the syntax you reach for most.
Address format and compression
128 bits written as eight groups of four hex digits separated by colons. Two compression rules, and they are the whole trick.
1. Drop leading zeros in any group: 0db8 → db8, 0000 → 0.
2. Replace one run of all-zero groups with ::. Only one per address, or the
length would be ambiguous.
full 2001:0db8:0000:0000:0008:0800:200c:417a leading 0s 2001:db8:0:0:8:800:200c:417a compressed 2001:db8::8:800:200c:417a loopback 0000:...:0001 → ::1 unspecified 0000:...:0000 → ::
Prefix notation is the same idea as CIDR: 2001:db8:acad:1::/64. The
/64 is the standard subnet size for any link, because SLAAC and many
features assume 64 interface bits. Sites usually get /48 or /56 from an ISP,
which is 65,536 or 256 subnets.
2001:0db8:acad:0001 : 0000:0000:0000:0010 \__________________/ \___________________/ /64 network interface identifier 48 global + 16 subnet
Address types and scopes
| Type | Prefix | Notes |
|---|---|---|
| Global unicast (GUA) | 2000::/3 | routable on the internet |
| Unique local (ULA) | fc00::/7, in practice fd00::/8 | the RFC 1918 analogue, not routed globally |
| Link-local (LLA) | fe80::/10 | mandatory on every interface, scope is one link |
| Loopback | ::1/128 | equivalent to 127.0.0.1 |
| Unspecified | ::/128 | source before configuration, "any" when binding |
| Multicast | ff00::/8 | replaces broadcast entirely |
| Anycast | out of unicast space | nearest of many, same as IPv4 |
| IPv4-mapped | ::ffff:0:0/96 | ::ffff:192.0.2.1 in dual-stack sockets |
| Documentation | 2001:db8::/32 | safe in examples |
| Teredo · 6to4 | 2001::/32, 2002::/16 | legacy transition, avoid |
| Well-known multicast | Group |
|---|---|
| All nodes on the link | ff02::1 |
| All routers on the link | ff02::2 |
| Solicited-node (used by NDP) | ff02::1:ff00:0/104 |
| mDNS | ff02::fb |
| OSPFv3 | ff02::5, ff02::6 |
There is no broadcast in IPv6. Link-local addresses need a zone index when
used, for example ping fe80::1%eth0, and in URLs an IPv6 literal is bracketed:
http://[2001:db8::1]:8080/.
Header and what changed from IPv4
+---------+---------------+-----------------------+ | Version | Traffic Class | Flow Label | +---------+---------------+-------+---------------+ | Payload Length | Next Header | Hop Limit | +-----------------------------------------------+ | Source Address (128 bits) | +-----------------------------------------------+ | Destination Address (128 bits) | +-----------------------------------------------+
| Change | Detail |
|---|---|
| Fixed 40-byte header | no variable options, options move to extension headers |
| No header checksum | layer 2 and layer 4 already check, saves per-hop work |
| No fragmentation by routers | only the source may fragment, PMTUD is mandatory |
| Minimum MTU 1280 | every link must carry at least this |
| TTL renamed | Hop Limit, same semantics |
Next Header | chains extension headers, or names the L4 proto (6, 17, 58) |
| ARP replaced | Neighbor Discovery over ICMPv6 |
| NAT unnecessary | end-to-end addressing is the point |
SLAAC, DHCPv6, and NDP
Neighbor Discovery (ICMPv6) does what ARP, ICMP redirect, and router discovery did in IPv4.
| ICMPv6 type | Message | Purpose |
|---|---|---|
| 133 | Router Solicitation (RS) | "any routers here?" to ff02::2 |
| 134 | Router Advertisement (RA) | prefix, flags, MTU, default gateway |
| 135 | Neighbor Solicitation (NS) | the ARP request equivalent |
| 136 | Neighbor Advertisement (NA) | the ARP reply equivalent |
| 137 | Redirect | better first hop |
SLAAC flow: the host makes a link-local address, runs duplicate address detection, sends an RS, receives an RA carrying a /64 prefix, then builds its own global address by appending an interface identifier. No server holds state.
The interface identifier can be EUI-64 (derived from the MAC, flipping the
universal bit and inserting fffe, which leaks the hardware address) or a
privacy / stable random address per RFC 8981 and RFC 7217, which is what
modern systems default to.
RA flags decide who assigns what:
| Flag | Meaning |
|---|---|
A autonomous | use this prefix for SLAAC |
M managed | get addresses from DHCPv6 |
O other config | get DNS and other options from DHCPv6 |
DHCPv6 (UDP 546 client, 547 server) uses SOLICIT, ADVERTISE, REQUEST, REPLY and, notably, never supplies a default gateway. The router always comes from an RA, so blocking RAs breaks IPv6 even with DHCPv6 running. RDNSS in the RA (RFC 8106) can carry DNS servers without DHCPv6 at all.
Commands
ip -6 addr show # note the scope: global, link ip -6 route ip -6 neigh # the NDP cache, ARP's replacement ping -6 2606:4700:4700::1111 ping fe80::1%eth0 # link-local needs the zone ping6 -c3 ff02::1%eth0 # who is on this link traceroute6 example.com ss -6 -lntp dig AAAA example.com +short curl -6 -sS https://example.com -o /dev/null -w '%{remote_ip}\n' curl -g 'http://[2001:db8::1]:8080/' # -g stops glob parsing of brackets sysctl net.ipv6.conf.all.disable_ipv6 sysctl net.ipv6.conf.eth0.accept_ra radvdump # watch RAs on the wire tcpdump -ni eth0 icmp6
Dual stack and the gotchas
| Trap | Detail |
|---|---|
| Firewall is v4 only | services are fully exposed over IPv6, always write both rulesets |
| Blocking all ICMPv6 | breaks NDP, PMTUD, and SLAAC, so IPv6 stops working |
| Rogue RA | any host can advertise itself as the router, use RA Guard on switches |
| Happy Eyeballs | clients race A and AAAA (RFC 8305), so a broken AAAA shows as a ~200 ms delay, not an error |
| AAAA published too early | a record pointing at an unreachable address degrades every client |
| Logs and allowlists | v4 string matching and /32 allowlists silently miss v6 traffic |
:: bind | on Linux net.ipv6.bindv6only=0 means it accepts IPv4 too, so one listener covers both |
| PMTUD required | no router fragmentation, so a blackholed ICMPv6 type 2 stalls large transfers |
Transition mechanisms in current use are dual stack (run both, the default answer), NAT64 plus DNS64 (v6-only clients reaching v4 servers), and 464XLAT on mobile networks. 6to4 and Teredo are deprecated relics.