Skip to content

Ansible role for updating DuckDNS when a network interface changes its IP address

Notifications You must be signed in to change notification settings

uhlig-it/ansible-role-duckdns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DuckDNS

This is an Ansible role for updating DuckDNS when

  1. a network interface changes its IP address - it hooks into the DHCP client and updates the given DuckDNS record whenever the IP address of the given device changes.
  2. every five minutes, as recommended by DuckDNS.

Configuration

All of the following variables must be present:

duckdns:
  interface:
  domain:
  token:

Get domain and token from duckdns.org. interface is the local device interface of which you'd like to publish its address to DuckDNS, e.g. wlan0 or eth0.

Debugging

  • Show the local IP address with ip -4 a show dev wlan0

  • Force renewal of IP address with sudo dhclient wlan0

  • Check the log file in /var/log/duckdns.log

  • There is a debug script in /etc/dhcp/dhclient-enter-hooks.d/debug which produces output like this:

    Sun Jun 28 11:11:07 CEST 2020: entering /etc/dhcp/dhclient-enter-hooks.d, dumping variables.
    reason='PREINIT'
    interface='wlan0'
    --------------------------
    Sun Jun 28 11:11:07 CEST 2020: entering /etc/dhcp/dhclient-exit-hooks.d, dumping variables.
    reason='PREINIT'
    interface='wlan0'
    --------------------------
    Sun Jun 28 11:11:07 CEST 2020: entering /etc/dhcp/dhclient-enter-hooks.d, dumping variables.
    reason='BOUND'
    interface='wlan0'
    new_ip_address='192.168.8.102'
    new_network_number='192.168.8.0'
    new_subnet_mask='255.255.255.0'
    new_broadcast_address='192.168.8.255'
    new_routers='192.168.8.1'
    new_domain_name_servers='192.168.8.1 192.168.8.1'
    --------------------------
    Sun Jun 28 11:11:07 CEST 2020: entering /etc/dhcp/dhclient-exit-hooks.d, dumping variables.
    reason='BOUND'
    interface='wlan0'
    new_ip_address='192.168.8.102'
    new_network_number='192.168.8.0'
    new_subnet_mask='255.255.255.0'
    new_broadcast_address='192.168.8.255'
    new_routers='192.168.8.1'
    new_domain_name_servers='192.168.8.1 192.168.8.1'
    --------------------------
    

About

Ansible role for updating DuckDNS when a network interface changes its IP address

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages