What's new

Question regarding inadyn

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

I want to update my IPV4+IPV6 using cloudflare
using this template works, but (of course) it's updating WAN IPV6
I need it to update specific client IPV6 (the one using 192.168.50.3 internal IPV4 ip)
what is the way to do it?
There's nothing specific to asuswrt about inadyn. You would get better support directly from inadyn folks.

FWIW, inadyn still doesn't support dual updates so if you want to update both ipv6 and ipv4 you need to run it twice with two different configs.

For simplicity, I use this script in /jffs/scripts/ddns-start which does the API calls that cloudflare needs under the hood. You have to set the variables used above this, but this is the meat of the script:

Code:
IP=$(ip -4 addr show dev eth0 scope global |awk '/inet / { print $2 }'|cut -d/ -f1)
TYPE=A
curl -X PATCH "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$IP4_RECORDID" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  --data "{\"type\":\"$TYPE\",\"name\":\"$RECORDNAME\",\"content\":\"$IP\",\"ttl\":"$TTL",\"proxied\":false}"
echo

IP=$(ip -6 addr show dev eth0 scope global permanent |awk '/inet6 / { print $2 }'|cut -d/ -f1)
TYPE=AAAA
curl -X PATCH "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$IP6_RECORDID" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  --data "{\"type\":\"$TYPE\",\"name\":\"$RECORDNAME\",\"content\":\"$IP\",\"ttl\":"$TTL",\"proxied\":false}"
echo

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi
 
There's nothing specific to asuswrt about inadyn. You would get better support directly from inadyn folks.

FWIW, inadyn still doesn't support dual updates so if you want to update both ipv6 and ipv4 you need to run it twice with two different configs.

For simplicity, I use this script in /jffs/scripts/ddns-start which does the API calls that cloudflare needs under the hood. You have to set the variables used above this, but this is the meat of the script:

Code:
IP=$(ip -4 addr show dev eth0 scope global |awk '/inet / { print $2 }'|cut -d/ -f1)
TYPE=A
curl -X PATCH "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$IP4_RECORDID" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  --data "{\"type\":\"$TYPE\",\"name\":\"$RECORDNAME\",\"content\":\"$IP\",\"ttl\":"$TTL",\"proxied\":false}"
echo

IP=$(ip -6 addr show dev eth0 scope global permanent |awk '/inet6 / { print $2 }'|cut -d/ -f1)
TYPE=AAAA
curl -X PATCH "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$IP6_RECORDID" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  --data "{\"type\":\"$TYPE\",\"name\":\"$RECORDNAME\",\"content\":\"$IP\",\"ttl\":"$TTL",\"proxied\":false}"
echo

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi
Thats bastically something I was going to look into. With my dynv6, I have mine setup to do ipv6 and ipv4 separately.
 
I override the inadyn.conf with my own in /jffs/inadyn.conf
1653189516892.png


1653189431347.png


1653189595464.png


Obviously you would have to adapt this to your cloudflare setup, but it is doable if they have an update API similar to this. Adjust your setup accordingly
 
Last edited:
Thanks!
What part of the script is "calling" the specific client ipv6?
Does it matter that the client is macvlan client?
 
Mind Blown
 
This is my inadyn.conf for Cloudflare

ddns-start script will be the same as what @SomeWhereOverTheRainBow has mentioned

Code:
allow-ipv6 = true

provider cloudflare.com:1 {
     username = your_cloudflare_hostname
     password = your_cloudflare_api_key
     hostname = your_cloudflare_hostname
     checkip-command = "/bin/nvram get wan_ipaddr"
}

provider cloudflare.com:2 {
     username = your_cloudflare_hostname
     password = your_cloudflare_api_key
     hostname = your_cloudflare_hostname
     checkip-command = "/bin/nvram get ipv6_wan_addr"
}
 

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