B
B
bamond2015-11-27 15:38:54
linux
bamond, 2015-11-27 15:38:54

Why does tc affect all connections?

Good afternoon. There is a desire to cut traffic on port 80. I use iptables + tc for this

iptables -A OUTPUT -t mangle -p tcp --sport 80 -j MARK --set-mark 10
iptables -A OUTPUT -t mangle -p tcp --sport 21 -j MARK --set-mark 6
iptables -A OUTPUT -t mangle -p tcp --sport 22 -j MARK --set-mark 7

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1:0 htb default 10
tc class add dev eth1 parent 1:0 classid 1:10 htb rate 7000kbps ceil 8000kbps prio 0
tc class add dev eth1 parent 1:0 classid 1:11 htb rate 80000kbps ceil 90000kbps prio 5
tc class add dev eth1 parent 1:0 classid 1:12 htb rate 80000kbps ceil 90000kbps prio 4
tc filter add dev eth1 parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10
tc filter add dev eth1 parent 1:0 prio 0 protocol ip handle 6 fw flowid 1:11
tc filter add dev eth1 parent 1:0 prio 0 protocol ip handle 7 fw flowid 1:12

traffic on the interface drops from 100MB to those specified in the parameter. But at the same time, the channel is not freed up for other connections to other ports ... but everything else starts to lag in the same way.
Please tell me what's wrong?
the task is to cut the nginx outgoing channel in order to free up part for other tasks. thanks
P/S directives limit_rate and $limit_rate won't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2015-11-27
@bamond

no need to mark OUTPUT
tc on ports, filters can be set by itself

tc filter add dev eth1 protocol ip parent 1:0 prio 25 u32 match \
  ip sport 80 0xffff flowid 1:10

lartc.qdisc.filters
and you need to set the speed for the root class
tc class add dev eth1 parent 1: classid 1:1 htb rate 100Mbit ceil 100Mbit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question