Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If an Ubuntu VPS stopped accepting SSH after an IP change, use the hosting provider’s out-of-band console or rescue environment to inspect and repair its guest network. Confirm the assigned address, prefix, gateway, and routing method with the provider before changing routes. A /32 assignment may need an explicitly on-link gateway route, but that depends on the provider’s topology; it is not a universal fix.

How do I access a VPS when SSH is down?

Use the access path that does not depend on the guest’s normal network connection: the provider’s VNC, serial, or web console, or its rescue environment. The provider determines which options exist and how to open them, so follow its own console instructions rather than assuming a particular menu or VNC setup. Keep the console session open while testing changes; it is your fallback if the guest loses network access again.

A rescue environment may run separately from the installed Ubuntu system. If you use one, confirm whether you are changing the installed system’s configuration or the rescue system’s temporary network. Provider-specific rescue behavior is not established here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I recover my Ubuntu VPS after changing its IP?

Inspect the live interface and routes

From the console, inspect the current network state and the persistent configuration:

ip address
ip route show
ls /etc/netplan/

Identify the actual interface name, assigned addresses, and routes. Do not assume it is eth0; names such as enp3s0 are also used. Read the relevant YAML files in /etc/netplan/ and note which renderer they specify, if any.

Confirm the provider’s network assignment

Before editing routes, verify the exact IPv4 address, prefix length, gateway, and expected routing method in the provider panel or its documentation. The server’s current state may be stale or incomplete after an IP change. Neither Ubuntu’s generic examples nor a command copied from another VPS establishes the values for this one.

Ubuntu uses Netplan as its high-level network configuration layer. Netplan can use systemd-networkd or NetworkManager as a renderer; editing Netplan YAML is different from editing a generated networkd file. Ubuntu’s network configuration guide shows how to inspect and configure networking, including temporary changes with ip and persistent settings in /etc/netplan/.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does my /32 IP have no route to the gateway?

An IPv4 /32 identifies one address rather than a conventional subnet containing a range of neighboring addresses. Depending on the provider’s design, the gateway may therefore not appear directly reachable to the kernel under the ordinary subnet assumptions. The provider may require an on-link default route, an explicit host route to the gateway, point-to-point routing, or another arrangement.

Netplan’s on-link: true route setting indicates that the route is directly connected to the interface, as described in the Ubuntu Netplan manual. In the networkd backend, GatewayOnLink=true allows a gateway route to be inserted without the kernel’s usual direct-reachability check, according to the systemd.network manual. These options affect route installation; they do not correct an incorrect address, gateway, or provider-side assignment.

Do not add an on-link route merely because the interface has a /32. Use it only when the provider’s instructions specify a gateway arrangement that requires it, and use the provider-confirmed gateway and interface.

How do I test a temporary network repair?

Ubuntu documents using ip commands for immediate network changes. Such changes are temporary and do not replace the persistent Netplan configuration. The following are command shapes, not values to copy as-is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo ip link set <interface> up
sudo ip address add <address>/<prefix> dev <interface>
sudo ip route add default via <gateway> dev <interface>

Replace each placeholder with values confirmed for this VPS. If the provider requires a gateway route that bypasses the normal reachability check, follow its documented method for adding that route; do not assume the ordinary default-route command is sufficient. If the address or default route is already present, inspect the existing state before adding another.

Then check the active address and routing table:

ip address
ip route show

Test IP connectivity before investigating DNS. If the temporary repair restores access, keep the console open and correct the persistent configuration before relying on the connection.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do I set an on-link default route with Netplan?

Put persistent settings in the Netplan YAML configuration for the installed system, using the syntax supported by its Ubuntu release and installed Netplan version. A modern route definition may express a default destination and an on-link flag alongside the provider-confirmed gateway. The relevant Netplan reference documents the on-link property.

Do not paste a generic YAML example with invented addresses or interface names. Include the actual address and prefix, interface, gateway, and any required nameservers. Ubuntu’s networking guide includes a generic static configuration example, but its sample network values are examples, not assignments for this VPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Syntax varies by release: Ubuntu’s documentation notes that Bionic 18.04 does not support to: default in the route block and uses the older gateway4 key instead. Check the syntax supported by the system you are repairing rather than assuming all Ubuntu releases accept the same YAML.

Apply the persistent configuration and verify it

  1. Save the corrected Netplan file. Make sure it reflects the confirmed provider assignment and the renderer actually used by the host.
  2. Apply the configuration. Run sudo netplan apply from the installed system, not an unrelated rescue environment.
  3. Inspect the active state. Use sudo netplan status, ip address, and ip route show to verify that the expected address and routes are installed.
  4. Test from outside. If practical, establish a fresh SSH connection from another machine while leaving the console session open.
  5. Reboot only after verification. Temporary ip changes disappear after reboot; confirm that the persistent configuration works before relying on a restart.

What if IP connectivity works but hostnames do not?

Check name resolution only after confirming that the interface has the intended address and IP routing works. Ubuntu documents temporary DNS configuration with resolvectl; configure nameservers in the persistent network configuration as appropriate for the host. The same Ubuntu guide notes that flushing IP settings does not clear systemd-resolved state, so a DNS issue may not be fixed by changing interface routes alone.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.