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

TypePrefixNotes
Global unicast (GUA)2000::/3routable on the internet
Unique local (ULA)fc00::/7, in practice fd00::/8the RFC 1918 analogue, not routed globally
Link-local (LLA)fe80::/10mandatory on every interface, scope is one link
Loopback::1/128equivalent to 127.0.0.1
Unspecified::/128source before configuration, "any" when binding
Multicastff00::/8replaces broadcast entirely
Anycastout of unicast spacenearest of many, same as IPv4
IPv4-mapped::ffff:0:0/96::ffff:192.0.2.1 in dual-stack sockets
Documentation2001:db8::/32safe in examples
Teredo · 6to42001::/32, 2002::/16legacy transition, avoid
Well-known multicastGroup
All nodes on the linkff02::1
All routers on the linkff02::2
Solicited-node (used by NDP)ff02::1:ff00:0/104
mDNSff02::fb
OSPFv3ff02::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)     |
+-----------------------------------------------+
ChangeDetail
Fixed 40-byte headerno variable options, options move to extension headers
No header checksumlayer 2 and layer 4 already check, saves per-hop work
No fragmentation by routersonly the source may fragment, PMTUD is mandatory
Minimum MTU 1280every link must carry at least this
TTL renamedHop Limit, same semantics
Next Headerchains extension headers, or names the L4 proto (6, 17, 58)
ARP replacedNeighbor Discovery over ICMPv6
NAT unnecessaryend-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 typeMessagePurpose
133Router Solicitation (RS)"any routers here?" to ff02::2
134Router Advertisement (RA)prefix, flags, MTU, default gateway
135Neighbor Solicitation (NS)the ARP request equivalent
136Neighbor Advertisement (NA)the ARP reply equivalent
137Redirectbetter 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:

FlagMeaning
A autonomoususe this prefix for SLAAC
M managedget addresses from DHCPv6
O other configget 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

TrapDetail
Firewall is v4 onlyservices are fully exposed over IPv6, always write both rulesets
Blocking all ICMPv6breaks NDP, PMTUD, and SLAAC, so IPv6 stops working
Rogue RAany host can advertise itself as the router, use RA Guard on switches
Happy Eyeballsclients race A and AAAA (RFC 8305), so a broken AAAA shows as a ~200 ms delay, not an error
AAAA published too earlya record pointing at an unreachable address degrades every client
Logs and allowlistsv4 string matching and /32 allowlists silently miss v6 traffic
:: bindon Linux net.ipv6.bindv6only=0 means it accepts IPv4 too, so one listener covers both
PMTUD requiredno 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.