6

My ISP recently started providing IPv6. I have a Raspi with PiVPN at home and like to be able to reach my LAN when I am away. I have been using DuckDNS for years now and for IPv4 it worked great. However, because they are on AWS, it seems they are unable to resolve IPv6, so you have to provide it yourself to their update API. This API usually returns OK if everything was fine and KO if there was an issue.

This is the code I am using to update:

token='mytoken'
domain='mydomain'
ipv6=$(ip addr show dev "eth0" | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | grep -v '^fd00' | grep -v '^fe80' | head -1)

echo url="https://www.duckdns.org/update?domains=$domain&token=$token&ip=&ip6v=$ipv6&clear=true&verbose=true" | curl -k -o ~/duckdns/duckdns.log -K -

I compared my "local" ipv6 and one I get from curling another server as described here, but there seems to be no difference so I am pretty sure I correctly get my IPv6.

It returns an OK but then says that I provided an invalid IP when I try to check it on the website.

Any ideas on how to add IPv6 to a duckdns domain?

jaaq
  • 420

2 Answers2

7

So for some reason, the way to publish an IP as recommended by DuckDNS themselves under the install-tab doesn't work. If you change the line doing curl from parsing echo through stdout and setting an url variable to just constructing the string and curling that, it works:

curl -s "https://www.duckdns.org/update?domains=$domain&token=$token&ip=&ipv6=$ipv6addr" -o ~/duckdns/duckdns.log

This version will let DuckDNS figure out your IPv4 and set your IPv6 according to what your device configured itself to as shown in the question. Make sure to run the script regularly as your global IPv6 may change if a NDP finds a conflicting address or if you haven't set a static IPv6.

jaaq
  • 420
0

Run this script periodically using crontab

duck.sh

#!/bin/bash
domain=mydomain
token=aaaabbbb-cccc-4444-8888-ddeeff001122
ipv6addr=$(curl -s https://api6.ipify.org)
ipv4addr=$(curl -s https://api.ipify.org)
echo "https://www.duckdns.org/update?domains=$domain&token=$token&ip=$ipv4addr&ipv6=$ipv6addr"
curl -s "https://www.duckdns.org/update?domains=$domain&token=$token&ip=$ipv4addr&ipv6=$ipv6addr" -o ~/duckdns/duckdns.log
Dojo
  • 169