# ddclient

# Setting it up on ubuntu with Namecheap

<p class="callout info">This guide assumes that you have an account on Namecheap already with a domain and dynamic DNS enabled.</p>

1. Install ddclient: `sudo apt install ddclient`
2. No need to fill out properly the forms while setting it up, we will change the configuration files anyway
3. It will create two files based on what you chose/entered during setup: `/etc/ddclient.conf` and `/etc/default/ddclient`
4. First let's edit `sudo nano /etc/ddclient.conf` with the following configuration: ```shell
    use=web, web=https://dynamicdns.park-your-domain.com/getip
    protocol=namecheap
    server=dynamicdns.park-your-domain.com
    login=your.domain
    password=your DDNS password
    @ # Updates your domain, you can also use the wildcard character "*" that will update all your domain
    
    ```
5. Now let's edit `sudo nano /etc/default/ddclient`
    1. Set `run_daemon` to `true`
    2. and `daemon_interval` depending on how frequently you want ddclient to check and update your IP ```shell
        # Configuration for ddclient scripts
        # generated from debconf on Thu Jun  9 20:42:11 CEST 2022
        #
        # /etc/default/ddclient
        
        # Set to "true" if ddclient should be run every time DHCP client ('dhclient'
        # from package isc-dhcp-client) updates the systems IP address.
        run_dhclient="false"
        
        # Set to "true" if ddclient should be run every time a new ppp connection is
        # established. This might be useful, if you are using dial-on-demand.
        run_ipup="false"
        
        # Set to "true" if ddclient should run in daemon mode
        # If this is changed to true, run_ipup and run_dhclient must be set to false.
        run_daemon="true"
        
        # Set the time interval between the updates of the dynamic DNS name in seconds.
        # This option only takes effect if the ddclient runs in daemon mode.
        daemon_interval="60"
        
        ```
6. Test your configuration: `sudo ddclient`  
    
    1. You should see something like: `SUCCESS:  updating @: good: IP address set to X.X.X.X`
7. Restart ddclient and check its status to see if everything is properly: 
    1. `sudo service ddclient restart`
    2. `sudo service ddclient status`
8. If you get a warning/error about the cache, simply delete the file and restart ddclient 
    1. `sudo rm /var/cache/ddclient/ddclient.cache`
    2. `sudo service ddclient restart`

Source:

- [https://serdima.wordpress.com/2018/04/23/tutorial-updating-dynamic-dns-with-ddclient/](https://serdima.wordpress.com/2018/04/23/tutorial-updating-dynamic-dns-with-ddclient/)