Hi,
I have a default class for my un-marked traffic
(prio 5) and a prio 0 class for the important stuff,
but I do not understand why my download traffic
is duplicated in both.
It work fine for my upload traffic (same setting
except the red class but I have the same
result if I create an esfq instead).
Any comments/information will be
appreciated.
Below my config :
tc commands from my scirpt :
# TC on my download link
tcdownload ()
{
tc qdisc add dev $TC_D_INT root
handle 1: htb default 99 debug
$HTB_DEBUG
tc class add dev
$TC_D_INT parent 1: classid 1:1 htb rate ${D_LIMIT}kbit
# VOIP
class have the highest priority
tc
class add dev $TC_D_INT parent 1:1 classid 1:10 htb
\
rate ${VOIP}kbit ceil ${D_LIMIT}kbit prio
0
tc qdisc add dev $TC_D_INT
parent 1:10 handle 10: esfq perturb 10 hash dst limit
8
tc filter add dev $TC_D_INT
parent 1: prio 0 protocol ip handle 10 fw flowid 1:10
# shape
everything at $D_LIMIT minus
$VOIP speed
tc class add dev
$TC_D_INT parent 1: classid 1:2 htb
\
rate $[$D_LIMIT-$VOIP]kbit ceil ${D_LIMIT}kbit
# high
prio class 1:20 to low prio class 1:99
(default)
tc class add dev
$TC_D_INT parent 1:2 classid 1:20 htb rate $[D_LIMIT-$VOIP]kbit prio
1
tc class add dev $TC_D_INT
parent 1:2 classid 1:99 htb rate $[D_LIMIT-$VOIP]kbit prio 5
# all
get Enchanced Stochastic Fairness (depending on dst ip), excet the default class
(red):
tc qdisc add dev $TC_D_INT
parent 1:20 handle 20: esfq perturb 10 hash
dst
# Red setting /5 to make
latency 200ms
RED_MAX=$[($D_LIMIT*1000/8)/5]
RED_MIN=$[$RED_MAX/3]
RED_LIMIT=$[$RED_MAX*8]
RED_AVPKT=1000
tc qdisc add dev
$TC_D_INT parent 1:99 handle 99: red bandwidth ${D_LIMIT}
\
probability 0.02 limit ${RED_LIMIT} min ${RED_MIN} max ${RED_MAX}
\
avpkt ${RED_AVPKT} burst $[((2*$RED_MIN)+($RED_MAX))/(3*$RED_AVPKT)]
ecn
# setup
$IPTABLES hooks
tc filter add dev
$TC_D_INT parent 1: prio 1 protocol ip handle 20 fw flowid
1:20
tc filter add dev $TC_D_INT
parent 1: prio 5 protocol ip handle 99 fw flowid 1:99
}
# tc -s -d class show dev imq1
class htb
1:99 parent 1:2 leaf 99: prio 5 quantum 1024 rate
80Kbit ceil 80Kbit burst 1701b/8 mpu 0b cburst 1701b/8 mpu 0b level
0
Sent 114868 bytes 2209 pkts (dropped 0,
overlimits 0)
rate 2569bps 49pps
lended: 2209 borrowed: 0
giants: 0
tokens: 132320 ctokens: 132320
class htb 1:1 root rate 192Kbit ceil 192Kbit burst
1844b/8 mpu 0b cburst 1844b/8 mpu 0b level 7
Sent 114857 bytes 2209
pkts (dropped 0, overlimits 0)
rate 2658bps 51pps
lended: 0
borrowed: 0 giants: 0
tokens: 59900 ctokens: 59900
class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1433 rate 112Kbit ceil 192Kbit burst 1742b/8
mpu 0b cburst 1844b/8 mpu 0b level 0
Sent
114857 bytes 2209 pkts (dropped 0, overlimits 0)
rate 2658bps
51pps
lended: 2209 borrowed: 0 giants: 0
tokens: 96857
ctokens: 59900
class htb 1:2 root rate 80Kbit ceil 192Kbit burst
1701b/8 mpu 0b cburst 1844b/8 mpu 0b level 7
Sent 115684 bytes 2218
pkts (dropped 0, overlimits 0)
rate 2764bps 53pps
lended: 0
borrowed: 0 giants: 0
tokens: 132320 ctokens: 59900
class htb 1:20 parent 1:2 leaf 20: prio 1 quantum
1024 rate 80Kbit ceil 80Kbit burst 1701b/8 mpu 0b cburst 1701b/8 mpu 0b level
0
Sent 816 bytes 9 pkts (dropped 0, overlimits 0)
rate
20bps
lended: 9 borrowed: 0 giants: 0
tokens: 127200 ctokens:
127200
# tc -s -d qdisc show dev imq1
qdisc red
99: limit 38400b min 1600b max 4800b ecn ewma 1 Plog 18 Scell_log
22
Sent 3612535 bytes 68768 pkts (dropped 1,
overlimits 1)
marked 0 early 1 pdrop 0 other 0
qdisc esfq 20: quantum 1000b limit 128p flows
128/1024 perturb 10sec hash: dst
Sent 26055 bytes 300 pkts (dropped 0,
overlimits 0)
qdisc esfq 10: quantum 1000b limit 8p flows
128/1024 perturb 10sec hash: dst
Sent
3569131 bytes 68642 pkts (dropped 0, overlimits 0)
qdisc htb 1: r2q 10 default 99
direct_packets_stat 24 ver 3.16
Sent 7209229 bytes 137739 pkts (dropped
1, overlimits 364)
# iptables -t mangle -L
Chain PREROUTING
(policy ACCEPT)
target prot opt
source
destination
IMQ all --
anywhere
anywhere IMQ:
todev 1
pretos all --
anywhere
anywhere
tcpre all --
anywhere
anywhere
Chain INPUT (policy
ACCEPT)
target prot opt
source
destination
Chain FORWARD (policy
ACCEPT)
target prot opt
source
destination
IMQ all --
anywhere
anywhere IMQ:
todev 0
tcfor all --
anywhere
anywhere
Chain OUTPUT (policy
ACCEPT)
target prot opt
source
destination
outtos all --
anywhere
anywhere
tcout all --
anywhere
anywhere
Chain POSTROUTING (policy
ACCEPT)
target prot opt
source
destination
Chain outtos (1
references)
target prot opt
source
destination
Chain pretos (1
references)
target prot opt
source
destination
Chain tcfor (1
references)
target prot opt
source
destination
MARK udp --
anywhere
anywhere udp
dpts:8000:30000 MARK set 0xa
MARK
udp --
anywhere
anywhere udp
dpts:5060:5069 MARK set 0xa
MARK
udp --
anywhere
anywhere udp
dpts:2427:2436 MARK set 0xa
MARK
tcp --
anywhere
anywhere tcp
dpt:ssh MARK set 0x14
MARK tcp
--
anywhere
anywhere tcp
dpt:webmin MARK set 0x14
MARK icmp
--
anywhere
anywhere MARK
set 0x14
MARK tcp --
anywhere
anywhere tcp
flags:!SYN,RST,ACK/ACK MARK set 0x14
MARK
tcp --
anywhere
anywhere tcp
flags:SYN,RST,ACK/ACK length 0:128 TOS match !Normal-Service MARK set
0x14
MARK all --
anywhere
anywhere MARK
match 0x0 MARK set 0x63
Chain tcout (1
references)
target prot opt
source
destination
Chain tcpre (1
references)
target prot opt
source
destination
MARK
udp --
anywhere
anywhere udp
dpts:8000:30000 MARK set 0xa
MARK
udp --
anywhere
anywhere udp
dpts:5060:5069 MARK set 0xa
MARK
udp --
anywhere
anywhere udp
dpts:2427:2436 MARK set 0xa
MARK
tcp --
anywhere
anywhere tcp
dpt:ssh MARK set 0x14
MARK tcp
--
anywhere
anywhere tcp
dpt:webmin MARK set 0x14
MARK icmp
--
anywhere
anywhere MARK
set 0x14
MARK tcp --
anywhere
anywhere tcp
flags:!SYN,RST,ACK/ACK MARK set 0x14
MARK
tcp --
anywhere
anywhere tcp
flags:SYN,RST,ACK/ACK length 0:64 TOS match !Normal-Service MARK set
0x14
MARK all --
anywhere
anywhere MARK
match 0x0 MARK set 0x63
# tc -V
tc utility,
iproute2-ss001007
# uname -r
2.4.26
# iptables --version
iptables
v1.2.9
Thank you,
Yacine.