Last active
March 17, 2016 03:11
-
-
Save edgartaor/0a1894340654f161ceef to your computer and use it in GitHub Desktop.
Linux script to change IP on modem Thomson TG587/TG585
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set timeout 20 | |
#Just to compare the old and new IP | |
echo Old IP: | |
curl "https://wtfismyip.com/text" | |
/usr/bin/expect << EOF | |
spawn telnet "192.168.1.254" | |
#Username | |
expect ":" { send "TELMEX\r" } | |
#Password | |
expect ":" { send "YOUR_PASSWORD_HERE\r" } | |
#http://npr.me.uk/telnet.html | |
#Drop / Start PPP Session | |
# With some ISP connections this may change your gateway it may also change your IP address. | |
# Useful if your ISP sometimes has congested gateways. | |
send "ppp ifdetach intf=Internet\r" | |
sleep 5 | |
send "ppp ifattach intf=Internet\r" | |
sleep 5 | |
send "exit\r" | |
EOF | |
echo New IP: | |
curl "https://wtfismyip.com/text" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment