HTB and prio

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

this is a followup to "Problem with HTB and ceil", the problem with the ceiling
has been resolved, thanks to the memebers on this m/g.

Now I have the problem that packets get into the correct classe with the correct
marks but the prios are not respected. I have 4 different classes:
1. voip class / prio 0 / mark 100 / voip traffic
2. ACK class / prio 1 / mark 200 / ACK packets to keep downloads as fast as
possible
3. SSH class / prio 3 / mark 300 / ssh/scp interactive traffic
4. http/client class / prio 3 / mark 400 / traffic from the internal net/web
browsing traffic
5. bulk classe / prio 4 / mark 500 / bulk traffic like p2p stuff etc, also
locally from the router

All the minium settings are respected, same goes for ceiling. I would expect
that after assuring that the guaranteed minimum bitrates have been assigned,
that the excess bandwidth will first be given to the class with the highest
prio until the ceiling has been reached, and if there is any bandwidth left,
proceed with the class with the next lower prio. That doesnt happen, any excess
b/w will be spread all across the classes/prios.
Now here is the script:

--------------------------------------------
#!/bin/bash
#
# Shell-Skript fuer Quality of Service mit HTB
#

EXTIF=ppp0
INTIF=eth0

if [ "$1" = "start" ]; then
############
# Outgoing
############
## Root
/sbin/tc qdisc add dev $EXTIF root handle 1:0 htb default 400
## Hauptklasse
/sbin/tc class add dev $EXTIF parent 1:0 classid 1:1 htb rate 380kbit ceil
380kbit
/sbin/tc class add dev $EXTIF parent 1:1 classid 1:2 htb rate 380kbit ceil
380kbit

## voip class
/sbin/tc class add dev $EXTIF parent 1:2 classid 1:100 htb rate 32kbit ceil
96kbit prio 0
## non voip class
/sbin/tc class add dev $EXTIF parent 1:2 classid 1:101 htb rate 248kbit ceil
380kbit
## ACK class
/sbin/tc class add dev $EXTIF parent 1:101 classid 1:200 htb rate 200kbit ceil
380kbit prio 1
## VPN/SSH class
/sbin/tc class add dev $EXTIF parent 1:101 classid 1:300 htb rate 16kbit ceil
380kbit prio 3
## http class
/sbin/tc class add dev $EXTIF parent 1:101 classid 1:400 htb rate 16kbit ceil
380kbit prio 3
## bulk class
/sbin/tc class add dev $EXTIF parent 1:101 classid 1:500 htb rate 16kbit ceil
380kbit prio 4

###################
# Marking
###################

# default marking *500
iptables -A POSTROUTING -t mangle -o $EXTIF -j MARK --set-mark 500

# voip *100
iptables -A POSTROUTING -t mangle -o $EXTIF -p udp --sport 5060:5061 -m length
--length 0:45 -j MARK --set-mark 100
iptables -A POSTROUTING -t mangle -o $EXTIF -p udp -s 172.20.1.200 -j MARK
--set-mark 100

# ACK+dns *200
iptables -A POSTROUTING -t mangle -o $EXTIF -p tcp -m tcp --tcp-flags
SYN,RST,ACK ACK -j MARK --set-mark 200
iptables -A POSTROUTING -t mangle -o $EXTIF -p udp --sport 53 -j MARK --set-mark
200
iptables -A POSTROUTING -t mangle -o $EXTIF -p udp --dport 53 -j MARK --set-mark
200

# SSH *300
iptables -A POSTROUTING -t mangle -o $EXTIF -p tcp --dport 22 -j MARK --set-mark
300
iptables -A POSTROUTING -t mangle -o $EXTIF -p tcp --sport 22 -j MARK --set-mark
300

# http *400
iptables -A POSTROUTING -t mangle -o $EXTIF -p tcp --dport 80 -j MARK --set-mark
400
iptables -A POSTROUTING -t mangle -o $EXTIF -p tcp -s 172.20.1.0/24 -j MARK
--set-mark 400

# bulk *500
iptables -A POSTROUTING -t mangle -o $EXTIF -p icmp -j MARK --set-mark 500


tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 1 fw flowid 1:1
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 2 fw flowid 1:2
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 100 fw flowid
1:100
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 101 fw flowid
1:101
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 200 fw flowid
1:200
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 300 fw flowid
1:300
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 400 fw flowid
1:400
tc filter add dev $EXTIF parent 1:0 prio 0 protocol ip handle 500 fw flowid
1:500

#######
# SFQ
#######
#tc qdisc add dev $EXTIF parent 1:2 handle 2: sfq perturb 10
tc qdisc add dev $EXTIF parent 1:100 handle 100: sfq perturb 10
#tc qdisc add dev $EXTIF parent 1:101 handle 101: sfq perturb 10
tc qdisc add dev $EXTIF parent 1:200 handle 200: sfq perturb 10
tc qdisc add dev $EXTIF parent 1:300 handle 300: sfq perturb 10
tc qdisc add dev $EXTIF parent 1:400 handle 400: sfq perturb 10
tc qdisc add dev $EXTIF parent 1:500 handle 500: sfq perturb 10

fi
--------------------------------------------

                  o root 1:0
                  |
                  + 1:1
                  |
  ________________+ 1:2
 /                |
 |                | 1:101
 |      __________+__________
 |      |      |      |      |
 |      |      |      |      |
 |      |      |      |      |
voip   ACK    SSH    http   bulk
pr 0   pr 1   pr 2   pr 3   pr 4
1:100  1:200  1:300  1:300  1:400

Does anyone have a clue what I am doing wrong? (1:1 is not needed, I know, I
wanted to attach another subtree to 1:1 which I havent done yet, thats why its
still listed)

Any help is appreciated.

nik

_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux