Unless you have a static IPv4 address with your ISP, it is likely that your WAN IPv4 address will change at some point. If you want to be able to access your home network from outside your home, setting up a Dynamic DNS Client so a fully-qualified domain name (FQDN) can be used, and you don't need to remember or even know your public IPv4 address.
First you need a domain name with which this is set up. I use NameCheap as my domain registrar, and they have Dynamic DNS (DDNS for short) as part of their domain console. I'll use the domain example.org, which is a domain that someone reserved a while ago, but I will use as my example domain.
You will next need a DDNS provider. NameCheap offers DDNS for any of their registered domains for free, so I use them as my DDNS provider. DynDNS is another DDNS provider I've used in the past, but if I remember correctly they charge for non dyndns.org domains.
Finally, you will need a DDNS client, that will authenticate with your DDNS service, and update your domain's IPv4 address(es) with your public IPv4 address when it changes. I use the venerable ddclient. There are other clients you can use, including ddnsc and inadyn-fork (both of these are in the Arch User Repository/AUR).
The configuration for the DDNS client will vary depending on which service you use for DDNS, and the DDNS client itself. You will also need to set up your domain to use the DDNS service name servers, so the DNS system at large knows the authoritative name servers for your domain. Follow the instructions for your DDNS provider, on how to configure your DDNS account accordingly.
ddclient has a number of services it integrates with, if you run the following command, many examples for various services will be printed to standard output (or standard error):
# ddclient --help
Note, in the default Arch package installation, no manual page is provided, so this
--help option is the only way to see the examples. If you do not use NameCheap as your DDNS provider, you'll need to adapt this configuration for the provider you do use. This configuration
# vim /etc/ddclient/ddclient.conf use=web, web=dynamicdns.park-your-domain.com/getip protocol=namecheap server=dynamicdns.park-your-domain.com login=example.org password=supersecretPassword123# @
Note, your configuration could be vastly different than this, much of it depends on your DDNS provider. If you choose a DDNS provider that ddclient integrates with, pay special attention to the example in
--help. If your DDNS provider is not listed in
ddclient --help, consider using an alternative client.
Don't forget to enable and start
ddclient.service! Note that when your IPv4 address changes, it can take some time for that change to propagate through the wide Internet. This is usually governed by the Time To Live (TTL) parameter of the name server. Your DDNS provider could grant you the ability to set the TTL for any DNS records you set up with them (my registrar NameCheap allows this). If you configure your WAN interface to request the same IP address (as mentioned in Part II of this series), the TTL parameter will likely be less necessary to set. However, setting up DDNS could be helpful in the case where the ISP sends a DHCP NAK--or negative acknowledgement--and gives you a new IP address anyway. It is your ISP's purview to give out IP addresses as they see fit. The only other alternative is to request a static IP address from the ISP. Typically they charge extra for that, if they have a policy that allows it at all for residential accounts. Most times they'll recommend a business account instead.
This is the last article in my series on my Arch Linux-based Home Router. I hope you've enjoyed it! Leave a comment below letting me know what you think! Much of it was stream of consciousness, I tried not to be like an Arch wiki article.
- Arch Linux-based Home Router, Part I
- Arch Linux-based Home Router, Part II (systemd-networkd and sysctl/kernel) (This article)
- Arch Linux-based Home Router, Part III (firewalld configuration)
- Arch Linux-based Home Router, Part IV (dhcpd configuration)
- Arch Linux-based Home Router, Part V (bind)
- Arch Linux-based Home Router, Part VI (DDNS) (This article)