Remote Server Access & SSH

Ensure persistent, uninterrupted SSH and SFTP terminal access to remote edge nodes, jump hosts, and lab servers without paying for expensive static IP leases.

systemd Timer OpenSSH Config Bastion & Jump Host Fail2ban Hardening

The SSH Challenge on Dynamic IPs

Managing remote Linux servers deployed in home offices, branch sites, or edge environments requires dependable terminal access. However:

  • ISP WAN lease expirations break existing SSH sessions and leave you locked out until you obtain the new IP manually.
  • Hardcoded numerical IP addresses in scripts and ~/.ssh/config files become obsolete without warning.
  • Static IP add-ons from residential or business ISPs often carry steep monthly markups.

By coupling a persistent hostname from XYZ.FRL with an OS-level systemd timer, your server reports its new IP address immediately upon boot and whenever the WAN IP rotates.

Step 1: Set Up Systemd Service & Timer

On modern Linux distributions (Debian, Ubuntu, Arch, Fedora), systemd timers provide superior reliability, structured journal logging, and automatic retry compared to legacy cron jobs.

Create the systemd service file at /etc/systemd/system/xyz-ddns.service:

/etc/systemd/system/xyz-ddns.service
[Unit]
Description=Update Dynamic DNS record on XYZ.FRL
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
User=root
# Replace with your credentials from https://xyz.frl/generate
ExecStart=/usr/bin/curl -fsS --max-time 15 --user 'YOUR_USERNAME:YOUR_PASSWORD' 'https://xyz.frl/nic/update'
Restart=on-failure
RestartSec=30

Now create the timer unit at /etc/systemd/system/xyz-ddns.timer:

/etc/systemd/system/xyz-ddns.timer
[Unit]
Description=Run XYZ.FRL Dynamic DNS update periodically

[Timer]
OnBootSec=1min
OnUnitActiveSec=5min
RandomizedDelaySec=15

[Install]
WantedBy=timers.target

Enable and start the timer:

Terminal
sudo systemctl daemon-reload
sudo systemctl enable --now xyz-ddns.timer
sudo systemctl status xyz-ddns.timer

Step 2: Configure Your Local SSH Client (~/.ssh/config)

Configure your local workstation's ~/.ssh/config to alias your server hostname with keepalive settings:

~/.ssh/config
Host my-edge-server
    HostName <your-uuid>.xyz.frl
    User debian
    Port 2222
    ServerAliveInterval 30
    ServerAliveCountMax 3
    IdentityFile ~/.ssh/id_ed25519

Now you can connect from anywhere simply by typing ssh my-edge-server.

Security Hardening Recommendations

  • Disable Password Authentication: Only permit Ed25519 or RSA-4096 cryptographic SSH keys. Set PasswordAuthentication no in /etc/ssh/sshd_config.
  • Use Non-Standard Port: Change the default SSH port from 22 to a custom port (e.g. 2222 or 49152+) to eliminate 99% of automated port-scanning noise.
  • Install Fail2ban: Protect the SSH daemon from brute-force attempts with automated temporary firewall bans.

Autonomous AI Agent Bastion Management

DevOps agents powered by Claude Code, Cursor, or Antigravity can interact with remote hosts via Model Context Protocol.

By asking the agent to resolve the server's current endpoint via the update_dns or get_caller_ip tool, headless compute clusters can report their health status directly to remote agent runtimes without maintaining centralized VPN controllers.

✓ Copied to clipboard!