Limiting all outgoing traffic on eth0 is what we want here.
Clear any existing traffic shaping on eth0
# tc qdisc del dev eth0 root
Add the root handle and give it a default traffic shaping algorithm "htb"
# tc qdisc add dev eth0 root handle 1: htb default 26
Create a class of traffic, which will have a maximum output of 100kbit
# tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbit
Assign all traffic to address 91.195.201.27 to this class
# tc filter add dev eth0 parent 1: protocol ip prio 0 \ u32 match ip dst 91.195.201.27 flowid 1:1
To be tested: add the ingress queue:
# tc qdisc add dev eth0 handle FFFF: ingress
Apply the filter straight away:
# tc filter add dev eth0 parent ffff: protocol ip prio 2 \ u32 match ip src 91.195.201.27 police rate 100kbit \ burst 10kb drop flowid ffff:
Instead of the above source and destination address, it's entirely possible to shape all traffic with 0.0.0.0/0.
To show the status:
# tc qdisc show dev eth0
Clear it if you're not happy:
# tc qdisc del dev eth0 ingress
TODO not finished yet
Now that we know how to shape, let's test it:
# Create a bridge sudo brctl addbr br0 sudo brctl stp br0 off
# Make dummy interfaces sudo rmmod dummy sudo modprobe dummy numdummies=10 sudo ifconfig dummy0 hw ether de:ad:be:ef:00:00 sudo ifconfig dummy0 up sudo ifconfig dummy1 hw ether de:ad:be:ef:00:00 sudo ifconfig dummy1 up sudo brctl addif br0 dummy0 sudo brctl addif br0 dummy1