Networking: Difference between revisions

imported>Makefu
initial batch of nixos-users
 
imported>Fadenb
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:


<pre class="nix">{ config, pkgs, ... }:
<syntaxhighlight lang="nix">
{ config, pkgs, ... }:


let
let
   # Get this from your hosting provider
   # Get this from your hosting provider
   clientid = &quot;00:11:22:33:44:55:66:77:88:99&quot;;
   clientid = "00:11:22:33:44:55:66:77:88:99";
   interface = &quot;enp2s0&quot;;
   interface = "enp2s0";
   subnet =  &quot;56&quot;;
   subnet =  "56";
   network = &quot;2001:bbb:3333:1111::/${subnet}&quot;;
   network = "2001:bbb:3333:1111::/${subnet}";
   own_ip =  &quot;2001:bbb:3333:1111::1/${subnet}&quot;;
   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 &quot;${clientid}&quot;
     clientid "${clientid}"
     noipv6rs
     noipv6rs
     interface ${interface}
     interface ${interface}
Line 29: Line 30:
     static ip6_address=${own_ip}
     static ip6_address=${own_ip}
   '';
   '';
   environment.etc.&quot;dhcpcd.duid&quot;.text = clientid;
   environment.etc."dhcpcd.duid".text = clientid;


}</pre>
}
</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]