How openthread/tayga works
Main components
a. TAYGA Daemon
– The user-space process (tayga.c / tayga.h)
– Implements stateless NAT64 translation logic
b. TUN Virtual Network Interface
– Created by “tayga --mktun”
– Exposes a /dev/net/tun device to the kernel
c. Kernel Networking Stack
– IPv4 stack on one side
– IPv6 stack on the other
– Routes packets to/from the TUN interface
d. Configuration and Mapping Store
– tayga.conf (static prefix, pools, addresses)
– dynamic.map file (persistent dynamic IPv6↔IPv4 assignments)
e. External Networks
– Upstream IPv6 network (clients or the Internet)
– Upstream IPv4 network (clients or the Internet)
f. Optional Firewall / iptables
– ip6tables rules controlling NAT64 prefix access
– iptables MASQUERADE for combining stateful NAT4 if needed
Relationships & data-flow
• IPv6 Network → Kernel IPv6 Stack → TUN Interface → TAYGA Daemon
• TAYGA Daemon → TUN Interface → Kernel IPv4 Stack → IPv4 Network
– Within the TAYGA daemon:
• Packet arrives on TUN
• Addresses looked up/translated using:
– Static mapping (RFC 6052 prefix)
– Dynamic mapping (pool + dynamic.map on disk)
• Header rewritten; forwarded back to TUN
Architectural patterns & design principles
– Stateless translation: no per-flow state held in RAM
– 1:1 address substitution (RFC 6052 embedding IPv4 in IPv6)
– Separation of concerns:
• TAYGA handles translation only
• Kernel handles routing & queuing
• External tools (iptables) handle firewalling / stateful NAT
Technologies & files
– Language: C (addrmap.c, nat64.c, dynamic.c, conffile.c)
– Build system: Autoconf/Automake (configure.ac, Makefile.am)
– Config parser: conffile.c / config.h.in
– Mapping logic: addrmap.c + dynamic.c
– TUN driver interaction: tayga.c uses /dev/net/tun
– Persistence: dynamic.map written to data-dir
Putting it all together
– Top layer: External IPv6 network ↔ Kernel IPv6 Stack
– Middle layer: TUN Interface ↔ TAYGA Daemon ↔ Mapping Store
– Bottom layer: Kernel IPv4 Stack ↔ External IPv4 network
– Side notes: iptables/ip6tables for firewalling, Autoconf/Make for build/install