TD-W8970 reboot script

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.

TD-W8970 reboot script

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
TD-W8970 reboot script
TD-W8970 reboot script
2013-05-29 20:56:08
Region : Italy

Model : TD-W8970

Hardware Version : V1

Firmware Version : 0.6.0 2.1 v000c.0 Build 130415 Rel.34164n

ISP :


my router work fine, but i need to create a script command to launch from linux machine for disconnect adsl and reconnect or reboot the device.
in telnet the only option is to create,delete or see the configuration.
without using web interface, there is another method to do that?
thanks
  0      
  0      
#1
Options
8 Reply
Re:TD-W8970 reboot script
2013-06-03 12:12:30
"without using web interface, there is another method to do that?"
Maybe only script command can do that without web utility. It is quite difficult to create a script command. When using telnet, you can check if there are some available commands by checking Help information.
  0  
  0  
#2
Options
Re:TD-W8970 reboot script
2013-06-04 07:21:55
on all various command that i say in help there is not an option to disconnect wan but only to create,view and delete connection.
there is another method to do?i have a raspberry with raspbian and i think to use an http recorder to do that instead of telnet.
but for one reason or another i not found anythink that work.
the only software that work is pureload but is not automatically to launch...
  0  
  0  
#3
Options
Re:TD-W8970 reboot script
2013-06-05 09:16:25
SOLUTION CREATED BY MYSELF:

I found a workaroud to do that with telnet, is not perfect but it work!
In telnet access you can only change the configuration of the wan interface, so i made a script to enter with telnet, change user and password with fake data (that forcing to disconnect) and re-enter correct data in wan interface.
i have tried different solution but the best for my case is a script that request telnet and expect (sudo apt-get install telnet except)

--------------------------
#!/bin/bash

expect << EOF
spawn telnet 192.168.1.1
expect "username:"
sleep 1
send "admin\r"
expect "password:"
sleep 1
send "admin\r"
sleep 2
expect "*#"
send "wan set service pppoe_8_35_0_d --protocol pppoe --username fakedata --password fakedata\r"
sleep 6
send "\r"
sleep 1
expect "*#"
send "wan set service pppoe_8_35_0_d --protocol pppoe --username ispusername --password isppassword\r"
sleep 6
send "\r"
sleep 1
expect "*#"
send "logout"

exit

EOF

----------------------------
  0  
  0  
#4
Options
Re:TD-W8970 reboot script
2013-06-07 10:04:36
and now i have write a Visual Basic Script for doing the same thing in Windows!
------------------------
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "telnet 192.168.1.1~"
WScript.Sleep 1000
WshShell.SendKeys "admin~"
WScript.Sleep 1000
WshShell.SendKeys "admin~"
WScript.Sleep 2000
WshShell.SendKeys "wan set service pppoe_8_35_0_d --protocol pppoe --username fakedata --password fakedata~"
WScript.Sleep 6000
WshShell.SendKeys "~"
WScript.Sleep 1000
WshShell.SendKeys "wan set service pppoe_8_35_0_d --protocol pppoe --username ispusername --password isppassword~"
WScript.Sleep 6000
WshShell.SendKeys "~"
WScript.Sleep 1000
WshShell.SendKeys "logout~"
WScript.Sleep 100
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}")
Set objProcess = objWMI.InstancesOf("Win32_process")
For each Process in objProcess
If (instr(1,lcase(Process.name),lcase("telnet.exe")) > 0) then
Process.terminate 0
End If
Next
WshShell.SendKeys "exit~"
----------------
  0  
  0  
#5
Options
Re:TD-W8970 reboot script
2013-06-07 10:07:05
You do a great job!!;)
  0  
  0  
#6
Options
Re:TD-W8970 reboot script
2014-11-28 18:21:36
;) Hi, 'another more quickly could also be to change the connection mode from automatic to manual and then bring it back to automatic.
so:

wan set service pppoe_8_35_0_d --protocol pppoe --conntrigger manual
or
wan set service pppoa_8_35_0_d --protocol pppoa --conntrigger manual

wan set service pppoe_8_35_0_d --protocol pppoe --conntrigger always
or
wan set service pppoa_8_35_0_d --protocol pppoa --conntrigger always

I tried it and it works.
  0  
  0  
#7
Options
ok
2014-12-01 04:19:36
Hi, here is the script tested and working with some changes and checks.
Greetings.


#!/bin/bash

clear
current_ip=$(wget -qO- http://ipecho.net/plain)
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Internet Current IP: "$current_ip
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
sleep 3

while true; do

clear
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Start Procedure Disconnecting...."
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"

expect << EOF
sleep 3
spawn telnet 192.168.1.254
expect "username:"
sleep 1
send "admin\r"
expect "password:"
sleep 1
send "password"
sleep 1
send "\r"
sleep 2
expect "*#"
send "\r"
sleep 1
send "\r"
send "wan set service pppoa_8_35_1_d --protocol pppoa --conntrigger manual"
sleep 1
send "\r"
sleep 5
send "\r"
sleep 3
expect "*#"
sleep 1
send "logout"
sleep 1
send "\r"
sleep 3


exit


EOF
clear
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Disconnecting Happened Successfully."
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
sleep 5
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Start Procedure Reconnecting...."
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
sleep 2
expect << EOF
sleep 3
spawn telnet 192.168.1.254
expect "username:"
sleep 1
send "admin\r"
expect "password:"
sleep 1
send "password"
sleep 1
send "\r"
sleep 2
expect "*#"
send "\r"
sleep 1
send "\r"
send "wan set service pppoa_8_35_1_d --protocol pppoa --conntrigger always"
sleep 1
send "\r"
sleep 5
send "\r"
sleep 2
send "\r"
expect "*#"
sleep 3
send "logout"
sleep 2
send "\r"
sleep 2


exit


EOF


new_ip=$(wget -qO- http://ipecho.net/plain)
echo " "
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Reconnecting Happened Successfully."
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Old IP: "$current_ip
echo "New IP: "$new_ip
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
sleep 3

if [[ $current_ip != $new_ip ]];
then
sleep 1
clear
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Procedure Change IP perfectly Successful."
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Old IP: "$current_ip
echo "-----------------------------------------------------"
echo "New IP: "$new_ip
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
sleep 3
break;
fi
sleep 2
clear
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "The procedure IP change failed"
echo "New Attempt to Change IP, in progress..."
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Old IP: "$current_ip
echo "-----------------------------------------------------"
echo "New IP: "$new_ip
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "-----------------------------------------------------"
echo "Wait..... Please..."
echo "-----------------------------------------------------"
sleep 5


done
  0  
  0  
#8
Options
Re:TD-W8970 reboot script
2014-12-01 15:32:58
Wow! Kudos to your threads!
  0  
  0  
#9
Options

Information

Helpful: 0

Views: 1738

Replies: 8

Related Articles