Skip to content

Instantly share code, notes, and snippets.

@edgartaor
Last active March 17, 2016 03:11
Show Gist options
  • Save edgartaor/0a1894340654f161ceef to your computer and use it in GitHub Desktop.
Save edgartaor/0a1894340654f161ceef to your computer and use it in GitHub Desktop.
Linux script to change IP on modem Thomson TG587/TG585
#!/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