My ZTE H168N ADSL/VDSL modem has telnet server on it.
Sometimes, I need to reboot it. But it need to go there, and press its ON/OFF switch… takes time.
In order to reboot it remotely over telnet, there are some steps need to be followed.
To achieve this goal, I wrote a very simple expect script. First, you must install expect. I use Linux Mint, but I saw expect has windows port too 🙂
For linux: sudo apt-get install expect
And write this script:
#!/usr/bin/expect
spawn telnet 192.168.2.1
expect “Username:”
send “admin\r”
expect “Password:”
send “ttnet\r”
expect “>”
send “enable\r”
expect “Password:”
send “zte\r”
expect “#”
send “shell\r”
expect “Login:”
send “root\r”
expect “Password:”
send “root\r”
expect “#”
send “reboot\r”
expect “#”
sleep 5
After you execute, your H168 will reboot in 10 seconds, voila !