Skip to contentSkip to conversation

PRIO not working?

LARTC Jacob Elder 4 participants 5 messages Apr 13, 2002 – Oct 8, 2004

lore
Share & tools
lore
#0 lore raw

I'm trying to prioritize interactive traffic over other traffic on my 56k dialup link. I wrote some chains to set the ToS in PREROUTING and OUTGOING, and I'm using a PRIO queue with three SFQ children:

iptables -A OUTPUT -t mangle -p tcp --dport ftp-data -j TOS --set-tos Maximize-throughput iptables -A OUTPUT -t mangle -p tcp --dport domain -j TOS --set-tos Maximize-throughput iptables -A OUTPUT -t mangle -p tcp --dport www -j TOS --set-tos Maximize-throughput iptables -A OUTPUT -t mangle -p tcp --dport smtp -j TOS --set-tos Minimize-cost iptables -A OUTPUT -t mangle -p tcp --dport telnet -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport ssh -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p udp --dport domain -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport ftp -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport 5900 -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport imaps -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport 9898 -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport 5190 -j TOS --set-tos Minimize-delay iptables -A OUTPUT -t mangle -p tcp --dport 6667 -j TOS --set-tos Minimize-delay

tc qdisc add dev $DEV root handle 1: prio
tc qdisc add dev $DEV parent 1:1 handle 10: sfq perturb 5 # interactive tc qdisc add dev $DEV parent 1:2 handle 20: sfq perturb 5 # throughput tc qdisc add dev $DEV parent 1:3 handle 30: sfq perturb 5 # lowcost

According to tcpdump, the ToS bits are indeed being set like I asked, but "watch tc -s qdisc show dev ppp0" shows that everything is going into the "througput" queue regardless. The only traffic that increments the counter for the "interactive" queue is post-handshake SSH traffic, and from what I've read, SSH sets the ToS explicitly. What am I doing wrong?

Signature · 6 lines
Jacob Elder
http://www.lucidpark.net/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw
Quoted 3 lines · Jacob Elder

I'm trying to prioritize interactive traffic over other traffic on my 56k dialup link. I wrote some chains to set the ToS in PREROUTING and OUTGOING, and I'm using a PRIO queue with three SFQ children:

PRIO works just fine - you probably have it configured wrong.

Quoted 1 line

iptables -A OUTPUT -t mangle -p tcp --dport ftp-data -j TOS --set-tos Maximize-throughput

OUTPUT is only for locally generated packets, by the way. To mangle forwarded packets, use PREROUTING.

Quoted 5 lines

According to tcpdump, the ToS bits are indeed being set like I asked, but "watch tc -s qdisc show dev ppp0" shows that everything is going into the "througput" queue regardless. The only traffic that increments the counter for the "interactive" queue is post-handshake SSH traffic, and from what I've read, SSH sets the ToS explicitly. What am I doing wrong?

I would advise rechecking the output of tcpdump before and after applying the iptables mangle rules.

Regards,

bert hubert

Signature · 6 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
http://www.tk                              the dot in .tk
http://lartc.org           Linux Advanced Routing & Traffic Control HOWTO
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Jacob Elder
Quoted 6 lines · bert hubert
Quoted 3 lines · Jacob Elder

I'm trying to prioritize interactive traffic over other traffic on my 56k dialup link. I wrote some chains to set the ToS in PREROUTING and OUTGOING, and I'm using a PRIO queue with three SFQ children:

PRIO works just fine - you probably have it configured wrong.

I'm sure it does for you guys, that's why I'm asking for help :)

Quoted 5 lines
Quoted 2 lines

iptables -A OUTPUT -t mangle -p tcp --dport ftp-data -j TOS --set-tos Maximize-throughput

OUTPUT is only for locally generated packets, by the way. To mangle forwarded packets, use PREROUTING.

I know, I'm only worried about my one workstation at the moment.

Quoted 9 lines
Quoted 6 lines

According to tcpdump, the ToS bits are indeed being set like I asked, but "watch tc -s qdisc show dev ppp0" shows that everything is going into the "througput" queue regardless. The only traffic that increments the counter for the "interactive" queue is post-handshake SSH traffic, and from what I've read, SSH sets the ToS explicitly. What am I doing wrong?

I would advise rechecking the output of tcpdump before and after applying the iptables mangle rules.

AIM traffic before:

140.186.55.23.33788 > 64.12.163.214.9898: tcp 68 (DF)

And after:

140.186.55.23.33788 > 64.12.163.214.9898: tcp 68 (DF) [tos 0x10]

I forgot to mention that I'm running iproute 20010824-6 and kernel 2.4.17, Debian Woody. Did the tc command lines I posted before look alright?

Signature · 6 lines
Jacob Elder
http://www.lucidpark.net/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#3 lore raw
In reply to Jacob Elder

Hello,
I am using a simple script, which is based on prio. The point is,
that it is not possible to use htb on wifi networks, so I thought that prio will work fine, but it does almost nothing.

All I wanted was to make the important packets like icmp, games, VoIP,... to go first, and to slow the things like FTP data transfer, etc.

When I use $TC -s qdisc show dev ${IFACE}, I see, that the packets go to correct qdiscs.
But when I start FTP data transfer, then the ping time is same with and without this shaping.

I should also mention, that I am testing it on WiFi with hostap drivers, where the ping times are about 2-3ms when idle and 100-150ms durring high traffic.

Is the first/fastest prio class really 1:1, and the last/slowest is 1:4?

Or did I miss something else?

A part of the code follows:

$TC qdisc add dev ${IFACE} root handle 1:0 prio bands 4 priomap 2 2 2 2 2 2 0 0 1 2 2 2 2 2 2 2 2>/dev/null

    $TC qdisc add dev ${IFACE} parent 1:1 handle 10 sfq quantum 1514b
perturb 10
    $TC qdisc add dev ${IFACE} parent 1:2 handle 20 sfq quantum 1514b
perturb 10
    $TC qdisc add dev ${IFACE} parent 1:3 handle 30 sfq quantum 1514b
perturb 10
    $TC qdisc add dev ${IFACE} parent 1:4 handle 40 sfq quantum 1514b

perturb 10

    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 1 fw flowid
1:1
    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 2 fw flowid
1:2
    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 3 fw flowid
1:3
    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 4 fw flowid

1:4

$IPT -t mangle -A POSTROUTING -o ${IFACE} -j MARK --set-mark 1
.......
$IPT -t mangle -A POSTROUTING -o ${IFACE} -p tcp --dport 20 -j MARK --set-mark 2
$IPT -t mangle -A POSTROUTING -o ${IFACE} -p tcp --sport 20 -j MARK --set-mark 2
.......

Thank you very much for any help,
Filip Jenicek

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

#4 lore raw
In reply to Jacob Elder
Quoted 45 lines · Phill

Hello,
I am using a simple script, which is based on prio. The point is,
that it is not possible to use htb on wifi networks, so I thought that prio will work fine, but it does almost nothing.

All I wanted was to make the important packets like icmp, games, VoIP,... to go first, and to slow the things like FTP data transfer, etc.

When I use $TC -s qdisc show dev ${IFACE}, I see, that the packets go to correct qdiscs.
But when I start FTP data transfer, then the ping time is same with and without this shaping.

I should also mention, that I am testing it on WiFi with hostap drivers, where the ping times are about 2-3ms when idle and 100-150ms durring high traffic.

Is the first/fastest prio class really 1:1, and the last/slowest is 1:4?

Or did I miss something else?

A part of the code follows:

$TC qdisc add dev ${IFACE} root handle 1:0 prio bands 4 priomap 2 2 2 2 2 2 0 0 1 2 2 2 2 2 2 2 2>/dev/null

    $TC qdisc add dev ${IFACE} parent 1:1 handle 10 sfq quantum 1514b
perturb 10
    $TC qdisc add dev ${IFACE} parent 1:2 handle 20 sfq quantum 1514b
perturb 10
    $TC qdisc add dev ${IFACE} parent 1:3 handle 30 sfq quantum 1514b
perturb 10
    $TC qdisc add dev ${IFACE} parent 1:4 handle 40 sfq quantum 1514b

perturb 10

    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 1 fw flowid
1:1
    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 2 fw flowid
1:2
    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 3 fw flowid
1:3
    $TC filter add dev ${IFACE} parent 1:0 protocol ip handle 4 fw flowid

1:4

Quoted 7 lines

$IPT -t mangle -A POSTROUTING -o ${IFACE} -j MARK --set-mark 1
.......
$IPT -t mangle -A POSTROUTING -o ${IFACE} -p tcp --dport 20 -j MARK --set-mark 2
$IPT -t mangle -A POSTROUTING -o ${IFACE} -p tcp --sport 20 -j MARK --set-mark 2
.......

You need to limit the rate to less than link speed by making the prio a child of an htb class.

Andy.

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