Incredibly Slow Connection Times for SSH Connections - UPDATE: Unable to connect to IPv6 addresses

I’ve just installed a NixOS server on a Linode, and I’m finding that everything I try to use some kind of SSH connection alongside a domain name takes many minutes before the connection succeeds. For instance:

  • ssh connection to another server (IP address works fine to the same server)
  • pulling git repositories from github

I’ve tried the various tests from Dns resolving very slow and I don’t think it has anything to do with DNS resolution as that all happens quickly, and using wget on a file to download from github works fast.

This slowness appears to also affect hosting a page with nginx, as a web browser times out trying to access the site.

As far as I can tell, these are the appropriate parts of my configuration.nix

# Taken from Linode https://www.linode.com/docs/guides/install-nixos-on-linode/#disable-predictable-interface-names
networking.usePredictableInterfaceNames = false;
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;

# Services
services.openssh.enable = true;
services.fail2ban.enable = true;
services.locate.enable = true;

# State Version
system.stateVersion = "23.05";

Does anyone have any thoughts on how to debug this? Any help is extremely appreciated!

It appears this also affects ping responses.

I’ve uploaded an asciinema showing what happens: NixOS - Ping Response - asciinema.org

Note that I ctrl-c out at the end, as I had to leave my machine for a few hours and didn’t want to end up with that long of a recording!

Looks like IPv6; the ping you left running was attempting to use v6 and getting nowhere.

Aha! You’ve got it!

It seems that IPv6 isn’t working. I’ve just tested it on connecting to another server of mine (v4 vs v6) and v6 doesn’t work.

The question now is… why?. My other server hosted by Linode works perfectly fine with IPv6 (on Arch), and just to be sure I added networking.enableIPv6 = true; to my configuration. ip address in the terminal matches the IPv6 address with what’s on record via Linode.

As a side note (maybe related or not), it seems that I needed to reconfigure the firewall to add in the 80 port on TCP to get nginx working - seems it was a separate issue (maybe).

1 Like

Ok… further tests.

I can connect to it with IPv6 address and get a ping, I just cannot connect outwards to anything. Using mtr does not even get to the first hop.

Did you get anywhere with this? I’m having the same issue with my desktop

I’m afraid not. In the end I just completely disabled IPv6 and I haven’t tested it out again more recently.

Not exactly a solution, but at least it works for the time being.

Linode is pretty particular about how you configure things. You may want to set up static networking. Here’s my config with systemd-networkd, check the Linode docs on what your DNS servers, address, gateway and whatnot should be:

See also their general docs: Manual Network Configuration on a Compute Instance | Linode Docs

1 Like

That’s what I ended up doing. (Of course, this is my desktop, not a linode server.) I had to learn up a bit about networking and DHCP before I could figure out the quirk in my ethernet router. But the solution to my particular problem was that I had to provide alternate gateways, and now everything works.

2 Likes