I have a VPS that I’ve been running NixOS on for a while. Recently, the VPS provider changed servers, causing my VPS to get in a state that doesn’t work. I’m told by my VPS provider that I need to change the network gateway address. That this output:
$ ip r
default dev ens3 scope link src <WRONG-ADDRESS> metric 202
Is wrong and that I need to change the wrong address to the correct one (which I have been provided). How can I fix this? I’m currently connected to my NixOS VPS using VNC through the VPS providers website.
Thanks again for responding. I’ve tried a bunch of different versions of ip r add default via __ types of commands, but no luck so far. If anyone has tutorials to suggest I’d welcome that.
I figured this out eventually. I saw this in the logs, using journalctl:
Mar 23 11:41:06 myhostname dhcpcd[1142]: ens3: failed to renew DHCP, rebinding
Mar 23 11:41:06 myhostname dhcpcd[1142]: ens3: router <gateway-ip> requires a host route
I tried to do
systemctl restart dhcpcd.service
systemctl status dhcpcd.service
That told me:
Mar 23 12:27:58 myhostname dhcpcd[2998]: ens3: leased <my-ip> for 14400 seconds
Mar 23 12:27:58 myhostname dhcpcd[2998]: ens3: router <gateway-ip> requires a host route
14400 seconds is 4 hours, and after each restart of my VPS it was indeed available for about 4 hours. After my hosting provider changed some dhcp settings, and I upgraded nixos, the dhcp lease increased significantly - solving the problem