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?
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