Home » Questions » Computers [ Ask a new question ]

How to throttle bandwidth on a Linux network interface?

How to throttle bandwidth on a Linux network interface?

Is there a way to constrain the bandwidth on a NIC in linux? I'd like to be able to simulate an arbitrarily slow connection.

Asked by: Guest | Views: 259
Total answers/comments: 4
Guest [Entry]

"The netem kernel module, controlled by iproute.

You need to compile Netem with the kernel:

Networking -->
Networking Options -->
QoS and/or fair queuing -->
Network emulator

Once the netem module loaded, iproute's tc allows you things like:

tc qdisc add dev tap0 root netem delay 50ms loss 50%

(50 % packet loss, extra delay of 50 ms)"
Guest [Entry]

"I found a way to avoid my box from eating all the bandwidth available on network using a tool called 'wondershaper' in ubuntu. I hope it exist in other linux destros too. I can limit the bandwidth what my linux home pc can consume using following command.

sudo wondershaper eth0 1000 200

This limits the download limit to 1000 kilobits and uplaod to 200 kilobits. Refer to the man pages of wondershaper for more information/options."
Guest [Entry]

"You can use locally installed squid proxy to limit bandwidth for example to test a web page on slow link:

Install squid proxy from your distribution — on my Fedora it was as easy as yum install squid.
Add the following to /etc/squid/squid.conf:

delay_pools 1
delay_class 1 1
delay_access 1 allow all
delay_parameters 1 16000/16000

This will limit bandwidth to about 128 kbps (16000 Bps).
Start squid: /etc/init.d/squid start
Configure your browser to use proxy server localhost port 3128."
Guest [Entry]

"No one has yet mentioned ip_relay, named ""iprelay"" in the Debian repositories. It works as a TCP proxy, rather than intercepting calls the way trickle does, and will work with any application that can use a proxy (e.g. a web browser) or accept a user-defined destination port (telnet, ssh, ftp, curl, et cetera).

It's a little more difficult to set up, but often works in situations where trickle won't."