Broken network while installing NixOS via the minimal ISO image on a VPS

Hello. I’m want to install NixOS on a VPS hosting that doesn’t offer NixOS installations out of the box, but they support booting from an ISO image. When I mounted and booted the VPS into the installation ISO, I noticed two networking issues:

  • I couldn’t resolve any hostname;
  • I couldn’t succesfully ping any public IP either.

I looked up the IP addresses assigned to my VPS by the hoster in the admin panel:

IP Address Network Mask Gateway
95.132.101.114 255.255.255.0 95.132.101.1

(^ these are fake addresses)

While running ip address show ens3 and ip routes showed a different address and a gateway were set up for the interface:

# ip address show ens3
     # [...snip...]
     # notice /16 prefix doesn't match the correct network mask
     inet 168.253.182.161/16 brd 168.253.255.255 scope global prefix noprefixroute ens3
     # [...snip...]

# ip routes
default dev ens3 scope link src 168.253.182.161 metric 1001002
# [...snip...]

(^ these are fake addresses)

Also, /etc/resolv.conf had no nameserver entries.

I believe dhcpcd is responsible for setting up the network in the installer, so I disabled it and added the IP address and the default gateway route by hand:

# systemctl stop dhcpcd
# ip address add 95.132.101.114/24 broadcast 95.132.101.255 dev ens3
# ip route add default via 95.132.101.1 dev ens3 proto static metric 100

At this point ping-ing public IPs works, but hostname resolution doesn’t. Adding CloudFlare and Google resolvers to /etc/resolv.conf fixed that:

# echo -e "nameserver 1.1.1.1\nnameserver 8.8.8.8\nnameserver 8.8.4.4" >> /etc/resolv.conf

Then I could proceed with the installation.


The question is why the installer had non-functional networking setup? Is this an installer issue that can be fixed? Or is the hosting company’s infrastructure to blame?

Bonus question: I’m a noob when it comes to networking and while I managed to set it up in the end, is the setup correct/optimal? Is there any way I could handle this issue better? I haven’t found any mentions of related issues in the manual (though it’s probably out of the scope of the manual).

Thanks in advance!

2 Likes

I have just successfully installed NixOS on the VPS, and the same issue with DHCP networking setup exists on the installed system, which I solved by static network configuration as per Networking docs:

{ config, pkgs, ... }:

{
  # [...snip...]
  networking.interfaces.ens3 = {
    useDHCP = false;
    ipv4.addresses = [
      { address = "95.132.100.114"; prefixLength = 24; }
    ];
  };
  networking.defaultGateway = "95.132.100.1";
  networking.nameservers = [
    "1.1.1.1"
    "8.8.8.8"
    "8.8.4.4"
  ];
  # [...snip...]
}
1 Like

I have also just had the same issue with the ISO Minimal on 9/17/2024, I also had to set my IP manually on the provider I am using. IPv4 address gets assigned on other Linux OS’s just fine via DHCP.

Over a year later this issue persists, I am not sure what is broken or even if it is, but it is annoying as a new user and take a good amount more time for me to troubleshoot why everything is not working and that the installer NixOS Manual wasn’t working.

I have spend over 2+ hours stumbling my way about, to figure out how to fix it just so I could continue to install NixOS.

As a new NixOS user not even making it past the install before I ran into a brick wall is not a good first time impression.

Could you share which provider this is? Not to minimize your issue here, but this is the first I’ve heard of this, and there are plenty of NixOS-on-VPS systems set up by noobs and experts alike. This sounds like a very specific thing.

I was using reliablesite.net, this was a bare metal server I was installing onto. I did not link the provider because usually that is discouraged in forums.

Hard to debug unless someone with a server in that provider’s network checks things out for a while. If you have the time and energy, I’m sure a thorough explanation of what is wrong with the default networking config would be appreciated and met with a fix in due time.

Things to check with the broken networking:

  • dhcpcd logs
  • dmesg
  • full contents of journalctl --boot -xe

To be clear, what you’re running into is that dhcp assigns the wrong IP address? Hard to see how that could be anything other than a network level issue, but I suppose there’s more to it if it works on other distros…