Skip to contentSkip to conversation

Problem with htb and fwmark

LARTC Morten Isaksen 3 participants 5 messages Jun 6, 2003 – Sep 17, 2003

lore
Share & tools
lore
#0 lore raw

Hi!

I am trying to prioritize udp traffic to satisfy our gamers.

The setup is

800 users

/ 8 Mbit fiber (eth3)
LAN (eth0) - FW -

                 \ 6 Mbit FWA (eth2)

The 8 Mbit is the default gw and the FWA is currently only used by our proxy server

I am using this script:

$IP rule add fwmark 1 table 100 pref 1000
$IP route add table 200 scope global nexthop via 213.173.228.1 dev eth2

tc filter del dev eth0 prio 3
tc qdisc del dev eth0 root handle 1:
tc qdisc add dev eth0 root handle 1: htb default 12
tc class add dev eth0 parent 1: classid 1:1 htb rate 10Mbit ceil 14Mbit burst 2k

# Class for UDP, ICMP, ssh traffic
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1MBit ceil 4Mbit burst 2k prio 0

# Class for all traffic to our servers
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 3Mbit ceil 10Mbit burst 2k prio 1

# All other traffic
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 6Mbit ceil 8Mbit burst 2k prio 3

tc qdisc add dev eth0 parent 1:10 handle 20: sfq perturb 10 tc qdisc add dev eth0 parent 1:11 handle 30: sfq perturb 10 tc qdisc add dev eth0 parent 1:12 handle 40: sfq perturb 10

tc filter add dev eth0 parent 1: protocol ip prio 3 handle 4 fw flowid 1:10 tc filter add dev eth0 parent 1: protocol ip prio 3 handle 5 fw flowid 1:11

iptables -t mangle -A PREROUTING -i eth0 -p udp -j MARK --set-mark 4

iptables -t mangle -A PREROUTING -i eth0 -p tcp --dport 22 -j MARK --set-mark 4
iptables -t mangle -A PREROUTING -s 10.10.10.3 -i eth0 -j MARK --set-mark 5 iptables -t mangle -A PREROUTING -s 10.10.10.4 -i eth0 -j MARK --set-mark 5 iptables -t mangle -A PREROUTING -s 10.10.10.5 -i eth0 -j MARK --set-mark 5 iptables -t mangle -A PREROUTING -s 10.10.10.12 -j MARK --set-mark 2

The problem is that the all the traffic is going to the default class no matter what I do.

I can see that the counters in "iptables -t mangle -L -v -n" is counting up, but the counters in "tc -s class ls dev eth0" is not.

I have also tried not to use fwmark but added the rules directly with "tc filter...", but with same results...

Have I forgotten something, or what is the problem?

--
Morten Isaksen
[email protected] - http://www.aub.dk/~misak

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 3 lines · Morten Isaksen

Hi!

I am trying to prioritize udp traffic to satisfy our gamers.

<SNIP>

Quoted 7 lines

I can see that the counters in "iptables -t mangle -L -v -n" is counting up, but the counters in "tc -s class ls dev eth0" is not.

I have also tried not to use fwmark but added the rules directly with "tc filter...", but with same results...

Have I forgotten something, or what is the problem?

I have the exact same problem here; has anyone found the reason and/or a fix?

I use 2.4.22 here. I worked with 2.4.20.

Signature · 7 lines
Mvh. / Best regards,
Steen Suder		<http://www.suder.dk/>
ICQ UIN			4133803

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Morten Isaksen
Quoted 4 lines
Quoted 1 line

Have I forgotten something, or what is the problem?

I have the exact same problem here; has anyone found the reason and/or a fix?

Post your scripts to this list.

Quoted 12 lines

I use 2.4.22 here. I worked with 2.4.20.

--
Mvh. / Best regards,
Steen Suder <http://www.suder.dk/>
ICQ UIN 4133803

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

---
Catalin(ux) BOIE
[email protected]
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#3 lore raw
In reply to Morten Isaksen
Quoted 3 lines · Morten Isaksen

Hi!

I am trying to prioritize udp traffic to satisfy our gamers.

<SNIP>

Quoted 10 lines

The problem is that the all the traffic is going to the default class no matter what I do.

I can see that the counters in "iptables -t mangle -L -v -n" is counting up, but the counters in "tc -s class ls dev eth0" is not.

I have also tried not to use fwmark but added the rules directly with "tc filter...", but with same results...

Have I forgotten something, or what is the problem?

<http://luxik.cdi.cz/~devik/qos/htb/htbfaq.htm> says:

"All packets are dropped when "default" is set to nonleaf

Yes. Default kwyword must point to leaf or be 0 (so unclassified packets go thru directly). If you want to "direct" other packets to non-leaf do it by catch all filter with the largest "pref". "

This smells like something related...

Signature · 7 lines
Mvh. / Best regards,
Steen Suder		<http://www.suder.dk/>
ICQ UIN			4133803

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#4 lore raw
In reply to Morten Isaksen
Quoted 16 lines · privat
Quoted 3 lines · Morten Isaksen

Hi!

I am trying to prioritize udp traffic to satisfy our gamers.

<SNIP>

Quoted 7 lines

I can see that the counters in "iptables -t mangle -L -v -n" is counting up,
but the counters in "tc -s class ls dev eth0" is not.

I have also tried not to use fwmark but added the rules directly with "tc filter...", but with same results...

Quoted 7 lines
Quoted 1 line

Have I forgotten something, or what is the problem?

I have the exact same problem here; has anyone found the reason and/or a fix?

I use 2.4.22 here. I worked with 2.4.20.

By some sort of accident I found the cause for the "problem" (here at least):

Make sure that the attached (to the root in case of HTB) filters actually filters the packets to the leaves (leafs?) in the (pseudo-)tree.

Then, if filters are correctly designed, no traffic will go to HTB default.

Signature · 7 lines
Mvh. / Best regards,
Steen Suder		<http://www.suder.dk/>
ICQ UIN			4133803

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/