Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "sufcrusher" <sufcrusher@zonnet.nl>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] wondershaper + htb prio + qdisc prio
Date: Tue, 31 Dec 2002 10:49:15 +0000	[thread overview]
Message-ID: <marc-lartc-104133185928626@msgid-missing> (raw)
In-Reply-To: <marc-lartc-104118607605812@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 2359 bytes --]

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" <lartc@cnicules.4email.net>
To: "Tornado" <tornado@linuxfromscratch.org>; <lartc@mailman.ds9a.nl>
Sent: Tuesday, December 31, 2002 12:23 AM
Subject: Re: [LARTC] wondershaper + htb prio + qdisc prio


> On Mon, 30 Dec 2002 22:22:28 +0100, "Tornado"
> <tornado@linuxfromscratch.org> said:
> > > >
> > > 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
>

[-- Attachment #2: tcstart.sh --]
[-- Type: application/octet-stream, Size: 1462 bytes --]

#!/bin/sh

INET_INTERFACE="eth0"

TC_UPLINK_RATE="100"
TC_RATE[0]=70
TC_CEIL[0]=$TC_UPLINK_RATE
TC_RATE[1]=10
TC_CEIL[1]=60
TC_RATE[2]=10
TC_CEIL[2]=60
TC_RATE[3]=10
TC_CEIL[3]=60

# Executables and stuff
IPTABLES="iptables"
TC="tc-htb"
IP="ip"
LOG="/dev/null"

# Comment out the following two lines after setting up all variables above
# and having checked them.
TC="echo tc-htb"
LOG="/dev/stdout"

#### No need to alter anything below here ####

PRIOS='0 1 2 3'

# Packet marks
MARK[0]="1"
MARK[1]="2"
MARK[2]="3"
MARK[3]="4"

# Find last prio, which will be the default
for PRIO in $PRIOS
do
	LAST_PRIO=$PRIO
done

# The iptables part
iptables -F -t mangle
ezshaper -i start

# The TC part
$TC qdisc del dev $INET_INTERFACE root

$TC qdisc add dev $INET_INTERFACE root handle 1:0 htb default $[$LAST_PRIO+10]
$TC class add dev $INET_INTERFACE parent 1:0 classid 1:1 htb rate ${TC_UPLINK_RATE}kbit

for PRIO in $PRIOS
do
	echo -e "\n***** Prio $PRIO *****" > $LOG
	# Add leaf classes for PRIO traffic
	$TC class add dev $INET_INTERFACE parent 1:1 	\
			classid 1:$[$PRIO+10] htb                	\
			rate ${TC_RATE[$PRIO]}"kbit"             	\
			ceil ${TC_CEIL[$PRIO]}"kbit"             	\
    	prio $PRIO

	# Now filter PRIO traffic to this leaf
	$TC filter add dev $INET_INTERFACE parent 1:0         \
    	protocol ip prio $PRIO handle ${MARK[$PRIO]}      \
			fw flowid 1:$[$PRIO+10]
done

      parent reply	other threads:[~2002-12-31 10:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-29 18:19 [LARTC] wondershaper + htb prio + qdisc prio lartc
2002-12-29 18:28 ` AHM
2002-12-29 18:55 ` Andre Meij
2002-12-30 10:54 ` Tornado
2002-12-30 11:21 ` Ciprian Niculescu
2002-12-30 21:22 ` Tornado
2002-12-30 23:23 ` Ciprian Niculescu
2002-12-31 10:49 ` sufcrusher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-104133185928626@msgid-missing \
    --to=sufcrusher@zonnet.nl \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox