Limiting the bandwidth of incoming traffic

0.00 avg. rating (0% score) - 0 votes

A backup server was saturating the DSL links of remote offices every time the backups were running. To prevent this, I had to limit the incoming bandwidth of the TCP-connections that were used to back up the remote hosts, but not touch the ones that were used to connect to the servers in the local network. Here’s how to do it.

The limiting must be done by attaching a queuing discipline on the ingress side of the interface the traffic is coming in from. After that you can attach filters that filter traffic from specified hosts or subnets with a given bandwidth.

Step number one is to attach the ingress qdisc:

Step number two is to add one or more filters that police the bandwidth:

Step number three is to make your new qdisc and filters to load each time you reboot your server. On Ubuntu, this can be achieved by adding a script to the /etc/network/if-up.d directory. Scripts in that directory will be called whenever a network interface comes up.

Let’s add a file called /etc/network/if-up.d/tc with the following contents:

Further reading:

http://www.linuxdocs.org/HOWTOs/Adv-Routing-HOWTO-14.html

http://lartc.org/howto/

2 thoughts on “Limiting the bandwidth of incoming traffic”

Leave a Reply