rescueshell Start trial

Dynamic DNS SSH not working: fix it or skip it

A hostname that points at your home or site address worked for months, then ssh times out. The name was never the machine. It was a note of where the machine was, and the note went stale.

Work out which part broke

Dynamic DNS is a chain: a client notices the address changed, tells the DNS provider, the provider publishes it, and your laptop looks it up. Then a port forward on the router has to let the connection in. Check the links in order.

  1. What does the name resolve to? Run dig +short home.example.com from your laptop. No answer means the record is gone: the hostname expired, or the account lapsed.
  2. Is that the address the site has now? On the site, open any "what is my IP" page and compare. A different address means the update never arrived. Usual causes: the update client stopped, it was on a router that was reset or replaced, or it holds a password that changed.
  3. Is it the router's own address? Compare the WAN address on the router's status page with the address from step 2, or let the CGNAT checker do it. If they differ, or the WAN address is between 100.64.0.0 and 100.127.255.255, your provider shares one address between customers and no forward on your router is ever reached. No DNS fix helps; see SSH behind CGNAT.
  4. Does the port answer? From outside the network, run nc -vz home.example.com 22. A refusal or a timeout with a right address points at the forward, the device's firewall, or a router that now has a different internal address for the machine.

Two quieter causes. A record keeps its old answer in caches until its TTL runs out, so right after a change a name can still point at the old address. And a home IPv6 prefix can change too, so an AAAA record needs the same update as an A record.

Options, and what each one asks of you

Repair the dynamic DNS

Run the update client on the device or router that stays on, check that it logs success, and keep the record's TTL short. It is free or cheap, and fine when you own the router, it has a public address, and you are happy to leave the SSH port open to the internet. In that case use keys only (PasswordAuthentication no in sshd_config). It keeps failing the same way when the router belongs to someone else, or the address is shared.

Use IPv6, if both ends have it

A global IPv6 address can be reachable without NAT, if the router's firewall allows the connection in. It works only when the network you connect from has IPv6 too, and the prefix can change, so it still needs a name that follows it.

A reverse SSH tunnel to a server you rent

The device dials out, so its address stops mattering. The hostname you keep is the server's, which does not move. You patch the server and keep the tunnel alive: see why autossh tunnels drop.

A mesh VPN or a hosted relay

Both also have the device dial out, so no hostname points at its network. They differ in what you take on; the comparison goes through it.

RescueShell: no hostname, no forward

An agent on the device keeps one outbound HTTPS connection to the relay. You open a shell from the browser or the CLI by picking the device by name in the list. There is no address to publish, so there is nothing to go stale.

1. Check the device

A shell is a session on the device's own OpenSSH server, so it needs one running, and your key in an account's ~/.ssh/authorized_keys. The installer copies the trusted keys from there. If the device is already reachable by your old hostname, you have this. Check the rest:

uname -m
openssl version
command -v curl

It needs Linux on amd64, arm64, armv7 or armv6, and curl or wget. Any other CPU stops with unsupported CPU. The release signature is checked with OpenSSL 3; without it, pass --sha256. Dropbear is not supported. For a device with no OpenSSH, see install without OpenSSH.

2. Install

In the web app, open Devices, press Add device, name it and press Create pass. Then run this on the device as root, over your old SSH hostname while it still works, or at its console:

curl -fsSL https://releases.rescueshell.com/latest/install.sh | sh -s -- \
  --base-url https://releases.rescueshell.com/latest --relay https://app.rescueshell.com \
  --name pump-07 --trust-keys-from pi

Change pi to the account whose keys you log in with, and pump-07 to a name for the device. The installer lists each key it will trust by fingerprint and asks you to confirm, then asks Registration pass or token:. Paste the pass; nothing shows as you do. It ends with a host key: line. Keep it, because the browser asks for it the first time you open a shell. Our servers cannot add a key to the device's list. See add a device for the other options.

The agent starts at boot under systemd, OpenRC, procd on OpenWrt or an init script, whichever the device uses. Check it with rescueshell-agent --status.

3. Open a shell from another network

When the device shows as connected under Devices, open a shell from the browser, or from your terminal with the CLI. Try it from a different network, such as your phone's hotspot. Only then remove the router forward and the update client, if you want the SSH port closed. Keep the old route until the new one has worked once.

The device needs outbound HTTPS and nothing inbound. When the link drops, the agent retries every 60 seconds, five times, then waits 30 minutes and starts over, so the device comes back by itself, whatever address it got.

What it does not do

If the shell does not open, see the shell does not open.

Try it on one device

The first device is free to try with no card, for 30 days from when it connects, not from when you sign up. Start a trial.