Answer the question
In order to leave comments, you need to log in
Linux shaping VLAN?
It is necessary to limit the speed of the Internet for vlan. Router on linux (Debian 6).
Let's do something like this
dev='eth0.111'
rate='1Mbit'
ceil="$rate"
mark='3'
iptables -D OUTPUT -t mangle -o $dev -j MARK --set-mark $mark
tc qdisc del dev $dev root
tc qdisc add dev $dev root handle 1:0 htb default 10
tc class add dev $dev parent 1:0 classid 1:10 htb rate $rate ceil $rate prio 0
tc filter add dev $dev parent 1:0 prio 0 protocol ip handle $mark fw flowid 1:$mark
iptables -A OUTPUT -t mangle -o $dev -j MARK --set-mark $mark
Answer the question
In order to leave comments, you need to log in
Shaping on the physical interface saved the father of Russian democracy:
root_device='eth0'
tc qdisc del dev $root_device dev root
tc qdisc add dev $root_device root handle 1: htb default 10
tc class replace dev $root_device parent 1:0 classid 1:$vlan_id htb rate $rate ceil $ceil prio 0
tc filter replace dev $root_device protocol 802.1q parent 1:0 prio 1 handle 800::$vlan_id u32 match ip dst "$subnet" match ip protocol 1 0xff flowid 1:$vlan_id
I use wondershaper for tests, it cuts the channel quite accurately and without any special failures.
You have mark="3". Also in the filter you have “handle $mark fw flowid 1:$mark”, but you don’t have something of this class. Hence the problems. In addition, since you are cutting all traffic, you can do without using iptables.
For example, like this (adapting your script):
tc qdisc del dev $dev root
tc qdisc add dev $dev root handle 1: htb default 10
tc class add dev $dev parent 1:0 classid 1:10 htb rate $rate ceil $rate prio 0
You need to hang SFQ on the leaves: sysadmins.ru/post9847647.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question