Sub topic 7
IPv6 basics
This chapter assumes you know IPv4 addressing, including private ranges, APIPA, subnet masks, and default gateways. It also assumes you can run commands in a Windows command prompt. IPv6 is the replacement for IPv4. The A+ Core 1 exam expects you to recognize its address types and know how it differs from IPv4.
Why IPv6 exists
IPv4 addresses are 32 bits long, which allows about 4.3 billion addresses. That pool ran out, and NAT (covered in a later chapter) stretched it by letting many devices share one public address. IPv6 addresses are 128 bits long, so every device can have its own globally reachable address and NAT is no longer needed for address conservation.
Reading an IPv6 address
An IPv6 address is written as eight groups of four hexadecimal digits, separated by colons. Each group is 16 bits.
2001:0db8:0000:0000:0000:ff00:0042:8329Two rules shorten an address:
- Drop leading zeros in each group.
0042becomes42, and0000becomes0. - Replace one run of consecutive all-zero groups with
::.
Applying both rules gives 2001:db8::ff00:42:8329. You may use :: only once per address. Two of them would make it impossible to tell how many zero groups each one replaced.
A URL that contains an IPv6 address needs square brackets around the address so the colons are not mistaken for a port separator, for example http://[2001:db8::1]:8080/.
Prefixes instead of subnet masks
IPv6 does not use dotted subnet masks. It uses prefix length notation, such as 2001:db8:1:2::/64. The prefix is the network part. The remaining bits identify the host, and this part is called the interface ID. Almost every LAN uses a /64. A typical ISP gives a home customer a /56 or /64, which the router divides into /64 subnets.
Address types
IPv6 has no broadcast. Its place is taken by multicast, which delivers a packet only to devices that joined a group.
| Type | Prefix | Purpose |
|---|---|---|
| Global unicast | `2000::/3` | Public, routable on the internet. Similar to a public IPv4 address. |
| Link-local | `fe80::/10` | Valid only on the local link. Never routed. Every IPv6 interface has one. |
| Unique local | `fc00::/7` (in practice `fd00::/8`) | Private addressing inside a site. Similar to the IPv4 private ranges. |
| Multicast | `ff00::/8` | One sender to a group of receivers. Replaces broadcast. |
| Loopback | `::1/128` | The local machine. Equivalent to `127.0.0.1`. |
| Unspecified | `::/128` | "No address yet". Used before a device has configured one. |
Anycast is a fourth delivery method. The same address is assigned to several devices, and a packet goes to the nearest one. Public DNS services use it.
How a device gets an address
A device can configure its IPv6 address in three ways.
- SLAAC (stateless address autoconfiguration). The router advertises the network prefix. The device appends its own interface ID and forms an address with no server tracking it. Most home networks work this way.
- Stateful DHCPv6. A DHCPv6 server hands out addresses and keeps lease records, much like DHCP for IPv4. This suits networks that need central control.
- Manual (static) configuration. An administrator types in the address, prefix length, gateway, and DNS servers.
Devices commonly generate random, temporary interface IDs for outgoing connections. This privacy feature stops a device's address from revealing its hardware (MAC) address and being used to track it.
Before it does anything else, a device builds a link-local address starting with fe80::. There is no APIPA-style fallback to worry about in the same way. If a Windows machine shows only an fe80:: address and no global address, the router is not advertising a prefix, or the router has no IPv6 service from the ISP.
IPv6 also replaces ARP with the Neighbor Discovery Protocol (NDP). NDP runs over ICMPv6 and finds neighbors' link-layer addresses and routers on the link. Because it depends on ICMPv6, blocking all ICMPv6 at a firewall breaks IPv6.
Seeing IPv6 on a computer
Run ipconfig /all and read the adapter section. Typical lines look like this:
IPv6 Address. . . . . . . . . . . : 2001:db8:1:2:a1b2:c3d4:e5f6:1234(Preferred)
Temporary IPv6 Address. . . . . . : 2001:db8:1:2:9c8d:7e6f:5a4b:3c2d(Preferred)
Link-local IPv6 Address . . . . . : fe80::a1b2:c3d4:e5f6:1234%12(Preferred)
Default Gateway . . . . . . . . . : fe80::1%12The %12 at the end of a link-local address is the zone ID. It names the network interface, because the same fe80:: address can exist on several interfaces. You need it when pinging a link-local address:
ping ::1
ping fe80::1%12
ping -6 example.comThe first command tests the local IPv6 stack. The second tests the gateway over the link-local address. The -6 switch in the third forces IPv6 for the name lookup and the ping. The tracert -6 and nslookup -type=AAAA commands work the same way. An AAAA record is the DNS record that maps a name to an IPv6 address, just as an A record does for IPv4.
Coexisting with IPv4
Most networks run IPv4 and IPv6 at the same time, which is called dual stack. Each device has both kinds of address, and applications prefer IPv6 when both work. Two other approaches appear on the exam:
- Tunneling wraps IPv6 packets inside IPv4 packets so they can cross an IPv4-only network. Teredo and 6to4 are examples.
- Translation converts between the two address families at a boundary device.
Common errors
- Using
::twice in one address. This is invalid. - Leaving out brackets around an IPv6 address in a URL that includes a port.
- Pinging a link-local address without the zone ID.
- Assuming the device lacks IPv6 because
pingto an IPv4 address works. Test withping -6. - Blocking ICMPv6 entirely. NDP and SLAAC stop working.
- Expecting a broadcast address. IPv6 has none.
Exercise
Shorten fe80:0000:0000:0000:02aa:00ff:fe12:3456 as far as the rules allow. Then say what type of address it is and whether a router will forward packets sent to it.
Show answer
The shortened form is fe80::2aa:ff:fe12:3456. Drop the leading zeros in each group, then replace the run of three zero groups with ::. The fe80 prefix makes it a link-local address. A router will not forward it, because link-local addresses are valid only on the local link.
Exercise
A Windows PC can browse IPv4-only sites but ipconfig shows only an fe80:: IPv6 address and no global address. Name two likely causes.
Show answer
The router is not sending a prefix advertisement (SLAAC is off, or no DHCPv6 service is running), or the ISP is not providing IPv6 service to the router. A firewall that blocks ICMPv6 can also stop router advertisements from reaching the PC.