SkillPilotAI

IPv6 basics

IPv6 is the 128-bit successor of IPv4: so many addresses that every device can have its own global address with no NAT. You must know how to read and shorten an address, the main address types and why every LAN is a /64.

12.1 Why is it used?

  • IPv4 is 32 bits: only about 4.3 billion addresses, too few for the world's devices.
  • So an ISP gives a whole home one public IPv4; the router's NAT swaps the laptop's private 192.168.1.10 for the public address.
  • With IPv6 every device gets its own global address; the phone's packet goes router -> ISP -> server with no NAT on the way.
  • The server sees exactly which device sent the request (end-to-end addressing).
Same request: IPv4 + NAT vs IPv6
  1. 1.IPv4: laptop 192.168.1.10 sends a request

  2. 2.Home router NAT: private source replaced by the one public IPv4

  3. 3.ISP -> server: server sees only the router's address

  4. 4.IPv6: phone sends from its own global address

  5. 5.Router -> ISP -> server with no NAT; server sees the phone's address

12.2 IPv6 address: 128 bits

  • IPv4: 32 bits (~4.3 billion); IPv6: 128 bits = 2^128, about 340 undecillion.
  • Written in hexadecimal (0-9, a-f), as 8 groups called hextets.
  • Each hextet is 16 bits; a colon (:) goes between groups.

12.3 Two rules of short notation

  • Rule 1: drop the leading zeros of each group (0db8 -> db8, 0010 -> 10).
  • Rule 2: replace ONE continuous run of zero groups with ::.
  • :: may appear only once, otherwise nobody can tell how many zero groups sit where.
  • Put :: on the longest zero run; a single zero group stays as 0 (2001:0db8:0000:0000:0000:0001:0000:0001 -> 2001:db8::1:0:1).
Output
Full address (8 groups)2001:0db8:0000:0000:0000:0000:0000:0010 Rule 1: leading zeros drop2001:db8:0:0:0:0:0:10 Rule 2: run of zero groups = ::2001:db8::10 Wrong: :: two times2001:db8::1::10

12.4 IPv6 address types

TypePrefixScope / reachIPv4 equivalent
Global unicast2000::/3Whole internetPublic IPv4
Link-localfe80::/10Own link only (never forwarded)169.254.x.x
ULAfc00::/7 (fd..)Inside the company, not on the internetPrivate 10/172.16/192.168
Multicastff00::/8Members of a groupBroadcast / multicast
Loopback::1The host itself127.0.0.1
  • Link-local (fe80) is built automatically as soon as IPv6 is on, with no DHCP; a PC can reach a server on the same LAN through the switch with it, but a router never forwards it.
  • Global address: used to reach internet servers; unique worldwide, so it goes through the router.
  • ULA (fd..): for services inside the office; travels inside company networks but is not routed on the internet.

12.5 No broadcast: multicast

  • IPv4 broadcast disturbs every device on the LAN; IPv6 has no broadcast at all.
  • Multicast: only members of the group process the packet.
  • ff02::1 = all-nodes group (every device on the link); ff02::2 = all-routers group (only the router processes it).
Link-local and multicast on one LAN
  1. 1.PC (fe80::a1) sends to fe80::c3: switch delivers to the file server

  2. 2.Same fe80 packet towards the router: never forwarded off the link

  3. 3.PC pings ff02::1: every node on the LAN answers

  4. 4.PC sends to ff02::2: only the router processes it

  5. 5.Global 2000::/3 packet: switch -> router -> internet

fe80 scope = one link; global scope = the whole internet

12.6 The /64 prefix

  • First 64 bits = network prefix, last 64 bits = interface ID (identifies the device on the LAN).
  • ISP usually gives a site a /48; the next 16 bits are the subnet ID, so 65,536 subnets of /64 per site.
  • Standard size of every LAN = /64; SLAAC (next video) needs /64.
Output
2001:0db8:00ab:0012:0000:0000:0000:0010|---- prefix /64 --| |-- interface ID --| 2001:0db8:00ab  site prefix /48 (ISP)0012            subnet ID (16 bits)0000:...:0010   interface ID (64 bits) /48 site = 65,536 subnets of /641 LAN = /64 = 2^64 addressesSLAAC needs /64

12.7 Practical: ip -6 addr and ip -6 route

  • Lab: a dual-stack LAN in Docker with a ULA prefix fd12:32::/64 alongside IPv4.
  • The PC has one scope global ULA address and one scope link fe80 address that the kernel built itself.
  • Both routes are /64 and the default route goes to the gateway fd12:32::1.
Terminal
ip -6 addr show eth0ip -6 routeping -6 -c 2 fd12:32::20A=2001:0db8:0000:0000:0000:0000:0000:0010ip addr add $A/64 dev eth0ip -6 addr show eth0 scope globalping -c 2 ff02::1%eth0ip -6 maddr show dev eth0
Output
$ ip -6 addr show eth02: eth0@if330: <BROADCAST,MULTICAST,UP,LOWER_UP>    inet6 fd12:32::10/64 scope global nodad    inet6 fe80::802b:96ff:fead:ae05/64 scope link$ ip -6 routefd12:32::/64 dev eth0 proto kernel metric 256fe80::/64 dev eth0 proto kernel metric 256default via fd12:32::1 dev eth0 metric 1024

Short-notation proof: the long address with all zeros was added, and Linux itself printed it as 2001:db8::10.

Output
$ ping -6 -c 2 fd12:32::2064 bytes from fd12:32::20: icmp_seq=1 ttl=64    time=0.417 ms64 bytes from fd12:32::20: icmp_seq=2 ttl=64    time=2.40 ms2 packets transmitted, 2 received, 0% loss$ A=2001:0db8:0000:0000:0000:0000:0000:0010$ ip addr add $A/64 dev eth0$ ip -6 addr show eth0 scope global    inet6 2001:db8::10/64 scope global    inet6 fd12:32::10/64 scope global nodad

Pinging ff02::1 needs the interface (%eth0) because it is a link-local group; one ping got replies from three fe80 addresses (the PC itself plus the other nodes).

Output
$ ping -c 2 ff02::1%eth064 bytes from fe80::802b:96ff:fead:ae05%eth064 bytes from fe80::7cad:6eff:fefb:58f2%eth064 bytes from fe80::8067:21ff:fe52:a267%eth02 transmitted, 2 received, +3 duplicates$ ip -6 maddr show dev eth02:	eth0	inet6 ff02::1:ffad:ae05	inet6 ff02::1:ff00:10 users 2	inet6 ff02::1	inet6 ff01::1

12.8 Practical: IPv6 on Windows

  • IPv6 is on by default on Windows; ::1 is the loopback like 127.0.0.1.
  • The prefix policy table lists address types such as ::1/128 and fc00::/7 (ULA).
  • ipconfig shows 'IPv6 Address' and 'Link-local IPv6 Address' lines on your own PC.
PowerShell
ping -n 2 ::1netsh interface ipv6 show prefixpolicies
Output
$ ping -n 2 ::1Reply from ::1: time<1msReply from ::1: time<1msPackets: Sent = 2, Received = 2, Lost = 0$ netsh interface ipv6 show prefixpoliciesPrecedence  Label  Prefix        50      0  ::1/128        40      1  ::/0        35      4  ::ffff:0:0/96        30      2  2002::/16         3     13  fc00::/7

12.9 Comparison: IPv4 vs IPv6

PointIPv4IPv6
Size32-bit128-bit
NotationDotted decimalHex, 8 groups, :: shortening
BroadcastYesNo, multicast only
Link-localOptional (169.254)Always fe80:: on every interface
LAN sizeAny (/24 common)/64 standard
NATUsually neededNot needed

12.10 Common mistakes

  • Using :: twice in one address (2001:db8::1::10 is invalid).
  • Dropping trailing zeros instead of leading zeros (0010 -> 10 is right, 0010 -> 001 is wrong).
  • Expecting a router to forward fe80 traffic, or pinging ff02::1 without %interface.
  • Thinking 'no NAT = everything open': the router's stateful firewall still blocks unknown inbound connections; only replies to the phone's own requests come back in.

12.11 Interview tips

  • IPv4 = 32-bit dotted decimal; IPv6 = 128-bit hex in 8 hextets.
  • IPv6 has no broadcast, only multicast (ff02::1 all nodes, ff02::2 all routers).
  • Every IPv6 interface has a link-local fe80:: address; global = 2000::/3, ULA = fc00::/7.
  • LAN prefix is /64 (64-bit interface ID); a site usually gets a /48.
  • Security comes from the firewall, not NAT.