[nzlug] ADSL modem / dyndns

Karl. kmw1 at free.net.nz
Fri Mar 23 13:43:36 NZST 2007


I'm using an RTA220U.  Using scli (SNMP Command Line Interface - it's 
been in Debian a while and probably everywhere else too) I can do:

IP=$(scli 192.168.1.1 -ic 'show ip addresses' 2>/dev/null | egrep 'prefix="32"' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
(that should all be one line)

or without scli:
IP=$(wget 192.168.1.1/easystart.html -O - 2>/dev/null | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')

I suspect that the scli approach will work on a lot of different 
routers, but that may just be my naivety showing again  :-)
(I've only tested it on one router)
(The non-scli approach probably won't work on anything other than the RTA220)

Feed the IP address to your dyndns updater (I use ez-ipupdate) with a 
cron job and it's all wonderful!

Karl.



More information about the NZLUG mailing list