diff --git a/docs/attachments/464xlat.png b/docs/attachments/464xlat.png new file mode 100644 index 00000000..47664f51 Binary files /dev/null and b/docs/attachments/464xlat.png differ diff --git a/docs/concepts-and-configurations/networking_in_z9.md b/docs/concepts-and-configurations/networking_in_z9.md index e69de29b..97e4cb7e 100644 --- a/docs/concepts-and-configurations/networking_in_z9.md +++ b/docs/concepts-and-configurations/networking_in_z9.md @@ -0,0 +1,81 @@ +# Networking in Z9 + +!!! info "ToDo" + + This page is incomplete. You can help by expanding int ;) + + +## IPv6-mostly + +In Z9 we utilize IP transition technologies usually classified as IPv6-mostly. +The goal is to allow clients to completely disable their IPv4 stack in our network and still reach outside IPv4 hosts on the internet. It also allows graceful fallback onto Dual-Stack connectivity if a client does not support these technologies. + +### Terms & Definitions + +- **NAT64**: A term that almost always describes __stateful__ Network-Address-Translation between an IPv4 and an IPv6 network. Most IP header fields between the two protocols are compatible so a NAT gateway can mostly copy them. It is stateful because established connections are tracked so that packets can pass the gateway in both directions. + +- **NAT64 Prefix**: Term used to describe an IPv6 prefix in which is exactly long enough to contain an embedded IPv4 address. A network may be configured with one NAT64 prefix across different technologies to allow IPv6-mostly operation. + +- **CLAT** (Customer-side-transLATor): Address translation component which runs on the customer site, or rather locally on users devices in our case, and which embeds requests to IPv4 nodes in a preconfigured IPv6 prefix. For example a request to `1.1.1.1` will be emebedded into the configured IPv6 prefix `64:ff9b::/96` as `64:ff9b::101:101`. + +- **PLAT** (Provider-side-transLATor): Address translation component which sits at the provider side, or rather on the Z9 router in our case, and which performs NAT64 on based on a preconfigured IPv6 prefix in which IPv4 requests are embedded. For example with the configured IPv6 prefix `64:ff9b::/96` a request to `64:ff9b::101:101` will be de-embedded and translated into an IPv4 native packet towards `1.1.1.1`. + +- **464XLAT**: A combination of technologies which allow transportation of IPv4 requests over an IPv6 network. The term usually describes backbone networks but the contained technologies also allow us to run an IPv6-mostly access network. + + ![464xlat diagram](../attachments/464xlat.png) + +- **DNS64**: Mode of operation for a dns resolver that synthesizes *AAAA* resource records for domains that don't have a native one based on a configured NAT64 prefix. ([RFC6147](https://datatracker.ietf.org/doc/html/rfc6147)) + +- **PREF64**: IPv6 Router-Advertisement option that communicates the local NAT64 prefix of a network to clients. ([RFC8781](https://datatracker.ietf.org/doc/html/rfc8781)) + +- **ipv4only.arpa**: Special-use, well-known DNS entry that communicates the local NAT64 prefix of a network to clients. It is an alternative mechanism to PREF64 which is simply older. ([RFC7050](https://datatracker.ietf.org/doc/html/rfc7050)) + +- **DHCPv4 Option 108**: DHCP (IPv4-only) option which tells clients to turn off their IPv4 stack for X seconds ([RFC8925](https://www.rfc-editor.org/info/rfc8925/)) + +### Our Setup + +Our router is, as described above, a debian box with IP forwarding enabled plus some additional daemons. With this structure, we have a NAT64 daemon doing address translation directly on the router, communicate our prefix via PREF64 as well as ipv4only.arpa, and have unbound configured to do dns64. +We also set DHCPv4 Option 108 so that supporting clients completely disable their IPv4 stack and can do CLAT directly on-device. + +!!! info "NAT64 Prefix" + + ``` + 64:ff9b::/96 + ``` + +#### NAT64 Gateway + +Our router has [Jool](https://www.jool.mx/en/documentation.html) installed and configured which does in-kernel address translation between IPv4 and the configured NAT64 prefix. +We use jool only in its NAT64 mode since stateless translation (*SIIT*) is not useful for us. + +#### Router-Advertisement Route + +We send an explicit route via Router-Advertisements to ensure high route precedence on the local net. + +```systemd +# 21-netlan.51-clients.network +[IPv6RoutePrefix] +Route=64:ff9b::/96 +``` + +#### Router-Advertisement PREF64 + +We send the configured NAT64 Prefix via the PREF64 option so that clients know which prefix to use when doing CLAT on-device. + +```systemd +# 21-netlan.51-clients.network +[IPv6PREF64Prefix] +Prefix=64:ff9b::/96 +``` + +#### Unbound Specifics + +We enable the unbound [DNS64 Module](https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html#dns64-module-options) so that domains without a native *AAAA* record get a synthesized one based on our NAT64 prefix and that domains *A* record. + +We also configure validation of the `ipv4only.arpa` special use domain record by supplying PTR (a.k.a. reverse-dns) records for that domains IPv4 and IPv6 addresses. + +#### KEA DHCPv4 Specifics + +We set *DHCPv4 Option 108* in our client network so that supporting clients disable their IPv4 stack. +Kea has special handling for that option too which results in clients requesting option 108 never being only assigned a dummy lease (they don't really need their lease after all) so that Keas lease pool should stay mostly empty. +