Script to renew ip on Netgear dg834g (and similar)
From SHellium Wiki
I wrote this script.
It's very useful if you want to renew ip or reconnect the adsl connection for problems.
I like to use it for downloading files from rapidshare and similar avoiding long waiting.
It works in this way:
- enanble the telnet interface on the router
- login to it.
- kill pppd and restart it
- close the telnet interface
- after restart have a look to the new IP
If you wanna use it, please login via telnet to your router and check if the pppd commandline is compatible with yours using ps.
If not, simply fix the "COMMAND LINE PPPD" line.
Here it is:
#!/bin/bash ROUTER_USER="admin"; ROUTER_PASS="router_pass_here"; ROUTER_IP="192.168.1.254"; ADSL_USER="adsl_user_here"; ADSL_PASS="adsl_pass_here"; #enabling telnet ODEBUG="curl -s --basic http://$ROUTER_USER:$ROUTER_PASS@$ROUTER_IP/setup.cgi?todo=debug"; $ODEBUG >/dev/null $ODEBUG>/dev/null $ODEBUG>/dev/null ## COMMAND LINE PPPD echo "killall pppd; /usr/sbin/pppd plugin pppoa 8.35 user $ADSL_USER password $ADSL_PASS logfile /tmp/ppp_log debug nodetach defaultroute vc-encaps usepeerdns maxfail 0 qos UBR lcp-echo-failure 3 lcp-echo-interval 10; sleep 20; ifconfig ppp0|grep inet; killall utelnetd" >/tmp/cmd nc -q -1 $ROUTER_IP 23 </tmp/cmd >/tmp/log_reconnect # telnet and run the command cat /tmp/log_reconnect|grep "inet addr" |cut -f 2 -d":"|cut -f 1 -d " " ; #what about the new IP address??