How to Set Up Duck DNS on the Raspberry Pi?

Hackbs

How to Set Up Duck DNS on the Raspberry Pi?

Key Takeaways

  • Duck DNS provides free custom subdomains with dynamic IP updates
  • Registration only takes a minute at duckdns.org
  • Install and configure the duckdns client on Pi with a few commands
  • Automatic updates keep subdomain pointed at current IP
  • Allows remote access to Pi via SSH, HTTP, etc from anywhere

Setting up Duck DNS on a Raspberry Pi allows you to access your Pi from anywhere with an easy-to-remember domain name. Duck DNS provides free dynamic DNS hosting service that points a chosen subdomain to the changing IP address of your home network.

With just a few commands, you can set up Duck DNS to update your Raspberry Pi’s IP address in real time, ensuring you can remotely access it even when your home IP changes. This guide will walk through the full process step-by-step.

Why Set Up Duck DNS on a Raspberry Pi?

Here are some of the key benefits of using Duck DNS for your Raspberry Pi:

  • Access your Pi from anywhere using a memorable domain name instead of a changing IP address.
  • Duck DNS automatically updates your domain with your home IP address changes.
  • Completely free service with unlimited subdomains on the duckdns.org domain.
  • Simple setup with just a few commands – no API key or special software required.
  • Secure access to your headless Pi from outside your home network.

Prerequisites Before Setting Up Duck DNS

Before moving forward with the Duck DNS installation, double check these requirements:

  • A Raspberry Pi connected to your home network with Raspbian OS installed.
  • Your Raspberry Pi configured with a static IP address (or DHCP reservation).
  • Port forwarding configured on your router for the Pi’s IP (for external access).
  • curl installed on your Pi (sudo apt install curl).

Once those are ready, you can proceed with setting up your Duck DNS subdomain!

Here’s How to Set Up Duck DNS on the Raspberry Pi?

Step 1 – Register for a Duck DNS Subdomain

First, you’ll need to head over to www.duckdns.org and register for a free subdomain. Here’s how:

  1. Navigate to Duck DNS and click “Login/Sign Up” in the upper right.
  2. Click the Sign Up tab and enter your email address and choose a password.
  3. You’ll receive a verification email – click the link inside to activate your account.
  4. Log into your new Duck DNS account.
  5. Under Domains, enter your chosen subdomain name (e.g. mypi) and click “Add Domain”.

Your unique subdomain is now ready to use (e.g. mypi.duckdns.org)!

Step 2 – Copy Your Duck DNS Token

With your subdomain registered, you now need to grab your unique token from the Duck DNS site:

  1. Click your profile picture > Settings
  2. Scroll down and copy the alphanumeric Token string.

Save this token somewhere handy as you’ll need it soon. Let’s move onto the Pi configuration next.

Step 3 – Install and Configure duckdns on the Raspberry Pi

With your token copied, ssh into your Pi and run the following commands:

$ sudo apt update

$ sudo apt install duckdns -y

This installs the official Duck DNS client. Next, configure it with:

$ sudo duckdns set domain mypi.duckdns.org token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Be sure to replace the domain with your registered subdomain, and paste your token into the command.

Step 4 – Test and Enable Auto Updates

The Duck DNS client should now be fully configured on your Pi. Let’s test it:

$ sudo duckdns update

OK

If you get an OK message, it worked! Your Duck DNS subdomain now points to your Pi.

To enable automatic updates every 5 minutes (to catch any IP changes), run:

$ sudo duckdns set update 1 300

OK

Now you can access your Pi at http://mypi.duckdns.org from your browser or with SSH. The IP will stay up to date automatically.

Conclusion

Setting up Duck DNS provides an easy way to access your headless Raspberry Pi from anywhere, even if your home IP changes. With just a few quick commands, your Pi gets a memorable subdomain that resolves to the current IP without any effort.

Some ideas for uses with Duck DNS on a Raspberry Pi:

  • Host a web server for remote access
  • Provide SSH access for command line management
  • Run Python scripts or host game servers
  • Access from different locations or on the go

So try out Duck DNS today for free dynamic DNS hosting for your Pi!

FAQs

Does Duck DNS work with all routers and ISPs?

Yes, Duck DNS is compatible with all major consumer routers and internet providers. As long as your router allows port forwarding, it will work.

What if my IP address does not update on Duck DNS?

First, confirm the duckdns client is running on your Pi with sudo duckdns status. If it returns an error, try restarting with sudo /etc/init.d/duckdns restart. Also check that your router firmware is up-to-date.

Is there a limit on the number of Duck DNS domains I can have?

No, you can create up to 5 subdomains for free on your Duck DNS account. Delete unused ones to add additional domains.

Can I access my Duck Domain website from a mobile device?

Yes, Duck DNS domains function just like any normal website and can be accessed on a mobile device connected to WiFi or mobile data.

Do I need to have my Pi connected to the internet all the time?

Yes, to keep your Duck DNS subdomain updated with your latest IP address, your Raspberry Pi needs to have a continuous internet connection.

How long does it take for IP changes to update on Duck DNS?

If auto updates are enabled, the duckdns client will detect IP changes within 5 minutes and make the update automatically.

Can I use Duck DNS even if my ISP frequently changes my IP address?

Yes, Duck DNS was designed exactly for situations where your home IP address changes frequently! As long as the auto updater is enabled, your domain will track any IP changes.

What happens if two people register the same subdomain?

Subdomains are assigned on a first-come, first-served basis. If someone takes your desired domain before you get to it, simply choose another one.

Is Duck DNS safe and secure to use?

Yes, Duck DNS implements good security practices and has a trusted reputation. Of course, use common sense with opening ports or services to the public internet.

Why do I get an “Update refused” error when updating my Duck DNS entry?

This usually occurs if your system time is out of sync. Double check your Pi is set to the correct date/time and restart the duckdns service.

What are some cool things I can do by accessing my Pi remotely via Duck DNS?

Some ideas are hosting your own cloud server, building a Pi security camera you can check anywhere, automating your home IoT devices, remotely accessing stored files/media, and more!

What Pi specific Duck DNS guides and tutorials are available?

The main Duck DNS site has an excellent Raspberry Pi tutorial page here. The Raspberry Pi foundation also has a great in-depth guide here.

Why do I get “Skipped Update” messages rather than “OK” updates?

Skipped updates mean that Duck DNS detected your IP has not changed, so no update was necessary. This is normal behavior and nothing to worry about.

Can I use another DynDNS service instead of Duck DNS on my Pi?

Yes, alternatives like No-IP could be used, but Duck DNS is simple with no registration fees. See a feature comparison here.

How many domains can I access through Duck DNS for free?

You are limited to 5 domains on a single free Duck DNS account. Paid subscriptions allow up to 300 domains with some additional features.

Is there a commercial version of Duck DNS I can upgrade to?

Yes, Duck DNS offers a Premium plan starting at $3.99/year. It includes extra domains, wildcard SSL support, custom CNAMEs, API access, and more benefits.

Can I set up sub-subdomains with Duck DNS (like pi.my.duckdns.org)?

Unfortunately Duck DNS does not support nested subdomains – only a single level subdomain is allowed before the duckdns.org (like mypi.duckdns.org).

How long do inactive Duck DNS domains remain registered?

Inactive Duck DNS subdomains are automatically deleted after approximately 90 days with no updates made from your client software or token.

Can I configure multiple devices like Pi’s and PC’s to update the same Duck DNS domain?

Yes, you can reuse the same Duck DNS subdomain across multiple clients and devices by using the same token during setup on each system.

How can I get help if I have problems getting Duck DNS working on my Pi?

First check Duck DNS’s own FAQ page for common issues. For personalized help, join the Duck DNS Discord server and post in the #help channel.

 

Leave a Comment