Ever tried setting up DDNS with IPv6? I recently had to learn that there is a remarkable range of tools and services that do not work with IPv6.
ddclient does not support IPv6, nor does
inadyn.
inadyn-mt claims to support IPv6, but if that is true, it is at least hard to configure.
Also not all DDNS-Services offer IPv6 support with
freedns.afraid.org being one notable exception. This service also allows setting the IPv6 via a URL.
A pragmatic solution to get DDNS working with IPv6 could be running the following Python script periodically using a cronjob:
#!/usr/bin/env
python
'''
update ipv6 record on freedns.afraid.org '''
import
netifaces
import
subprocess
import
sys
iface_name
=
"eth0"
pwd_hash
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr"
try:
addrs
=
netifaces.ifaddresses(iface_name)
ipv6_str
=
addrs[netifaces.AF_INET6][0]['addr']
#check
if link local adress
if
ipv6_str[0:5]
==
"fe80:":
raise
Exception()
except:
sys.exit("could
not determine ipv6 address");
subprocess.call(
[
"wget",
"-q",
"--read-timeout=0.0",
"--waitretry=5",
"--tries=400",
"https://freedns.afraid.org/dynamic/update.php?"+pwd_hash+"&address="+ipv6_str
]
)
The script can also be downloaded
here. It requires the package
netifaces, which can be installed using
pip. Moreover wget needs to be installed. You need to adjust the interface name and the password hash manually.
$> sudo apt-get install python-pip
$> sudo pip install netifaces
I suggest simply copying the script to /opt, making it executable and adding a cronjob for it.
$> sudo crontab -e
add the following line to the crontab
*/30 * * * * /opt/ipv6_update.py
and restart the cron daemon
$> sudo /etc/init.d/cron restart
If you are using a network manager, eg.
wicd or
network-manager, the Python script above can be hooked in there. For wicd the script would have to be copied to
/etc/wicd/scripts/postconnect