What's new
  • 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!

GET script DDNS

benganb

Occasional Visitor
Hi, I need to update domain with my dynamic IP. The build in ddns support do not cover my Swedish dns provider loopia.

Is there a way to run a scrip every hour according to this specification?
I have a n66u with fork

https://support.loopia.com/wiki/About_the_DynDNS_support


The following is an example of a permitted GET request to Loopia:

GET /XDynDNSServer/XDynDNS.php?
system=custom&
hostname=myhost.com&
myip=11.22.33.44&
backmx=YES
HTTP/1.0
Host: dns.loopia.se
Authorization: Basic username:password
User-Agent: myclient/1.0 me@null.net
 
Use "wget" through a cron job. See the Wiki for info on user scripts and Cron usage.

However, note that contacting that server every hour might be considered abusive usage by the DDNS provider, and they might end up blocking you.
 
Thanks Merlin!
When I search the wiki, I get many many examples....
https://github.com/RMerl/asuswrt-merlin/search?p=2&q=wget&type=Code&utf8=✓

Can anyone guide me?

Whats the appropriate frequency for update ip? Or is there a way to script update only when the router have a new ip?

In wan-start (depending on the Primary or secondary parm) I save the WAN IP address to my persistent USB drive if init-start was run.

Code:
MY_WANIPADDR=$(nvram get wan0_ipaddr)

MYROUTER=$(nvram get computer_name)

# Save the current WAN I/P address
echo $MY_WANIPADDR >/tmp/mnt/$MYROUTER/IPADDR.txt
then invoke my email script....


and my email script contains logic to retrieve the previous saved WAN IP address and checks to see if it has changed...

Code:
MY_WANIPADDR=$(nvram get wan0_ipaddr)
MYROUTER=$(nvram get computer_name)
MY_WANIPADDRX=$(cat /tmp/mnt/$MYROUTER/IPADDR.txt)


if [ "$MY_WANIPADDR" = "$MY_WANIPADDRX" ]; then
   logger -t "($(basename $0))" $$ WAN IP unchanged
else
   echo "My new "$ISP" IP address is: >"$MY_WANIPADDR"< was >"$MY_WANIPADDRX"<" >>$TEMPFILE
   echo $MY_WANIPADDR >/tmp/mnt/$MYROUTER/IPADDR.txt
   logger -t "($(basename $0))" $$ WAN IP changed!!!
fi

Regards,
 
Last edited:

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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