Install NixOS on Hetzner Online: Difference between revisions
imported>Mic92 disable predictable interfaces |
imported>Mic92 fixup network configuration |
||
Line 3: | Line 3: | ||
There are three ways at the time to install NixOS on Hetzner | There are three ways at the time to install NixOS on Hetzner | ||
# From Hetzner's rescue image one can boot into the nixos installer using a custom kexec image that is configured with the fixed | # From Hetzner's rescue image one can boot into the nixos installer using a custom kexec image that is configured with the fixed IPv6 provided by Hetzner and also contain your ssh key. Tip: The kexec tarball as generated by nixos-generators can remain put into the /boot partition for future use. | ||
# Hetzner also provides an interface to upload your own ISO-images. Also here you may want to build your own iso-image, which has openssh with ssh keys due the lack of a remote console. | # Hetzner also provides an interface to upload your own ISO-images. Also here you may want to build your own iso-image, which has openssh with ssh keys due the lack of a remote console. | ||
# An easier method to install NixOS on Hetzner, is to use the existing integration into NixOps. | # An easier method to install NixOS on Hetzner, is to use the existing integration into NixOps. | ||
Line 10: | Line 10: | ||
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 | Hetzner does announce ipv6 addresses 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 | ||
the kexec image and the final server. | the kexec installation image and the final server configuration. | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
{ ... }: { | { ... }: { | ||
# this make sure that our interface is named `eth0`, | # this make sure that our interface is named `eth0`, | ||
# this should be ok as long as you don't have multiple physical network cards | # this should be ok as long as you don't have multiple physical network cards | ||
networking.usePredictableInterfaceNames = false; | networking.usePredictableInterfaceNames = false; | ||
systemd.network = { | systemd.network = { | ||
enable = true; | enable = true; | ||
Line 27: | Line 25: | ||
Name = eth0 | Name = eth0 | ||
[Network] | [Network] | ||
# Add your own assigned | # Add your own assigned ipv6 subnet here here! | ||
Address = 2a01:4f9:ffff::1/64 | Address = 2a01:4f9:ffff::1/64 | ||
Gateway = fe80::1 | Gateway = fe80::1 | ||
''; | ''; |
Revision as of 12:58, 14 January 2019
This article is about installing NixOS on Hetzner Online, which provides dedicated bare-metal servers. This is not to be confused by Hetzner cloud, that provides VMs. There are three ways at the time to install NixOS on Hetzner
- From Hetzner's rescue image one can boot into the nixos installer using a custom kexec image that is configured with the fixed IPv6 provided by Hetzner and also contain your ssh key. Tip: The kexec tarball as generated by nixos-generators can remain put into the /boot partition for future use.
- Hetzner also provides an interface to upload your own ISO-images. Also here you may want to build your own iso-image, which has openssh with ssh keys due the lack of a remote console.
- An easier method to install NixOS on Hetzner, is to use the existing integration into NixOps.
Network configuration
From Hetzner's web interface, one can obtain both ipv4/ipv6 addresses and gateways. Hetzner does announce ipv6 addresses 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 the kexec installation image and the final server configuration.
{ ... }: {
# 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;
networks."eth0".extraConfig = ''
[Match]
Name = eth0
[Network]
# Add your own assigned ipv6 subnet here here!
Address = 2a01:4f9:ffff::1/64
Gateway = fe80::1
'';
};
}