IPv6 DDNS

Spear_UK

New Around Here
I have got DDNS setup and functional using the following code. But I want to know if there is a way to pass the ip6 address to dynu as well.
The sample code seems to have the ability to pass the ipv6 address to dynu.
Is there something that can replace the null value in 'IPsix=null' to send the IPv6 address as well?


Code:
#!/bin/sh
#
# https://www.dynu.com/en-US/DynamicDNS/IP-Update-Protocol
# Note: To get your domain id, send a GET request to /dns/ with your API key in the header.

HOSTNAME=\"######.ddnsfree.com\"
GROUP=\"\"
PASSWORD="################################"
DOMAIN_ID="#######"
IP=\"${1}\"
IPsix=null

URL="https://api.dynu.com/v2/dns/${DOMAIN_ID}"

JSON_TEMPLATE='{"name":%s,"group":%s,"ipv4Address":%s,"ipv6Address":%s}'
JSON=$(printf "$JSON_TEMPLATE" "$HOSTNAME" "$GROUP" "$IP" "$IPsix")

curl -s -o /dev/null -w "%{HTTP_CODE}" --location --request POST "$URL" -H "Content-Type:application/json" -H "accept: application/json" -H "API-KEY: $PASSWORD" -d $JSON

if [ $HTTP_CODE==200 ];then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi
 

AurelM

Occasional Visitor
Hi, instead of the line IPsix=null, try the following:
Code:
IPsix=\"$(nvram get ipv6_wan_addr | awk -F '/' '{print $1}')\"
Some programs want IPv6 addresses encased in sqare brackets, so if the above code doesn't work, try this:
Code:
IPsix=\"[$(nvram get ipv6_wan_addr | awk -F '/' '{print $1}')]\"
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top