OpenWrt Forum Archive

Topic: DDNS for NameSilo

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.


I'm trying to setup DDNS for NameSilo to update DNS records for my domains and subdomains.  I used "" as a guide to create a little script to make it run at startup, but I seem to stuck on extracting the record_id from the the xml file as there's no xmllint command in OpenWrt's libxml2 package.

So instead of using the xmllint to extract the record_id's (bb74e10cc00faa6b9e99b2cd108e1184 and a1cd001a0d9906f48cce82755e1dbcba) from the xml file, is there any other command I can use to extract the record_id's from the mydomain.xml file into place holders for use in the next operation to update the DNS records with NameSilo?  Thanks in advance for any assistance.

<?xml version="1.0"?>

Google for "Bash XML extract". You will find a lot of ideas that could help you.
i.e. grep -oP "(?<=<record_id>)[^<]+" test.xml
Later on, you need to check if the version of "grep", "sed" or "awk" installed on LEDE/OpenWrt support all options.

here's an old code I wrote, hope it helps

I had to obfuscate all the URLs because of the silly spammers.
I trust you can restore them.


IP=$(ifstatus wan | jsonfilter -e '@["ipv4-address"][0].address')

#update an A record hosted by to point to my public IP


ZONE=$(curl --silent --connect-timeout 3 --insecure "ttps\\\api\dnsListRecords?version=1&type=xml&key=${KEY}&domain=${DOMAIN}")
IP=$(echo "$ZONE" | sed -n -e 's/.*<ip>\([0-9\.]*\)<\/ip>.*/\1/p')
RECID=$(echo "$ZONE" | sed -n -e "s/.*<record_id>\([0-9a-z]*\)<\/record_id><type>A<\/type><host>${REC}.${DOMAIN}<\/host>.*/\1/p")

[ -n "$IP" ] && [ -n "$RECID" ] &&
echo "I:$0: ${REC}.${DOMAIN}    $TTL    IN      A       $IP" >&2 &&
curl --silent --insecure "ttps\\\api\dnsUpdateRecord?version=1&type=xml&key=${KEY}&domain=${DOMAIN}&rrid=${RECID}&rrhost=${REC}&rrvalue=${IP}&rrttl=${TTL}"

The discussion might have continued from here.