Dynamic DNS update script for a DDWRT router - Help with scripting needed

2

I'm running a WRT54GL with DD WRT, and having my domain hosted at zoneedit. For some reason, automatic dynamic DNS clients don't seem to work- they get the ipaddress of what i believe is a proxy server., so i want to throw together a script. In short i need to strip out the ipaddress from the output of ifconfig vlan1 (since vlan1 is the adaptor that's connected to my modem (grep gets me halfway there) and get it into a URL similar to 'wget -O - --http-user=username --http-passwd=password 'http://dynamic.zoneedit.com/auth/dynamic.html?host=mail.myzone.com&dnsto=myipaddress '

where myipaddress is replaced by the ipaddress i get from ifconfig vlan1. Any ideas on what the command should be? DDWRT uses busybox so anything i use needs to be from there

Journeyman Geek

Posted 2009-12-23T07:13:40.183

Reputation: 119 122

Answers

2

This should extract your IP address:

ifconfig vlan1 | grep "inet addr" | cut -d: -f2 | cut -d" " -f1

if you want to save it to a variable:

ip=$(ifconfig vlan1 | grep "inet addr" | cut -d: -f2 | cut -d" " -f1)

then throw it into your command:

wget -O - --http-user=username --http-passwd=password "http://dynamic.zoneedit.com/auth/dynamic.html?host=mail.myzone.com&dnsto=$ip"

ifconfig, grep, and cut are available on BusyBox.

John T

Posted 2009-12-23T07:13:40.183

Reputation: 149 037

ahh, that works mostly. Looks like i have a neutered wget that won't accept the password command, but that's another issue – Journeyman Geek – 2009-12-23T09:49:07.563