Run a DynDNS client under Raspbian

For a home automation project I have to setup a local DynDNS client on my Banana Pi running with Raspian. Here are the steps I’ve taken to run a DynDNS client under Raspbian (will work on other Debian based Linux distributions too):

  1. Install ddclient package:
    $>sudo apt-get install ddclient
    

    This command installs the package and starts the DynDNS configuration wizard.

  2. Select a DynDNS service provider.Run a DynDNS client under Raspbian - Service providerIn my case I had to select “other” because I wanted to use the DynDNS service of my webspace provider all-inkl.com.
  3. Enter DynDNS server that should regularly get the IP:Run a DynDNS client under Raspbian - DynDNS Server
  4. Select which DynDNS protocol should be used:Run a DynDNS client under Raspbian - DynDNS Protocol
  5. Configure username (provided by your DynDNS service provider):
    Run a DynDNS client under Raspbian - Username
  6. Configure password (provided by your DynDNS service provider):
    Run a DynDNS client under Raspbian - Password
  7. Select the interface to determine the IP address (eth0 in my case):
    Run a DynDNS client under Raspbian - Interface
    I had to change this setting afterwards because I’am behind a router. That’s why the local IP of my Pi was delivered to all-inkl’s DynDNS server. (see steps 12 +)
  8. Enter FQDNs (fully qualified domain names) under which your client should be accessible:
    Run a DynDNS client under Raspbian - FQDN
  9. Disable PPP (see https://en.wikipedia.org/wiki/Point-to-Point_Protocol):
    Run a DynDNS client under Raspbian - PPP Connection
  10. Enable ddclient daemon (launch ddclient on every startup):
    Run a DynDNS client under Raspbian - Daemon mode
  11. Set update delay (time between IP delivery in seconds):
    Delay
  12. Run a test:
    $> sudo ddclient -daemon=0 -debug -verbose -noquiet 2 /etc/ddclient.conf

    This gave me the following result (last line):

    SUCCESS:  homepi.ask-sheldon.com: skipped: IP address was already set to 192.168.177.6.

    As you can see the client sent the local IP address to my DynDNS service instead of my public IP I got from my ISP. The reason is, that my Pi isn’t connected directly to the internet but to a router that gets the IP.
    Thats why we have to tell ddclient to use an external service like http://checkip.dyndns.org/ to determine the public IP.
    Therefore you just have to continue this guide 😀

  13. Open the ddclient configuration file/etc/ddclient.conf:
    $> sudo nano /etc/ddclient.conf

    It should look like this:

    # Configuration file for ddclient generated by debconf
    #
    # /etc/ddclient.conf
    
    protocol=dyndns2
    use=if, if=eth0
    server=dyndns.kasserver.com/
    login=sheldon
    password="NICEANDVERYSECRETPW"
    homepi.ask-sheldon.com
    
  14. Change use=if, if=eth0 to use=web, web=checkip.dyndns.org/
  15. Run the test again:
    $> sudo ddclient -daemon=0 -debug -verbose -noquiet 2 /etc/ddclient.conf

    This time the result should look different (ddclient got the public IP instead of the local one):

    SUCCESS: updating homepi.ask-sheldon.com: good: IP address set to 172.22.250.218
    
  16. Reboot system (optional but recommended to test daemon startup):
    $> sudo reboot

If you have misconfigured the ddclient, you get another try with:

$> sudo dpkg-reconfigure ddclient

Or you just can change the configuration file /etc/ddclient.conf.

 

2 thoughts on “Run a DynDNS client under Raspbian

  1. Warning: As of ddclient 3.8.2 the configuration is sensitive to single quotes and would treat those in password=’NICEANDVERYSECRETPW’ as part of the password.

Leave a Reply

Your email address will not be published.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.