With these settings I can plug my RPi into a router and it will configure a web URL to it’s routers IP address.
sudo apt-get install ddclient
# Configuration for ddclient scripts # generated from debconf on Tue Jul 25 19:02:55 ACST 2017 # # /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="900"
# Configuration file for ddclient generated by debconf # # /etc/ddclient.conf #daemon=1500 ssl=yes use=web, protocol=namecheap login=example.com password=PasswordFromNamecheapDNSPanel host, host2
I tested with
sudo ddclient -daemon=0 -debug -verbose -noquiet
Returns this at the bottom (before clearing the cache)
SUCCESS: rpi: skipped: IP address was already set to 'My WAN IP'.
sudo rm /var/cache/ddclient/ddclient.cache before testing will allow me to force an update.
getting this to run as a service I used
sudo update-rc.d ddclient enable
Also I edited my SSH config since apparently my home NAT router didn’t like keeping the connections alive. These settings went at the bottom of sshd_config – initially I used ServerAlive, which stopped SSH from working :/
ClientAliveInterval 300 ClientAliveCountMax 24