Update DuckDNS with a selected physical port's current local IP address (before NAT).
Default Public IP may not work correctly if the target machine is behind a NAT gateway.
XXX is a machine behind our NAT gateway. If we leave &ip=
with no address specified, duckdns will retrieve the public IP address from the connection that connects to their server, which is some random address from our network gateway. This address is not allowed for inbound connections, meaning this DDNS config will not work.
Specify the ip
parameter using the following command:
# Get current IP address
IP_INTERFACE = $(cat interface)
IP_ADDRESS = $(ip addr show $IP_INTERFACE | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
On XXX, the DuckDns update routine is settled using the following script:
/home/<service_user>/service/duckdns/
├── makefile
├── makefile.subdir.mak
└── XXX/
├── domain
├── token
├── if_mac_addr
└── interface
For example, check ./.example-domain/*
for detail.
XXX.duckdns.org
00000000-0000-0000-0000-000000000000
* the token is generated by duckdns, and may be varied through different account.
00:00:00:00:00:00
* This is the MAC address that represents the interface. The interface may change its name over time, but the MAC address should always be a constant.
enp2s0
* This file is optional and will only be used if the MAC address is not matched.
Config changed using command crontab -e
.
Here, we update the IP in every 10 minutes.
*/10 * * * * cd /home/<service_user>/service/duckdns/ && make; >/dev/null 2>&1