Teredo encodes multiple pieces of information within the IPv6 address itself, using obfuscation to prevent certain types of NAT interference. The address structure is carefully designed to work through NAT devices.
Teredo Address Structure (128 bits):
- Bits 0-31: Prefix 2001:0000 (always 2001:0::/32)
- Bits 32-63: Teredo Server IPv4 address (32 bits, plain)
- Bits 64-79: Flags (16 bits, typically 0x0000 or 0x8000)
- Bits 80-95: Obfuscated UDP port (XOR with 0xFFFF)
- Bits 96-127: Obfuscated client IPv4 (XOR with 0xFFFFFFFF)
Example Parsing:
- Teredo Address: 2001:0000:4136:e378:8000:63bf:3fff:fdd2
- Server IPv4: 65.54.227.120 (from 4136:e378)
- Flags: 0x8000 (cone NAT indicator)
- UDP Port: 40000 (from 0x63bf XOR 0xFFFF = 0x9C40)
- Client IPv4: 192.0.2.45 (from 0x3fff:fdd2 XOR 0xFFFF:FFFF)
Why Obfuscation?
IP addresses and ports are obfuscated (XORed) to prevent NAT devices from rewriting them:
- Some NATs perform deep packet inspection and modify IP addresses in payloads
- Obfuscation makes addresses unrecognizable to simple pattern matching
- Port obfuscation prevents port-rewriting NATs from interfering
Flags Field:
- 0x0000: Client behind restricted cone NAT or unknown
- 0x8000: Client behind cone NAT (easier traversal)
- Used to optimize NAT traversal strategy
How Teredo Worked:
- Client contacts Teredo server to obtain IPv6 prefix
- Server encodes client's IPv4:port in IPv6 address
- IPv6 packets encapsulated in UDP to IPv4 destination port 3544
- NAT keeps UDP mapping alive through periodic keepalives
- Teredo relay forwards to/from native IPv6 Internet
Why Teredo is Deprecated:
- Security concerns: Anyone could be a relay, enabling attacks
- Performance: Double encapsulation overhead, high latency
- Unreliable: NAT traversal failures, firewall blocks UDP 3544
- Complexity: Difficult to troubleshoot and maintain
- Better alternatives: Native IPv6, 464XLAT, NAT64 more reliable
Modern Status:
Windows Vista/7 enabled Teredo by default, but Windows 10/11 disable it by default. Most modern networks use native IPv6 or NAT64 instead. Teredo addresses in logs typically indicate legacy systems or security research scenarios.