Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 Dec 23 '09 at 9:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.