A simple setup for your own free Dynamic DNS domain, ideal for (but not limited to) setups hosted at home.
This will allow you to access your server remotely through a domain, rather than having to remember the dynamically changing IP
Registering at Duck DNS
You need a (free) account with Duck DNS in order to be able to use their service.
After logging in, please create your Duck DNS domain. There is a limit of 5 domains per account.
You can start the installation by running the following command. This will register the IP of your machine to your domain at Duck DNS, and schedule automatic updates in order to detect changes in your IP in the future.
sudo box install duckdns
During the installation you will be asked for your Duck DNS domain, and your Duck DNS token. You can find both of these on your profile page after logging in.
Your full domain is the "
domain" in the image below, plus "
.duckdns.org". Therefore, in the example below, the full domain would mean
Assuming you are using a home setup, we suggest you to set up static IPs on both your machine and your router, and then setting up the port forwarding. A great resource for this is https://portforward.com.
Depending on your installed applications, you might need to forward different ports.
If you intend to use any applications facilitated by nginx (You probably do...), we highly suggest you to install letsencrypt through box. This will give you a valid SSL certificate as well as set your nginx configuration to use the new domain name.
You can specify environment variables to skip the questions during the installation for automation.
The following variables are exposed:
- Do NOT include the
duckdns.orgif you are using the environment variable
As an example, executing
export duck_subdomain="my-house" will set the value of the variable for use in the script.
You can then run the installation command, and the values will be ingested.
Note: If you are using
sudo ..., please use
sudo -E ... for these variables to be considered in the installation.
Removing Duck DNS
You can get rid of all the files as well as the automatic refresh behavior by running the command below.
Please note: This will also make a call to Duck DNS to un-set the IP from your domain.
sudo box remove duckdns
Changing domain and token after installation
Please remove duckdns with box and install it again. This will double-check that everything is correct for you.
sudo box remove duckdns && sudo box install duckdns
However, we won't stop you from editing the full script in
/opt/duckdns/duck.sh and changing the values there, just make sure to get a new letsencrypt cert if you had one before.