Install NixOS on Hetzner Online: Difference between revisions

imported>Mic92
cleanup example
imported>Mic92
disable predictable interfaces
Line 9: Line 9:
== Network configuration ==
== Network configuration ==


From Hetzner's [ https://accounts.hetzner.com/login web interface], one can obtain both ipv4/ipv6 addresses and gateways.
From Hetzner's [https://accounts.hetzner.com/login web interface], one can obtain both ipv4/ipv6 addresses and gateways.
Hetzner does not operate dhcp servers, so you need to assign those statically.
Hetzner does not operate dhcp servers, so you need to assign those statically.
In this example we use networkd to configure the interface. The same configuration can be used for both
In this example we use networkd to configure the interface. The same configuration can be used for both
Line 17: Line 17:
{ ... }: {
{ ... }: {
   networking.dhcpcd.enable = false;
   networking.dhcpcd.enable = false;
  # this make sure that our interface is named `eth0`,
  # this should be ok as long as you don't have multiple physical network cards
  networking.usePredictableInterfaceNames = false;
   systemd.network.enable = true;
   systemd.network.enable = true;
   systemd.network = {
   systemd.network = {
      enable = true;
    enable = true;
      networks."eth0".extraConfig = ''
    networks."eth0".extraConfig = ''
        [Match]
      [Match]
        Name = eth0
      Name = eth0
        [Network]
      [Network]
        # Add your own assigned Ips/gateways here!
      # Add your own assigned Ips/gateways here!
        Address = 95.216.111.111/26
      Address = 95.216.111.111/26
        Gateway = 95.216.111.1
      Gateway = 95.216.111.1
        Address = 2a01:4f9:ffff::1/64
      Address = 2a01:4f9:ffff::1/64
        # this should be always fe80::1
      # this should be always fe80::1
        Gateway = fe80::1
      Gateway = fe80::1
      '';
    '';
   };
   };
}
}
</syntaxHighlight>
</syntaxHighlight>