2

I am trying to limit the bandwidth on the ingress of a wireless interface using an IFB virtual interface. I followed the instructions here

Summary of the steps:

Bringing up ifb:

sudo modprobe ifb numifbs=1
ip link set dev ifb0 up

redirect ingress qdisc of wlp3s0 to ifb0:

sudo tc qdisc add dev wlp3s0 handle ffff: ingress
sudo tc filter add dev wlp3s0 parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0

setting bandwidth limit of 1 mbps

sudo tc qdisc add dev ifb0 root handle 1: htb default 10
sudo tc class add dev ifb0 parent 1: classid 1:1 htb rate 1mbit

I tested the set up with iperf, however I am able to receive data on the physical interface at a rate of 4 Mbps (which exceeds the 1 Mbps limit I set).

Any ideas what I'm doing wrong here? How can I fix this?

1 Answers1

0

You define HTB's default to use classid 1:10, and then define only 1:1. 1:1 is never used, so there is no limitation done.

Either define default to 1, to reach classid 1:1, or add a filter to selectively choose when to reach 1:1.

So either rewrite it as:

sudo tc qdisc add dev ifb0 root handle 1: htb default 1
sudo tc class add dev ifb0 parent 1: classid 1:1 htb rate 1mbit

or else keep default 10, but add a specific filter pointing at 1:1, for example to filter only (ingress) destination port 5001, which would only affect iperf -s run on this system, like this:

sudo tc filter add dev ifb0 parent 1: protocol ip u32 match ip dport 5001 0xffff flowid 1:1
A.B
  • 9,037
  • 2
  • 19
  • 37