Dlink DSL-G604T Bittorent problem

This is a very good article showing how to change the configuration for Dlink DSL-G604T so as to solve the bittorrent problem.

"D-LINK (& Several other major routers, netgear, linksys, etc.) has a maximum connection threshold. There are several firmware upgrades for improved p2p performance and also some 3rd party firmware. Please google for it. However, if you don't trust these 3rd party firmware, there is a workaround.

This problem is extremely easy to identify. You utorrent downloads continue running, all connections continues. For example, a Internet explorer downloads continues with no problem. But "non-continuous" connections stops. You can't ping your router. Your MSN Disconnects. You can't use internet explorer to surf the web. Then this is most probably your problem.

PLEASE NOTE THE FOLLOWING IS TO BE USED ON D-LINK DSL-G604T ADSL ROUTERS ONLY. ALTHOUGH OTHER ROUTERS MAY CONTAIN SIMILAR OS, DIRECTORY STRUCTURE & TELNET COMMANDS. USE IT AT YOUR OWN RISK.

This post documents how to automate this process, and how to simplify the re-issuing of commands should it be necessary to reboot or restart the router.

The process is called Telnet Scripting. To use it you need:
- a Telnet Scripting tool
- a file containing Telnet commands (that is, a script file)

Although you can use a normal telnet. You will have to type the commands all over again everytime the router restarts. This includes changing firewall settings, virtual server settings, etc. With a telnet scripting tool, you can do it with 2 clicks.

The Telnet Scripting tool that I use is TST10.EXE, written by Albert Yale. It can be downloaded from at http://users.telenet.be/tontonzen/gg/TST10.zip

Here's a trivial example of its use, a script to login to the DSL-G604T and display the help text:

192.168.1.1 23
WAIT "login:"
SEND "root\m"
WAIT "Password:"
SEND "admin\m"
WAIT "#"
SEND "help\m"
WAIT "#"

The script assumes the default IP address of the router (192.168.1.1) and the default login password (admin).

If the script were stored in the file help.txt then the command to issue it (assuming it is in the same directory as TST10.EXE) would be:

tst10 /r:help.txt

Info on the script syntax and the parameters of TST10.EXE can be found by running the program.

If you like, you can also write a .bat file on your own to run the script so all you have to do is double click to execute the commands. That is what I did.

A real life example of where this is useful is given below. This provides a script to set the NAT session parameters for success (?) with P2P applications, by increasing the number of concurrent NAT sessions and setting appropriate timeout values to ensure 'stale' session data is discarded. Acknowledgement and thanks to a post by samPT in this forum for the values.

192.168.1.1 23
WAIT "login:"
SEND "root\m"
WAIT "Password:"
REM This password is the administrator password you have set.
SEND "admin\m"
WAIT "#"
SEND "cd /proc/sys/net/ipv4/netfilter\m"
WAIT "#"
SEND "echo 4096 > ip_conntrack_max\m"
WAIT "#"
SEND "echo 50 > ip_conntrack_generic_timeout\m"
WAIT "#"
SEND "echo 5 > ip_conntrack_tcp_timeout_close\m"
WAIT "#"
SEND "echo 120 > ip_conntrack_tcp_timeout_close_wait\m"
WAIT "#"
SEND "echo 1200 > ip_conntrack_tcp_timeout_established\m"
WAIT "#"
SEND "echo 120 > ip_conntrack_tcp_timeout_fin_wait\m"
WAIT "#"
SEND "echo 60 > ip_conntrack_tcp_timeout_time_wait\m"
WAIT "#"
SEND "echo 10 > ip_conntrack_udp_timeout\m"
WAIT "#"
SEND "cd /\m"
WAIT "#"
SEND "exit\m"

Save this in a file (say) nat_sessions.txt, edit the default IP address and password to match your installation. Run a command prompt, change to the directory with the script + program, and execute it with:
tst10 /r:nat_sessions.txt /m

Just to confirm that these commands have taken effect and that the values have been written to the specific files, change directory and type them out. Here's an example:
cd /proc/sys/net/ipv4/netfilter/
cat ip_conntrack_max

You can extend this Telnet Scripting technique to do as many things as your Linux knowledge and the embedded toolset in the DSL-G604T allows. Which means that you perhaps won't need to wait for new firmware releases and fixes. Clearly this won't cover everything, but I'm sure you get the idea...

"

No comments: