Translate »
  • English
Projects, Reviews, Tips, Guides & Updates

Free dynamic DNS for Raspberry Pi

No matter which services your Raspberry Pi is running you will want it to have a static address for global access, which is done by setting up a dynamic DNS service.

In this guide I describe the steps you need to complete in order to set up a free dynamic DNS service on your raspberry Pi, so that you no longer have to worry about whether your external IP address changes once in a while. Whenever it changes, the dynamic DNS makes sure that your chosen website URL will always resolve to the current external IP of your Raspberry Pi.

As I set up my Raspberry Pi Mumble server, I needed to have a static web address for everyone else to access it. It would be very troublesome having to tell everyone about it every time my dynamic IP changed.

After a bit of research I decided to go with the free service provided by dnsdynamic.org, as it is both free to use and easy to set up.

Step by step guide

Here is how to set up the free dynamic DNS service.
It should work just as well with other linux systems than Raspbian on the Raspberry Pi.

  1. Create a user profile at the dnsdynamic website.

  2. Choose to “add a new domain” when logged in on the dnsdynamic website.

  3. Open a terminal on your Raspberry Pi and install the update service:
    sudo apt-get install ddclient

  4. If you are presented with a configuration wizard, just go through it and put in some random text.
    (We will overwrite this in the configuration file anyway)

  5. Edit the configuration file /etc/ddclient.conf and replace everything in it with this:
    #
    # Configuration file for ddclient generated by debconf
    #
    # /etc/ddclient.conf
    daemon=60                          # check every 60 seconds
    syslog=yes                         # log update msgs to syslog
    mail=root                          # mail all msgs to root
    mail-failure=root                  # mail failed update msgs to root
    pid=/var/run/ddclient.pid          # record PID in file.
    ssl=yes                            # use ssl-support.
    use=web, web=myip.dnsdynamic.com   # get ip from server.
    server=www.dnsdynamic.org          # default server
    login=YOUR-LOGIN                   # your login
    password=YOUR-PASSWORD             # your password
    server=www.dnsdynamic.org,         \
    protocol=dyndns2                   \
    YOUR-DOMAIN

  6. Edit the three placeholders YOUR-LOGIN, YOUR-PASSWORD and YOUR-DOMAIN and replace them with your own.

  7. Save the changes made to the config file, and restart the Raspberry Pi.

  8. Remember to configure your router to forward the necessary ports to your Raspberry Pi.
    (port 80 for web server, 21 for ftp, 64738 for default mumble, etc.)

If everything is working as intended, you should see the global IP of your Raspberry Pi automatically set on the dnsdynamic website, under Manage -> Edit domains.

Now you can access your Raspberry Pi services at the domain name you chose with dnsdynamic.org instead of your global IP address. Should your global IP change, the daemon will automatically detect this and make the domain point to the new global IP instead. The users will never know that the IP has changed, since they only see and use the domain name.

If you have another domain you want to use instead of the ones provided by dnsdynamic, simply configure the DNS of your other domain to do a CNAME forward to your dnsdynamic domain.

Checking for IP changes every 60 seconds may be a bit overkill in some cases. You can change the daemon=60 to eg. daemon=300 in ddclient.conf to check for IP changes every 5 minutes instead.

By at .

17 Comments

  1. Michael's Gravatar Michael
    October 30, 2014    

    I’m getting an error when trying to ssh on to the server.

    ddclient[2163]: WARNING: cannot connect to myip.dnsdynamic.com:80 socket: IO::Socket::INET: Bad hostname ‘myip.dnsdynamic.com’

    any ideas why?

    • gopi's Gravatar gopi
      December 18, 2014    

      Try changing it to “myip.dnsdynamic.org”

  2. David's Gravatar David
    June 24, 2014    

    Good stuff Mikkel…very good.

    I´ll test it today on my Raspberry Pi, but it seems to be a good configuration.
    I notice that line “server=www.dnsdynamic.org, \” may be deleted, isn´t it? Because you have specify it before.

    Another question: mail=root sends mail msgs to root but, what messages?

    Thanks a lot

    • June 24, 2014    

      Hi David,

      I can see what you mean with the line appearing twice. I haven’t tried deleting one of them. If you come to a conclusion, please let me know the result.

      I haven’t used the mail functionality, but i believe that you can have ddclient send out an email to given adresses eg. every time a new IP is registered.
      You would probably have to configure e-mail settings in linux directly for the user, or just add an e-mail address to the user profile. I don’t know for sure.

      Glad you find my post useful

  3. Michael's Gravatar Michael
    March 26, 2014    

    Hi,
    Thx for the info on how to setup the ddns which I’ve done it.
    Now the challenge is, it never update to the ddns site every time the IP changed.
    Any solution on this matter?
    Appreciate your reply very much!
    thank you!

    • March 26, 2014    

      You need to get the ddclient installed and running on your Raspi, so that it can verify the current public IP at the time interval you set.
      If the ddclient has internet connection and is correct set up, it will then automatically change the setting in the profile on dnsdynamic.
      Any problem in the configuration of the ddclient will result in failure to update the ddns entry automatically.
      Note that this method only applies to the public IP, not to your local 192.168.x.x
      Hope this helps… =)

  4. November 30, 2013    

    Working fine on rasbian wheezy using: ddclient 3.8.0-11.5
    After following this guide:

    http://raspi.tv/2012/how-to-set-up-keys-and-disable-password-login-for-ssh-on-your-
    raspberry-pi

    it made ssh over LAN easy. Thanks again!

  5. Phil's Gravatar Phil
    November 24, 2013    

    I am getting warnings that the client from dnsdynamic (windDNSdynamic.exe) is malicious. This website seems to confirm it: http://www.coolcomputing.com/article.php?sid=4618

    Can anyone confirm if this true?

    Thanks,
    Phil

    • November 24, 2013    

      Hi Phil,

      I don’t know anything about the windows client.
      I haven’t used it, since you do not need it if you just want to use their dynamic DNS service on a Linux system.

      All Linux user should thus be safe already, but i certainly hope that their windows client does not contain anything malicious.
      Maybe it is flagged because it gathers information of your network connection (which it needs in order to handle the dynamic DNS)?

      If anybody knows, please share with the rest of us =)

  6. Erik's Gravatar Erik
    October 28, 2013    

    Hello,

    Thank you very much for this great explanation … works perfectly.
    One question though. I have my Raspi switched on all the time and of course the Ip address changes quite regularly.
    Where could I find, or how could I do, so as to put the new Ip address to the dnsdynamic website? Looks like it cannot to it by itself and a reboot usually solves the situation … which I do not want to do!

    Thank you for your comments,
    Erik

    • October 28, 2013    

      If set up correctly, the daemon will submit the current IP of your Raspi at a predetermined interval. You define the interval in the config file as described.
      Usually your IP does not change very often, as long as you keep your main router turned on as well…

  7. October 22, 2013    

    Thanks for the tips! I used this guide to set-up my RaspberryPi (http://cladlab.com/programming/microcontrollers/raspberry-pi) with dynamic DNS. This is one of the easiest guides to doing so on the internet!

  8. Emir's Gravatar Emir
    September 26, 2013    

    Great post. Love RPI. I am using https://dns4e.com/ to manage my dynamic IPs. It is very simple to add one curl command to crontab like this one:
    curl ‘https://api.dns4e.com/v7/rpi.dns4e.net/a’ –user ‘PublicKey:SecretKey’ -X POST and it updates the IP without any custom packages isntalled.

  9. July 15, 2013    

    Check out this simple steps for setting up Dynamic DNS for free (using FreeDNS) on your Raspberry Pi or any Unix system (Debian based)
    http://www.techjawab.com/2013/06/setup-dynamic-dns-dyndns-for-free-on.html

  10. June 6, 2013    

    You can also use No-IP for free dynamic DNS.

  11. Marco's Gravatar Marco
    April 16, 2013    

    Hey, I still can’t connect to my pi over the internet. It works fine over the local network (with local ip). Im a complete beginner with this stuff, would I need to forward my ports ? if so how would I do that ?
    Thanks.

    • April 16, 2013    

      Several things could be the issue, but if you haven´t done any port forwarding that is probably it.

      My guess is that your Raspberry Pi is connected to a switch or router alongside your PC, etc.
      Seen from outside your local network ( from the internet) you will have only a single IP address, which is that of your router.
      If you do not configure your router to do so, it won’t know which one of the attached devices it should forward specific incoming traffic to.

      You will thus need to log in to your router or switch and configure it to forward all traffic on each port for which it has a service (eg. port 80 for web server, 21 for FTP, 64738 for default mumble).
      A good place to start is by finding your router on this list and follow the guide: http://portforward.com/english/routers/port_forwarding/routerindex.htm

      Port forwarding can be a pain to set up correctly, but give it a try and see if it works for you.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>