Telnet scripting to a Thomson TG587n Router 


If you need help with telnet commands, see this first telnet.html

Introduction

A telnet script, called from a batch file, can be a very quick and convenient way to issue frequently used cli commands to the router.
For example the following stats script and batch file displays the routers stats with just a double click, saving much typing and remembering of passwords and commands.

The telnet script tool I use is a freeware program called "tst10.exe". A download source can easily found using google.



Important
Only use notepad to write telnet scripts and batch files.
Some third party text editor corrupt the commands sent to tst10.exe.

Place all script files, batch files and tst10.exe in the same folder.

Like all telnet commands -- use at your own risk. These examples are for a Thomson TG587n router, they may not suit your router.



Assorted scripts

1) Stats
This script displays the routers line stats as shown in the following graphic.



stats.txt
192.168.1.254
WAIT "Username :"
SEND "SuperUser\m"
WAIT "Password :"
SEND "mypassword\m"
WAIT ">"
SEND "xdsl info expand=enabled\m"
WAIT ">"
Copy the above in to notepad, modify the username and password to suit your router and save as c:\tst10\stats.txt

stats.bat
echo off
cls
if exist r1.txt del r1.txt
if exist r2.txt del r2.txt
tst10.exe /r:stats.txt /o:r1.txt /m
for /f "skip=30 tokens=*" %%A in (r1.txt) do echo %%A >> r2.txt
del r1.txt
start r2.txt
Copy the above in to notepad and save as c:\tst10\stats.bat
Note: if the file saves as "stats.bat.txt" then rename it.
To run, double click on stats.bat and your routers line stats will be displayed in a notepad file as above.



2) Resync
This script resyncs the router, much faster than a reboot. This can not be done from the routers user interface.
Note: this command tricks the router by resetting the modulation mode to it's default setting (ie no change) which causes a resync.

resync.txt
192.168.1.254
WAIT "Username :"
SEND "SuperUser\m"
WAIT "Password :"
SEND "mypassword\m"
WAIT ">"
SEND "xdsl debug multimode config=t1.413issue2+g992.1_annex_a+g992.3_annex_a+g992.3_annex_l+g992.3_annex_m+g992.5_annex_a+g992.5_annex_m\m"
WAIT ">"

resync.bat
tst10.exe /r:resync.txt /m



3) Reboot

reboot.txt
192.168.1.254
WAIT "Username :"
SEND "SuperUser\m"
WAIT "Password :"
SEND "mypassword\m"
WAIT ">"
SEND "system reboot\m"
WAIT ">"

reboot.bat
tst10.exe /r:reboot.txt /m



4) Switch between OpenDNS and the ISP's DNS

This script can be found on the web content filter page.



5) Improve port forwarding / UPnP for Xbox and PS3

This script can be found on the Xbox and PS3 on a Thomson Router page



Telnet Project for Thomson Routers

Telnet commands for a Thomson router

Multiple SSID  -- (TG587n only)


Web Access Control Schedule (TOD) -- (TG587n only)

Web content filter


Telnet scripting


Enable WDS on a TG585v7 / TG587n

Connect Two Thomson Routers Together

Basic DMZ on a Thomson Router


Advanced DMZ on a Thomson TG587n

Forward all ports to a specific LAN IP

IP QoS

Wake on LAN from Internet

Xbox and PS3 on a Thomson router

Remote Access to a Thomson Router

Fix a problem with VPN Connections   (Firmware Release 8.4.3 only)

Home Page

footer
Copyright© NPR 2010 - 2012       Disclaimer