JRehkemper.de

Limit Interface Bandwidth with Wondershaper

Wondershaper is a simple bash script that is using tc und the hood. tc allows you to introduce packet-loss, latency or bandwith-limits on your networkinterfaces. It’s really powerful and also quiet complex. Wondershaper makes it easy to limit the bandwith with just one, readable command.

Installation

The easiest way to install is, to simply copy the bash-script from github and past it on your server.

wget https://raw.githubusercontent.com/magnific0/wondershaper/master/wondershaper -o wondershaper.sh

After hat make it executable and that’s it.

chmod +x wondershaper.sh

Limit your bandwidth

First you need to identify your network interface. You can use ip a for that.

ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
...  
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
...  

In this case ens192.

Now run `wondershaper

./wondershaper.sh -a ens192 -u 1024 -d 1024

-a specifies the interfaces.
-u specifies the upload in Kbps.
-d specifies the download in Kbps.

Now your bandwidth is limited.

Show current limits

You can show your current limits with -s

./wondershaper.sh -a ens192 -s

Remove limits

To clear your limits simply run

./wondershaper.sh -a ens192 -c
profile picture of the author

Jannik Rehkemper

I'm an professional Linux Administrator and Hobby Programmer. My training as an IT-Professional started in 2019 and ended in 2022. Since 2023 I'm working as an Linux Administrator.