1 # Yggdrasil {#module-services-networking-yggdrasil}
3 *Source:* {file}`modules/services/networking/yggdrasil/default.nix`
5 *Upstream documentation:* <https://yggdrasil-network.github.io/>
7 Yggdrasil is an early-stage implementation of a fully end-to-end encrypted,
8 self-arranging IPv6 network.
10 ## Configuration {#module-services-networking-yggdrasil-configuration}
12 ### Simple ephemeral node {#module-services-networking-yggdrasil-configuration-simple}
14 An annotated example of a simple configuration:
17 services.yggdrasil = {
19 persistentKeys = false;
20 # The NixOS module will generate new keys and a new IPv6 address each time
21 # it is started if persistentKeys is not enabled.
25 # Yggdrasil will automatically connect and "peer" with other nodes it
26 # discovers via link-local multicast announcements. Unless this is the
27 # case (it probably isn't) a node needs peers within the existing
28 # network that it can tunnel to.
31 # Public peers can be found at
32 # https://github.com/yggdrasil-network/public-peers
39 ### Persistent node with prefix {#module-services-networking-yggdrasil-configuration-prefix}
41 A node with a fixed address that announces a prefix:
44 address = "210:5217:69c0:9afc:1b95:b9f:8718:c3d2";
45 prefix = "310:5217:69c0:9afc";
46 # taken from the output of "yggdrasilctl getself".
49 services.yggdrasil = {
51 persistentKeys = true; # Maintain a fixed public key and IPv6 address.
53 Peers = [ "tcp://1.2.3.4:1024" "tcp://1.2.3.5:1024" ];
55 # This information is visible to the network.
56 name = config.networking.hostName;
57 location = "The North Pole";
62 boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;
63 # Forward traffic under the prefix.
65 networking.interfaces.${eth0}.ipv6.addresses = [{
66 # Set a 300::/8 address on the local physical device.
67 address = prefix + "::1";
72 # Announce the 300::/8 prefix to eth0.
78 prefix ${prefix}::/64 {
89 ### Yggdrasil attached Container {#module-services-networking-yggdrasil-configuration-container}
91 A NixOS container attached to the Yggdrasil network via a node running on the
95 yggPrefix64 = "310:5217:69c0:9afc";
96 # Again, taken from the output of "yggdrasilctl getself".
99 boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;
100 # Enable IPv6 forwarding.
103 bridges.br0.interfaces = [ ];
104 # A bridge only to containers…
107 # … configured with a prefix address.
109 address = "${yggPrefix64}::1";
117 privateNetwork = true;
119 # Attach the container to the bridge only.
120 config = { config, pkgs, ... }: {
121 networking.interfaces.eth0.ipv6 = {
123 # Configure a prefix address.
124 address = "${yggPrefix64}::2";
128 # Configure the prefix route.
131 via = "${yggPrefix64}::1";
135 services.httpd.enable = true;
136 networking.firewall.allowedTCPPorts = [ 80 ];