tcpnice the Linux Bandwidth conrtoller on your local network February 14, 2011Posted by Tournas Dimitrios in Linux admin tools.
If you have a local network at home and the Internet access is shared between the members of your family , often you will face the problem of ” Bandwidth overloading ” . You know , kids are downloading their favorite .mp3 songs , and you kan not enjoy even a simple web surf experience . Another scenario , say you’re at an internet cafe and some dude sitting next to you is hogging up all the bandwidth with his multiple torrent downloads of illegal software. You’re at your machine and you are trying to upload some important documents to your website. The frustration grows as your uploads begin to time out. Thanks to Dug Song the creator of dsniff , we have a method to slow-down our neighbour’s / family’s member network speed , …. introducing tcpnice .
My previous article outlined the tcpkill utility that can be used to kill live tcp connections to or from a host, network, port or a combination of them all. Similarly, Tcpnice doesnt necessarily kill the connections, but attempt to slow them down.
- First we need to perform a MITM man in the middle attack (arpspoof or ettercap shall do) , then enable forwarding in the kernel as follows:
# echo 1 > /proc/sys/net/ipv4/ip _forward
- We then need to determine what local ip is hogging up the bandwidth. There is a useful sniffer that i use call tcptrack that list the live connections that it sees and the bandwidth/speed of the data that is being transferred back and forth on each connection.
#tcptrack -i eth0
- Once you determine the IP of the bandwidth hogger (in this example, 192.168.1.45 ), its time to unleash our magic.
# tcpnice -i eth0 -A host 192.168.1.45
If no option (A,I,M) is given, all would be used.
-A Inject TCP tiny window advertisements. -I (Ai) Inject ICMP source quench replies. -M Inject ICMP fragmentation-needed replies with tiny next-hop MTUs. -i interface to listen on