Throttling Ethernet connection on Linux

Often for testing purposes it is necessary to restrict the speed of a network connection.

This can be achieved using the netem module to tc.

For example, to restrict the bandwidth on eth0 to classic dial-up speeds use the command:

tc qdisc add dev eth0 root netem rate 56kbit

This can be cleared with:

tc qdisc del dev eth0 root netem rate 56kbit

Alternatively, this rule can be executed on an Ethernet Bridge so that it is independent of the device being tested.