简体中文 / [English]


Quick Notes on IPv6 & Differences from IPv4

 

This article is currently an experimental machine translation and may contain errors. If anything is unclear, please refer to the original Chinese version. I am continuously working to improve the translation.

As the title suggests, assuming some basic knowledge of IPv4, let’s quickly get up to speed with IPv6…

I’ve never seriously studied the detailed specifications of IPv6 before—most of what I know comes from trial-and-error usage and googling patterns. But after running into Nanjing University’s notoriously frustrating campus IPv6 setup, it’s finally time to learn IPv6 properly by comparing it with IPv4 (focusing on what’s new or different in v6).

Why IPv6 and Its Current Status

Internet Protocol version 6 (IPv6) is the latest version of the Internet Protocol (IP), designed to replace IPv4, primarily to solve the problem of IPv4 address exhaustion. IPv6 also brings various other improvements over IPv4.

Although IPv6 was designed to replace IPv4, IPv4 still dominates global internet traffic. The adoption of IPv6 has been slow. As of April 2022, the percentage of users accessing Google services via IPv6 surpassed 40% for the first time.

For Chinese home broadband users, the most noticeable benefit is that every device can now have its own public IPv6 address—no more arguing with ISPs or setting up port forwarding! The old double-NAT setup (ISP-level + router NAT) made direct connectivity a nightmare.

With IPv6, things like running BitTorrent/PT, accessing devices remotely, and setting up P2P VPNs become much smoother. For some websites, IPv6 routes might even be less congested—though sometimes they take weird detours and end up slower.

While nationwide IPv6 support in China isn’t perfect yet—often described as “having addresses but not fully usable”—it’s still better than having no public IP at all.

Although Wikipedia states that IPv6 was meant to replace IPv4, due to slow IPv6 rollout, many websites, applications, and legacy devices still don’t support it. Relying solely on IPv6 would cause compatibility issues—for example, as of 2023, GitHub still doesn’t support IPv6. Therefore, the current norm is dual-stack: IPv4 and IPv6 coexisting.

Address Format

IPv4 addresses are typically written in dotted-decimal notation, such as 1.1.1.1, 127.0.0.1.

IPv6 addresses are usually written as 2001:bc8:1d80:202f::1, fc00::1, or 2409:8a20:5803:572f:ad64:b46f:d5a9:5bea.

An IPv6 address consists of 8 groups of 4 hexadecimal digits, separated by colons. Leading zeros in each group can be omitted, and consecutive groups of zeros can be compressed using a double colon ::.

For example, 2001:0db8:02de:0000:0000:0000:0000:0e13 can be shortened to 2001:db8:2de:0:0:0:0:e13, and further to 2001:db8:2de::e13.

Major Chinese ISPs use the following prefixes:

  • China Mobile: 2409::/16
  • China Telecom: 240e::/16
  • China Unicom: 2408::/16

IPv6 address allocations are regionally organized. You can check the allocation details for IPv6 in China here—similar to looking up a phone number’s area code.

Special Addresses

Unspecified Address

In IPv4: 0.0.0.0/8
In IPv6: ::/128, used only when the source IP is unknown.

Private (Local) Addresses

In IPv4: private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16—commonly known as “LAN IPs” assigned behind NAT by routers.

In IPv6: fd00::/8, known as Unique Local Addresses (ULA). In practice, a random 40-bit identifier is usually appended, forming a 48-bit prefix.

ULA addresses can be viewed and configured in OpenWRT under Network → Interfaces → Global Network OptionsULA addresses can be viewed and configured in OpenWRT under Network → Interfaces → Global Network Options

Although IPv6 typically avoids NAT, there are rare cases where NAT6 is used—then ULA addresses are assigned to hosts within the local network.

In IPv4: 169.254.0.0/16, used only for communication within the same broadcast domain. This is rarely seen in practice—mainly when Windows fails to get an IP via DHCP and auto-configures a link-local address.

In IPv6: fe80::/10. Unlike IPv4, every IPv6-enabled interface must have a link-local address, as protocols like NDP and DHCPv6 depend on it. So as long as IPv6 is enabled on the OS, each interface will automatically generate a fe80::/10 address.

Even on a VPS without assigned IPv6 addresses, the interface still auto-generates a link-local addressEven on a VPS without assigned IPv6 addresses, the interface still auto-generates a link-local address

Carrier-Grade NAT (CGNAT, IPv4-only)

A special reserved IPv4 range used by ISPs for NAT. This is the IPv4 address your router gets directly after PPPoE dial-up—specifically from the 100.64.0.0/10 block.

Multicast Addresses

In IPv4: 224.0.0.0/4
In IPv6: ff00::/8

In IPv6, ff02::1 is the multicast group for all nodes on the network, and ff02::2 is for all routers. See RFC 4291 for more.

Address Assignment

IPv4 Address Assignment

Besides manual static configuration, IPv4 uses DHCP to assign addresses.

DHCPv4 process:

  1. Client broadcasts a DHCP Discover message to find available DHCP servers. (No IP yet—uses 255.255.255.255 as destination, 0.0.0.0 as source, UDP ports 68→67)
  2. Server selects an available IP and broadcasts a DHCP Offer with IP, subnet mask, DNS, etc.
  3. Client picks the first Offer and broadcasts a DHCP Request with the chosen IP.
  4. Server replies with DHCP ACK if no conflict; client then configures and uses the IP.

A captured DHCPv4 exchange—all packets broadcasted, identified by Transaction IDA captured DHCPv4 exchange—all packets broadcasted, identified by Transaction ID

IPv6 Address Assignment

IPv6 address assignment differs significantly from IPv4. Let me explain…

In IPv6, the ARP protocol is replaced by NDP (Neighbor Discovery Protocol), which also handles IPv6 address assignment.

NDP defines several new ICMPv6 message types, including Router Solicitation (RS) and Router Advertisement (RA).

IPv6 dynamic address assignment process:

  1. When a host wants dynamic addressing, it sends a Router Solicitation (RS). Routers reply with a Router Advertisement (RA). Routers also broadcast RA periodically.

    RS packet contentRS packet content

    RA packet content with M and O flags at the beginningRA packet content with M and O flags at the beginning

    The RA packet includes two key flags: M (Managed) and O (Other):

    • M = 1: IPv6 address must be obtained via DHCPv6 (stateful)
    • O = 1: Other configuration (e.g., DNS) must be obtained via DHCPv6

    RA also includes Options, one of which is Prefix Information, containing the network prefix and two more flags: L (on-link) and A (Autonomous).

    • L = 1: The prefix can be used for “on-link” determination
    • A = 1: The prefix can be used for SLAAC (auto-configuration)

    Prefix Information in RA packetPrefix Information in RA packet


    Based on M, O, and A flags, IPv6 supports two main dynamic assignment modes: SLAAC and DHCPv6.

    • If M = 1, use stateful DHCPv6
    • If O = 1 and A = 1, use SLAAC + stateless DHCPv6 (for DNS, etc.)
    • If M = 0, O = 0, and A = 1, use SLAAC only
  2. SLAAC Mode

    Thanks to IPv6’s vast address space, a “stateless” address assignment method is possible.

    Combine a 64-bit prefix (from RA) with a 64-bit Interface ID to form your full IPv6 address.

    Interface IDs can be generated in several ways:

    1. Manually configured
    2. Derived from MAC address using EUI-64
    3. Randomly generated (temporary)
    4. Stable privacy extensions (recommended for privacy)

    Each host generates its own Interface ID, then concatenates it with the prefix from RA to form its address—no need to request from a server. Hence, “stateless.” (Note: SLAAC requires a 64-bit prefix.)

    The same Interface ID is also used with fe80:: to generate the link-local address for the interface.

  3. DHCPv6 (Stateful and Stateless)

    When DHCPv6 is used:

    • Stateless DHCPv6: Only fetches additional config (e.g., DNS), while IP is assigned via SLAAC.
    • Stateful DHCPv6: Fetches both IP address and other config.

    The DHCPv6 process is similar to DHCPv4: Solicit, Advertise, Request, Reply. The client eventually receives its IPv6 address from the DHCPv6 server. Minor implementation differences exist—see Wiki or relevant RFCs for details.

Here’s a summary table:

M-bitO-bitA-bitHost AddressOther Config
000Static setupManual
001Prefix from RA, auto-generatedManual
010Static setupDHCPv6
011Prefix from RA, auto-generatedDHCPv6
100Stateful DHCPv6DHCPv6
101Stateful DHCPv6 and/or autoDHCPv6
110Stateful DHCPv6DHCPv6
111Stateful DHCPv6 and/or autoDHCPv6

IPv6 Subnet Model

Unlike IPv4, which uses IP + subnet mask to determine subnets, IPv6 uses a separate on-link determination process. RFC 5942 explains this in detail.

In short: when a host wants to send a packet, only link-local addresses are assumed to be “on-link.” For other addresses, it checks previously received RA packets—specifically the Prefix Information options. If the destination IP falls within a prefix where:

  • The L flag is 1
  • The Lifetime is non-zero

Then the target is considered “on-link” and can be reached directly via NDP (to resolve MAC). Otherwise, the packet must be forwarded to the router.


Now that we’ve covered theory, let’s look at real-world cases…

IPv6 and Chinese ISPs

Introduce a new concept: Prefix Delegation (PD). ISPs often use PD to assign a prefix (typically /48 to /64) to users, so they can assign IPv6 addresses within their own network. The prefix length must not exceed /64, otherwise SLAAC breaks.

When using bridge mode on your optical modem and OpenWRT for PPPoE, several scenarios may occur:

  1. No IPv6 address at all…

    Time to complain to your ISP. But most areas should have IPv6 by now—first check your OpenWRT configuration.

  2. IPv6 address but no PD prefix

    Rare, but I’ve encountered this with Suzhou Mobile. You should still try complaining.

    In this case, only the OpenWRT router gets an IPv6 address, but can’t assign addresses to downstream devices.

    You’ll need to set up IPv6 relay to pass the upstream address down.

  3. IPv6 address and PD prefix

    With PD, you can assign IPv6 addresses to devices behind the router. A /64 prefix allows only one subnet, /60 gives 2^4 = 16 subnets, and so on.

    In this case, OpenWRT’s default config usually works fine—devices get public IPv6 addresses and can access the internet. (This is how it should work.)

OpenWRT after dial-up—no PD shown. If PD were present, there would be an extra IPv6-PD lineOpenWRT after dial-up—no PD shown. If PD were present, there would be an extra IPv6-PD line

IPv6 and VPS

Many VPS providers support IPv6. Some even offer cheap IPv6-only VPS, or charge extra for IPv4 (since IPv4 is now a scarce resource). Such VPS can only access IPv4 via WARP or similar tunneling.

VPS providers often give generous IPv6 prefixes—sometimes /56 or even /48. On the public internet, a /64 is typically considered one “host” or source. So a /56 gives you 2^8 = 256 distinct “identities.” (Though anti-abuse systems are complex—actual behavior varies.)

Also, IPv6 is generally less censored. (Can I say that?)

Campus IPv6

Campus IPv6 setups are a nightmare—each university seems to have its own uniquely broken configuration. I won’t go into Nanjing University’s mess in detail… but you can refer to YDJSIR’s blog and Chariri’s post for more.

Right now, I’m using an OpenWRT router in my dorm. By default, the WAN port can’t get an IPv6 address—logs show Server returned IA_NA status: No prefix available (NoPrefixAvail). Setting the wan6 interface’s “Request IPv6 prefix length” to disabled allows me to get a /128 IPv6 address. Then I use (admittedly ugly) NAT6 to let LAN devices access IPv6.

This article is licensed under the CC BY-NC-SA 4.0 license.

Author: lyc8503, Article link: https://blog.lyc8503.net/en/post/ipv6-differences/
If this article was helpful or interesting to you, consider buy me a coffee¬_¬
Feel free to comment in English below o/