Fundamentals 38 min read

Comprehensive Overview of IPv6: Concepts, Linux Implementation, Experiments, and Transition Technologies

This article delivers a comprehensive, experiment‑driven guide to IPv6, covering its 128‑bit address scheme, Linux kernel stack, practical setups such as stateless autoconfiguration and web services, various transition mechanisms like dual‑stack, tunneling and NAT64/DNS64, and detailed socket‑programming considerations for developers.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
Comprehensive Overview of IPv6: Concepts, Linux Implementation, Experiments, and Transition Technologies

On November 26, 2017 the Central Committee of the Communist Party of China and the State Council issued the "IPv6 Large‑Scale Deployment Action Plan", marking a strategic mobilization for IPv6 in China.

This article introduces IPv6 from several angles:

Basic concepts of IPv6

Implementation of IPv6 in Linux

Practical experiments

Transition technologies

Socket programming considerations on Linux

A simple TGW prototype demo

IPv6 Basics

IPv4’s 32‑bit address space is exhausted; IPv6 uses 128‑bit addresses, providing a vastly larger address space. An IPv6 packet header is fixed at 40 bytes, making processing more efficient. Key header fields include the Hop‑Limit (similar to IPv4 TTL), Traffic Class (similar to IPv4 TOS), and the removal of the checksum field.

IPv6 introduces extension headers (e.g., Fragment, Routing, Hop‑by‑Hop) that replace IPv4 options and enable flexible packet processing.

IPv6 Address Syntax

An IPv6 address is written as eight groups of four hexadecimal digits separated by colons. Leading zeros can be omitted, and consecutive zero groups can be compressed to a double colon ("::") – which may appear only once.

Examples:

Full form: 2001:0D12:0000:0000:02AA:0987:FE29:9871

Compressed: 2001:D12::2AA:987:FE29:9871

IPv6 address types:

Global Unicast – prefix 2000::/3

Link‑Local – prefix FE80::/10

Unique Local – prefix FC00::/7 (private‑network equivalent)

Multicast

Anycast

Loopback – ::1

Linux Kernel IPv6 Architecture

The Linux kernel implements IPv6 as a parallel stack to IPv4. Core modules include:

Network layer – IPv6 routing subsystem

Transport layer – TCPv6 and UDPv6

ICMPv6 – essential for neighbor discovery and diagnostics

Neighbor Discovery Protocol (NDP) – IPv6 counterpart of ARP

Advanced features – NAT64, tunneling, IPsec, etc.

Experiments

1. Stateless Address Autoconfiguration using radvd on a Linux router. Clients send Router Solicitation messages and receive Router Advertisements containing the network prefix, which they combine with their Interface Identifier to form a full IPv6 address.

2. Static Routing – configuring IPv6 routes on Windows 7, Linux routers, and an Ubuntu 16.04 server. Screenshots show the exact commands and the resulting connectivity.

3. IPv6 Web Service – deploying the lightweight boa web server on the Ubuntu server. Accessing the service from a client requires enclosing the IPv6 address in brackets (e.g., http://[2001:db8:1::1]/ ).

4. Transition Technologies

Dual‑Stack – nodes run both IPv4 and IPv6 stacks; applications can switch to IPv6 by changing the socket family.

Tunneling – encapsulating IPv6 packets inside IPv4. Implementations demonstrated include: 6to4 (automatic, uses prefix 2002::/16 ) – configured via the Linux sit driver. ISATAP – intra‑site automatic tunnel; Windows 7 supports it natively via netsh . Teredo – UDP‑based tunnel that traverses NAT; open‑source miredo exists for Linux.

NAT64/DNS64 – IPv6‑only clients reach IPv4 servers by translating IPv6 AAAA queries to IPv4 A records (DNS64) and mapping IPv6 traffic to IPv4 (NAT64). Open‑source implementations such as tayga (user‑space) and ecdysis (kernel) are mentioned.

All experiments include packet captures that illustrate the additional encapsulation layers introduced by tunnels.

IPv6 Socket Programming Tips

Address Encoding – IPv6 addresses are 128‑bit values. Use struct in6_addr or split into two uint64_t for efficient comparison and storage.

IPv4 Compatibility – Linux maps IPv4 packets received on an IPv6 socket to IPv4‑mapped IPv6 addresses (e.g., ::ffff:192.0.2.1 ) and vice‑versa when sending.

Link‑Local Scope ID – when binding or connecting to a link‑local address, the sin6_scope_id field must be set to the interface index (obtainable via ip addr on Linux or route print -6 on Windows).

Conclusion

The article provides a thorough, experiment‑driven introduction to IPv6, covering fundamentals, Linux implementation details, practical configuration steps, and a range of transition mechanisms. It also highlights common pitfalls in IPv6 socket programming, offering concrete code‑level advice.

Original Statement : This article is authored by the Tencent WeChat Technical Architecture Team and is published with permission. Unauthorized reproduction is prohibited.

IPv6LinuxnetworkingSocket Programmingaddressingtransition technologiestunneling
Tencent Cloud Developer
Written by

Tencent Cloud Developer

Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.