Install NixOS on Hetzner Online: Difference between revisions

Hexa (talk | contribs)
Klinger (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 12: Line 12:
== Network configuration ==
== Network configuration ==


Hetzner Cloud offers both IPv4 (usually in a shared /26 or /27 subnet) and IPv6 (/64 subnet) connectivity to each machine. The assigned addresses can be looked up on the [https://robot.hetzner.com/server Hetzner Robot]  on the IPs tab of a machine. The public IPv4 address of the server can automatically be obtained via DHCP. For IPv6 you have to statically configure both address and gateway.
Hetzner Online offers both IPv4 (usually in a shared /26 or /27 subnet) and IPv6 (/64 subnet) connectivity to each machine. The assigned addresses can be looked up on the [https://robot.hetzner.com/server Hetzner Robot]  on the IPs tab of a machine. The public IPv4 address of the server can automatically be obtained via DHCP. For IPv6 you have to statically configure both address and gateway.


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 18: Line 18:
   systemd.network = {
   systemd.network = {
     enable = true;
     enable = true;
     networks."30-wan" = {
     networks.default = {
       matchConfig.Name = "enp1s0"; # The predictable name of the network interface
       name = "enp1s0"; # The name of the interface
       networkConfig.DHCP = "ipv4";
       DHCP = "ipv4";
       addresses = [
       addresses = [  
         # Replace the subnet with the one assigned to your machine
         {
        "2a01:4f8:AAAA:BBBB::1/64"
          # Replace the address with the one assigned to your machine
      ];
          Address = "2a01:4f8:AAAA:BBBB::1/64";  
      gateway = [
         }
         "fe80::1"
       ];
       ];
      gateway = [ "fe80::1" ];
       linkConfig.RequiredForOnline = "routable";
       linkConfig.RequiredForOnline = "routable";
     };
     };
Line 40: Line 40:
     enable = true;
     enable = true;
     networks."30-wan" = {
     networks."30-wan" = {
       matchConfig.Name = "enp1s0"; # The predictable name of the network interface
       name = "enp1s0"; # The predictable name of the network interface
       networkConfig.DHCP = "no";
       DHCP = "no";
       addresses = [
       addresses = [
         # Replace the address and subnet with the one assigned to your machine
         # Replace the addresses with the ones assigned to your machine
         "A.B.C.D/26"
         {
         # Replace the subnet with the one assigned to your machine
          Address = "A.B.C.D/26";
         "2a01:4f8:AAAA:BBBB::1/64"
         }
         {
          Address = "2a01:4f8:AAAA:BBBB::1/64";
        }
       ];
       ];
       gateway = [
       gateway = [
Line 156: Line 159:
[[Category:Cookbook]]
[[Category:Cookbook]]
[[Category:Server]]
[[Category:Server]]
[[Category:Deployment]]