Networking: Difference between revisions
imported>Makefu initial batch of nixos-users |
imported>Fadenb m →Prefix delegation with fixed DUID: syntaxhighlight |
||
Line 7: | Line 7: | ||
Sometimes the hosting provider manages ipv6 networks via a so-called ''DUID'' or ''clientid''. This snippet is required to make the network routable: | Sometimes the hosting provider manages ipv6 networks via a so-called ''DUID'' or ''clientid''. This snippet is required to make the network routable: | ||
< | <syntaxhighlight lang="nix"> | ||
{ config, pkgs, ... }: | |||
let | let | ||
# Get this from your hosting provider | # Get this from your hosting provider | ||
clientid = | clientid = "00:11:22:33:44:55:66:77:88:99"; | ||
interface = | interface = "enp2s0"; | ||
subnet = | subnet = "56"; | ||
network = | network = "2001:bbb:3333:1111::/${subnet}"; | ||
own_ip = | own_ip = "2001:bbb:3333:1111::1/${subnet}"; | ||
in { | in { | ||
# ... snip ... | # ... snip ... | ||
Line 23: | Line 24: | ||
networking.dhcpcd.persistent = true; | networking.dhcpcd.persistent = true; | ||
networking.dhcpcd.extraConfig = '' | networking.dhcpcd.extraConfig = '' | ||
clientid | clientid "${clientid}" | ||
noipv6rs | noipv6rs | ||
interface ${interface} | interface ${interface} | ||
Line 29: | Line 30: | ||
static ip6_address=${own_ip} | static ip6_address=${own_ip} | ||
''; | ''; | ||
environment.etc. | environment.etc."dhcpcd.duid".text = clientid; | ||
}</ | } | ||
</syntaxhighlight> | |||
Source: [https://gist.github.com/gleber/9429ea43e6beb114250c3529b5c9d522 gleber gist for online.net IPv6 config in NixOS] | Source: [https://gist.github.com/gleber/9429ea43e6beb114250c3529b5c9d522 gleber gist for online.net IPv6 config in NixOS] |
Revision as of 15:54, 27 August 2017
This site provides snippets for configuring your network just right for the use case you are looking for. All configuration is for configuration.nix
IPv6
Prefix delegation with fixed DUID
Sometimes the hosting provider manages ipv6 networks via a so-called DUID or clientid. This snippet is required to make the network routable:
{ config, pkgs, ... }:
let
# Get this from your hosting provider
clientid = "00:11:22:33:44:55:66:77:88:99";
interface = "enp2s0";
subnet = "56";
network = "2001:bbb:3333:1111::/${subnet}";
own_ip = "2001:bbb:3333:1111::1/${subnet}";
in {
# ... snip ...
networking.enableIPv6 = true;
networking.useDHCP = true;
networking.dhcpcd.persistent = true;
networking.dhcpcd.extraConfig = ''
clientid "${clientid}"
noipv6rs
interface ${interface}
ia_pd 1/${network} ${interface}
static ip6_address=${own_ip}
'';
environment.etc."dhcpcd.duid".text = clientid;
}