WikiDevi.Wi-Cat.RU:DD-WRT/Peer-to-Peer (P2P) Throttling
How to throttle peer-to-peer file sharing in DD-WRT so as to provide fairer allocation of network capacity for all users of a shared Internet connection. Tested with Build 14929.
Introduction
When configuring a router for shared access to the Internet, users of peer-to-peer file sharing applications like BitTorrent and eMule can seriously degrade performance for other users, particularly on asymmetric connections like cable and DSL. (This is because saturation of the slower uplink can greatly slow the normally much faster downlink.) To ensure fairer allocation of network capacity for all users, it may be desirable to throttle (degrade) peer-to-peer file sharing. (It's difficult if not impossible to block it completely.)
Enter the following settings in the DD-WRT Web GUI, click Apply Settings, and Reboot Router after all settings have been made. (It's a good idea to set a strong password to prevent unauthorized access to the DD-WRT Web Gui, and to save the configuration settings once desired results have been achieved.)
Access Restrictions
On the Access Restrictions page of the Web GUI, check the box for "Catch All P2P Protocols". While this can be defeated fairly easily by determined users (e.g., with protocol obfuscation/encryption, VPN tunneling, etc.), it's still worth doing.
Universal Plug and Play (UPnP)
Universal Plug and Play is used by peer-to-peer file sharing applications to map incoming ports in order to permit incoming file sharing connections, and it has no value for most other typical Internet uses, so disabling it thus degrades the performance of peer-to-peer file sharing without adverse affects to most other users. In addition, it can be a security risk, so it's a good idea to disable it for that reason as well.
Quality of Service (QoS)
Enable Start QoS
Check Enable for "Start QoS".
Throttle Uplink
To help prevent saturation of the uplink (see Introduction above), set it to 80-95% of the measured uplink speed with nothing else active. Speedtest.net can be used to measure network speeds.
Bulk Priority for P2P
Most standard network protocols use computer networking ports below 1024, whereas peer-to-peer protocols normally use computer networking ports above 1023, so giving lower priority to Internet traffic above computer networking port 1023 will tend to throttle peer-to-peer traffic without significant adverse effects on other Internet traffic. From Add/Edit Service on QoS, define (Add) these two QoS service types for the computer networking port range 1024 to 65535, and then Apply Settings:
- P2PTCP: TCP
- P2PUDP: UDP
Then Add these two services to QoS with Priority set to Bulk, and again Apply Settings.
Management
Effective peer-to-peer file sharing depends on relatively long network connections, so setting short network connection timeouts both degrades the effectiveness of peer-to-peer file sharing and frees connections for use by other protocols, although timeouts should not be set so low that standard Internet uses are also degraded. A good first approximation is to try timeouts of 60 seconds both for TCP and for UDP. Standard Internet uses will tend to be increasingly impaired at lower values, and it probably does not make sense to go below 30 seconds.
Timeouts are configured in the IP Filter Settings section of the Administration > Management page (scroll down as needed).