This guide explains how to set up remote SSH access to your local server using a Dynamic DNS (DDNS) service such as DuckDNS. It also includes instructions to automatically update your public IP address so you can reliably connect even if it changes.
- DuckDNS (or another DDNS provider) assigns your home server a persistent domain name (for example,
example.duckdns.org). - Cron and curl automatically keep your DuckDNS record updated with your current public IP address.
- Clemson VPN allows secure remote access when off-campus.
- SSH provides a secure connection to the server
-
Go to https://www.duckdns.org
-
Log in using a supported account (GitHub, Google, etc.).
-
Create a new subdomain, for example:
example.duckdns.org -
Copy your token — you will need it for the update script.
Make sure both curl and cron are installed on your server:
sudo apt update
sudo apt install curl cron -y-
Create a new directory for DuckDNS:
mkdir -p ~/duckdns cd ~/duckdns
-
Create the update script:
nano duck.sh
-
Paste the following code (replace with your DuckDNS domain and token):
echo "url=https://www.duckdns.org/update?domains=example&token=YOUR_TOKEN&ip=" | curl -k -o ~/duckdns/duck.log -K -
-
Save and make it executable:
chmod 700 ~/duckdns/duck.sh
Edit your crontab to run the update automatically:
crontab -eAdd these lines at the bottom:
*/5 * * * * ~/duckdns/duck.sh >/dev/null 2>&1
@reboot ~/duckdns/duck.sh >/dev/null 2>&1
This will:
- Run the DuckDNS update every 5 minutes.
- Run it once at boot to immediately refresh your IP.
To verify it’s running:
cat ~/duckdns/duck.logOnce set up, you can SSH into your server using your DuckDNS address:
ssh user@example.duckdns.orgReplace user with your server’s username.
When off-campus, use Clemson’s Cisco VPN (the same one used for iRoar and other Clemson services):
-
Connect to the Clemson VPN using Cisco AnyConnect.
-
After connecting, SSH into your server the same way as before:
ssh user@example.duckdns.org
DuckDNS also provides an official Docker container that handles automatic IP updates. You can find the docker image here: DuckDNS Docker Image