Skip to contentSkip to conversation

wondershaper + htb prio + qdisc prio

LARTC [email protected] 4 participants 8 messages Dec 29, 2002 – Dec 31, 2002

lore
Share & tools
lore
#0 lore raw

hello,

a friend of mine have this configuration:

10 x PC -- router/linux/rh8 -- ADSL Modem -- ISP

let's say that the bandwidth is: 5M and 800K

he does dc++ and counter-strike, so let's say the UP is full, and the ping from the counter server is 300ms, the server cut the connection, and no more game, the player is unhappy. The normal ping is 50ms.

so he thinks to put some prio on the ping-echo packets to make the ping be extra small, he try the wondershapper from the lartc, don't work, make a simplified script just for icmp with is:

$tc qdisc del $IF_EXT root
$tc qdisc add $IF_EXT handle 1: root htb default 2
$tc class add $IF_EXT parent 1: classid 1:9 htb rate 500kbit burst 6k $tc class add $IF_EXT parent 1:9 classid 1:1 htb rate 500kbit ceil 500kbit burst 6k prio 1
$tc class add $IF_EXT parent 1:9 classid 1:2 htb rate 64kbit ceil 500kbit burst 6k prio 2

$tc filter add $IF_EXT protocol ip prio 2 parent 1: u32 \
        match ip protocol 1 0xff flowid 1:1

first tryed it with ceil 800kbit, after with a smaller value, the "real" bandwidth was somewhere around 700kbit, at that moment.

didn't work

so he tryed with just a prio qdisc and put the icmp packets in the 0 band, the script:

$iptables -t mangle -A POSTROUTING -p icmp -j TOS --set-tos 0x10 $tc qdisc del $IF_EXT root
$tc qdisc add $IF_EXT root handle 10: prio

$tc qdisc add $IF_EXT parent 10:1 handle 20: est 1sec 8sec bfifo $tc qdisc add $IF_EXT parent 10:2 handle 30: est 1sec 8sec bfifo $tc qdisc add $IF_EXT parent 10:3 handle 40: est 1sec 8sec bfifo

$tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos 0x10 0xff flowid 10:1
$tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos 0x06 0xff flowid 10:2
$tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos 0x0c 0xff flowid 10:3

still with no result the ping from the counter server is always 300ms, what's wrong????

C

Signature · 5 lines
  Ciprian Niculescu
 
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw

Hi,<BR><BR>I think that imcp is not the solution. I've tested with mohaa and that game uses an own sort of ping on a udp port (so via tcp and not imcp)<BR><BR>Maby u should check if counterstrike does that too.<BR><BR>Regards,<BR>Andre<BR><BR><BR>&gt; hello,<BR>&gt; <BR>&gt; a friend of mine have this configuration:<BR>&gt; <BR>&gt; 10 x PC -- router/linux/rh8 -- ADSL Modem -- ISP<BR>&gt; <BR>&gt; let's say that the bandwidth is: 5M and 800K<BR>&gt; <BR>&gt; he does dc++ and counter-strike, so let's say the UP is full, and the<BR>&gt; ping from the counter server is 300ms, the server cut the connection,<BR>&gt; and no more game, the player is unhappy. The normal ping is 50ms.<BR>&gt; <BR>&gt; so he thinks to put some prio on the ping-echo packets to make the ping<BR>&gt; be extra small, he try the wondershapper from the lartc, don't work,<BR>&gt; make a simplified script just for icmp with is:<BR>&gt; <BR>&gt; $tc qdisc del $IF_EXT root<BR>&gt; $tc qdisc add $IF_EXT handle 1: root htb default 2<BR>&gt; $tc class add $IF_EXT parent 1: classid 1:9 htb rate 500kbit burst 6k<BR>&gt; $tc class add $IF_EXT parent 1:9 classid 1:1 htb rate 500kbit ceil<BR>&gt; 500kbit burst 6k prio 1<BR>&gt; $tc class add $IF_EXT parent 1:9 classid 1:2 htb rate 64kbit ceil<BR>&gt; 500kbit burst 6k prio 2<BR>&gt; <BR>&gt; $tc filter add $IF_EXT protocol ip prio 2 parent 1: u32 \<BR>&gt; match ip protocol 1 0xff flowid 1:1<BR>&gt; <BR>&gt; first tryed it with ceil 800kbit, after with a smaller value, the "real"<BR>&gt; bandwidth was somewhere around 700kbit, at that moment.<BR>&gt; <BR>&gt; didn't work<BR>&gt; <BR>&gt; so he tryed with just a prio qdisc and put the icmp packets in the 0<BR>&gt; band, the script:<BR>&gt; <BR>&gt; $iptables -t mangle -A POSTROUTING -p icmp -j TOS --set-tos 0x10<BR>&gt; $tc qdisc del $IF_EXT root<BR>&gt; $tc qdisc add $IF_EXT root handle 10: prio<BR>&gt; <BR>&gt; $tc qdisc add $IF_EXT parent 10:1 handle 20: est 1sec 8sec bfifo<BR>&gt; $tc qdisc add $IF_EXT parent 10:2 handle 30: est 1sec 8sec bfifo<BR>&gt; $tc qdisc add $IF_EXT parent 10:3 handle 40: est 1sec 8sec bfifo<BR>&gt; <BR>&gt; $tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos<BR>&gt; 0x10 0xff flowid 10:1<BR>&gt; $tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos<BR>&gt; 0x06 0xff flowid 10:2<BR>&gt; $tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos<BR>&gt; 0x0c 0xff flowid 10:3<BR>&gt; <BR>&gt; <BR>&gt; still with no result the ping from the counter server is always 300ms,<BR>&gt; what's wrong????<BR>&gt; <BR>&gt; C<BR>&gt; -- <BR>&gt; Ciprian Niculescu<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; LARTC mailing list / [email protected]<BR>&gt;
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/<BR>

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

#2 lore raw
In reply to [email protected]

Hi,<BR><BR>(Sorry for the repost last post was screwed up by my emailclient)<BR><BR>I think that imcp is not the solution. I've tested with mohaa and that game uses an own sort of ping on a udp port (so via tcp and not imcp)<BR><BR>Maby u should check if counterstrike does that too.<BR><BR>Regards,<BR><BR>Andre<BR><BR>&gt; hello,<BR>&gt; <BR>&gt; a friend of mine have this configuration:<BR>&gt; <BR>&gt; 10 x PC -- router/linux/rh8 -- ADSL Modem -- ISP<BR>&gt; <BR>&gt; let's say that the bandwidth is: 5M and 800K<BR>&gt; <BR>&gt; he does dc++ and counter-strike, so let's say the UP is full, and the<BR>&gt; ping from the counter server is 300ms, the server cut the connection,<BR>&gt; and no more game, the player is unhappy. The normal ping is 50ms.<BR>&gt; <BR>&gt; so he thinks to put some prio on the ping-echo packets to make the ping<BR>&gt; be extra small, he try the wondershapper from the lartc, don't work,<BR>&gt; make a simplified script just for icmp with is:<BR>&gt; <BR>&gt; $tc qdisc del $IF_EXT root<BR>&gt; $tc qdisc add $IF_EXT handle 1: root htb default 2<BR>&gt; $tc class add $IF_EXT parent 1: classid 1:9 htb rate 500kbit burst 6k<BR>&gt; $tc class add $IF_EXT parent 1:9 classid 1:1 htb rate 500kbit ceil<BR>&gt; 500kbit burst 6k prio 1<BR>&gt; $tc class add $IF_EXT parent 1:9 classid 1:2 htb rate 64kbit ceil<BR>&gt; 500kbit burst 6k prio 2<BR>&gt; <BR>&gt; $tc filter add $IF_EXT protocol ip prio 2 parent 1: u32 \<BR>&gt; match ip protocol 1 0xff flowid 1:1<BR>&gt; <BR>&gt; first tryed it with ceil 800kbit, after with a smaller value, the "real"<BR>&gt; bandwidth was somewhere around 700kbit, at that moment.<BR>&gt; <BR>&gt; didn't work<BR>&gt; <BR>&gt; so he tryed with just a prio qdisc and put the icmp packets in the 0<BR>&gt; band, the script:<BR>&gt; <BR>&gt; $iptables -t mangle -A POSTROUTING -p icmp -j TOS --set-tos 0x10<BR>&gt; $tc qdisc del $IF_EXT root<BR>&gt; $tc qdisc add $IF_EXT root handle 10: prio<BR>&gt; <BR>&gt; $tc qdisc add $IF_EXT parent 10:1 handle 20: est 1sec 8sec bfifo<BR>&gt; $tc qdisc add $IF_EXT parent 10:2 handle 30: est 1sec 8sec bfifo<BR>&gt; $tc qdisc add $IF_EXT parent 10:3 handle 40: est 1sec 8sec bfifo<BR>&gt; <BR>&gt; $tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos<BR>&gt; 0x10 0xff flowid 10:1<BR>&gt; $tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos<BR>&gt; 0x06 0xff flowid 10:2<BR>&gt; $tc filter add $IF_EXT parent 10: protocol ip prio 1 u32 match ip tos<BR>&gt; 0x0c 0xff flowid 10:3<BR>&gt; <BR>&gt; <BR>&gt; still with no result the ping from the counter server is always 300ms,<BR>&gt; what's wrong????<BR>&gt; <BR>&gt; C<BR>&gt; -- <BR>&gt; Ciprian Niculescu<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; LARTC mailing list / [email protected]<BR>&gt;
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/<BR>

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

#3 lore raw
In reply to [email protected]

Hey there,

Quoted 24 lines

hello,

a friend of mine have this configuration:

10 x PC -- router/linux/rh8 -- ADSL Modem -- ISP

let's say that the bandwidth is: 5M and 800K

he does dc++ and counter-strike, so let's say the UP is full, and the ping from the counter server is 300ms, the server cut the connection, and no more game, the player is unhappy. The normal ping is 50ms.

so he thinks to put some prio on the ping-echo packets to make the ping be extra small, he try the wondershapper from the lartc, don't work, make a simplified script just for icmp with is:

$tc qdisc del $IF_EXT root
$tc qdisc add $IF_EXT handle 1: root htb default 2
$tc class add $IF_EXT parent 1: classid 1:9 htb rate 500kbit burst 6k $tc class add $IF_EXT parent 1:9 classid 1:1 htb rate 500kbit ceil 500kbit burst 6k prio 1
$tc class add $IF_EXT parent 1:9 classid 1:2 htb rate 64kbit ceil 500kbit burst 6k prio 2

Quoted 8 lines
$tc filter add $IF_EXT protocol ip prio 2 parent 1: u32 \
        match ip protocol 1 0xff flowid 1:1

first tryed it with ceil 800kbit, after with a smaller value, the "real" bandwidth was somewhere around 700kbit, at that moment.

didn't work

[ -- SNIP --]

Quoted 2 lines

still with no result the ping from the counter server is always 300ms, what's wrong????

Maybe I'm misunderstanding you, maybe not - but what exactly do you mean by "the ping from the server is always 300ms"?

Is it the ICMP ping (generated by the 'ping' tool), or do you mean when you play Counter-Strike, and you look at the players tab, that shows you're lagged with 300ms?

Have you tried to ping the counter-strike server direct from the shell using the 'ping' tool? If this results in very low ping replies, your tc setup is correctly set up.

The only thing you're missing now, is to prioritize counter-strike specific traffic. Usually the portnumbers used by Couter-Strike servers are 27015 and some numbers up, so this is what you have to prioritize.

An example (class id is from your first script, using htb) - this will put the packets leaving your $IF_EXT to port 27015, 27016 and 27017 to any hosts in the class 1:1:

for cs_p in 27015 27016 27017; do
tc filter add dev $IF_EXT parent 1:0 protocol ip prio 10 u32 \

     match ip dport $cs_p 0xffff flowid 1:1

done

You may need to modify the above example to fit your script.

--
Theepan

PS: I'm sorry if you receive this mail twice. I forgot to CC it the list the first time.

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

#4 lore raw
In reply to [email protected]
Quoted 10 lines · Tornado

Hey there,

Maybe I'm misunderstanding you, maybe not - but what exactly do you mean by
"the ping from the server is always 300ms"?

Is it the ICMP ping (generated by the 'ping' tool), or do you mean when you
play Counter-Strike, and you look at the players tab, that shows you're lagged with 300ms?

by ping i meen the real ping program with icmp, i see that i could not specify counterstrike to don't create confusion.

and the ideea is not to priorize the counter game, but only the ping used by the counter game

so another question is, the counter strike game use udp/270015 only for ping probing or also for game packets

Quoted 6 lines

Have you tried to ping the counter-strike server direct from the shell using
the 'ping' tool? If this results in very low ping replies, your tc setup is
correctly set up.

this is what i try, beacouse i dont realy play the game, i generate trafic to saturate the link, and ping from shell from an externat host

C

Quoted 15 lines

The only thing you're missing now, is to prioritize counter-strike specific
traffic. Usually the portnumbers used by Couter-Strike servers are 27015 and
some numbers up, so this is what you have to prioritize.

An example (class id is from your first script, using htb) - this will put
the packets leaving your $IF_EXT to port 27015, 27016 and 27017 to any hosts
in the class 1:1:

for cs_p in 27015 27016 27017; do
tc filter add dev $IF_EXT parent 1:0 protocol ip prio 10 u32 \

Quoted 11 lines
     match ip dport $cs_p 0xffff flowid 1:1

done

You may need to modify the above example to fit your script.

--
Theepan

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

#5 lore raw
In reply to [email protected]
Quoted 6 lines
Quoted 5 lines

Is it the ICMP ping (generated by the 'ping' tool), or do you mean when you
play Counter-Strike, and you look at the players tab, that shows you're lagged with 300ms?

Quoted 8 lines

by ping i meen the real ping program with icmp, i see that i could not specify counterstrike to don't create confusion.

and the ideea is not to priorize the counter game, but only the ping used by the counter game

so another question is, the counter strike game use udp/270015 only for ping probing or also for game packets

The counter-strike server does not 'ping' you in a "normal" fashion. It's an in-game feature, which doesn't use extra protocols to retrieve ping, hence counter-trike server uses port 27015 to both game packets and "ping-in-game"-packets.

And besides, it wouldn't make any difference to only prioritize the "ping-in-game"-packets, even if you could - the game would still lag as without traffic control.

Quoted 2 lines

this is what i try, beacouse i dont realy play the game, i generate trafic to saturate the link, and ping from shell from an externat host

In which case, you should check if your downstream is not chocking. Even if you shape outgoing packets, you can still get get bad pings, if your downstream is running at max.

--
Theepan

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

#6 lore raw
In reply to [email protected]
Quoted 8 lines · Tornado
Quoted 3 lines
Quoted 1 line

this is what i try, beacouse i dont realy play the game, i generate trafic to saturate the link, and ping from shell from an externat host

In which case, you should check if your downstream is not chocking. Even if
you shape outgoing packets, you can still get get bad pings, if your downstream is running at max.

no a 1Mbit trafic on a 5M no chocking :))))

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

#7 lore raw
In reply to [email protected]

But you are not listening to what I and others have been saying. Forget about the ICMP pings! They don't mean nothing!

Use the script I attached (change a few settings, like your own speeds, interface and executables, speeds are in kbit!). Then use the following iptables rules:

(eth0=my internet-interface, eth2=my LAN interface, change if needed !)

# ICMP packets have an even higher priority (so you can test it with ping, but this doesn't help CounterStrike at all!)
# Don't do massive pings/traceroutes because that would choke other traffic (including CS)!
iptables -I PREROUTING -t mangle -i eth2 -j MARK --set-mark 1 -p ICMP
iptables -I OUTPUT -t mangle -o eth0 -j MARK --set-mark 1 -p ICMP
# And here's Counter Strike:

# if you want you could add:  -m multiport --destination-port 27000:27050
iptables -I PREROUTING -t mangle -i eth2 -j MARK --set-mark 1 -p
DP  --source-port 27005

# ACK Packets get higher priority than 'normal' packets iptables -I PREROUTING -t mangle -i eth2 -j MARK --set-mark 2 -p TCP -m length --length 0:100
iptables -I OUTPUT -t mangle -o eth0 -j MARK --set-mark 2 -p TCP -m
length --length 0:100

And add some more yourself, remember:
- All rules are tested for each packet: MARK does _not_ stop like ACCEPT and RETURN do.
- Therefore the order in which you place these rules is important.
- Rules are inserted (-I) in the table, so eventually (use iptables -L -n) the rules will be 'upside down' in the table.
- Thus higher priorities rules (lower MARK numbers) should go first in your script, otherwise they might be overruled by later rules.

Jannes Faber

----- Original Message -----
From: "Ciprian Niculescu" <[email protected]>
To: "Tornado" <[email protected]>; <[email protected]>
Sent: Tuesday, December 31, 2002 12:23 AM
Subject: Re: [LARTC] wondershaper + htb prio + qdisc prio

Quoted 15 lines
Quoted 8 lines · Tornado
Quoted 3 lines
Quoted 1 line

this is what i try, beacouse i dont realy play the game, i generate trafic to saturate the link, and ping from shell from an externat host

In which case, you should check if your downstream is not chocking. Even if
you shape outgoing packets, you can still get get bad pings, if your downstream is running at max.

no a 1Mbit trafic on a 5M no chocking :))))

C