qdisc netem / htb on subinterface

2

I have a linux box that I use to simulate a WAN link between two nodes. This linux box has two subinterfaces on eth1 (eth1:11 and eth1:12). I'm successfully using netem / htb to simulate delay and bandwidth limits. However, it seems that the commands are applied globally to the eth1 interface, not to the subinterface. Is it possible to apply qdisc commands only to a specific sub interface?

For reference, here are the tc commands I am using:

tc qdisc add dev eth1:11 root handle 1:0 htb default 10
tc class add dev eth1:11 parent 1:0 classid 1:10 htb rate 1544kbit 
tc qdisc add dev eth1:11 parent 1:10 handle 10:0 netem delay 10ms 2ms 25% distribution normal

Chris S.

Posted 2013-03-03T23:42:40.183

Reputation: 101

Answers

2

After much searching, I found out that this isn't possible with subinterfaces. It is, however, possible with a vlan interface. So - you can effectively achieve the same sort of setup if you have access to the port between your linux box and a switch, and your switch supports vlan tagging. Change the port on the switch to a trunk port and then create your vlan interfaces off of ethX. From there you can use tc to control the flow on a per vlan intereface.

Chris S.

Posted 2013-03-03T23:42:40.183

Reputation: 101