* [LARTC] ppp uplink shaping problems
@ 2005-07-18 7:26 Staenker
2005-07-21 0:18 ` Andy Furniss
0 siblings, 1 reply; 2+ messages in thread
From: Staenker @ 2005-07-18 7:26 UTC (permalink / raw)
To: lartc
Hello,
i played a few days with tc htb classes and classified my packets using
iptables CLASSIFY target.
here is what i did:
#!/bin/bash
int='ppp0'
#making all things clear
tc qdisc del dev $int root
iptables -t mangle --flush
iptables -t mangle --delete-chain
if $1
then
#defining classes
tc qdisc add dev $int root handle 1: htb default 20 r2q 2
tc class add dev $int parent 1: classid 1:1 htb rate 22kbps
tc class add dev $int parent 1:1 classid 1:10 htb rate 10kbps ceil
22kbps prio 0
tc class add dev $int parent 1:1 classid 1:20 htb rate 9kbps ceil 15kbps
prio 1
tc class add dev $int parent 1:1 classid 1:30 htb rate 3kbps ceil 13kbps
prio 2
tc qdisc add dev $int parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $int parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $int parent 1:30 handle 30: sfq perturb 10
iptables -t mangle -N TS_FWD
iptables -t mangle -A FORWARD -j TS_FWD
iptables -t mangle -A TS_FWD -o ppp0 -p ! icmp --match length --length
0:70 -j CLASSIFY --set-class 1:10
iptables -t mangle -A TS_FWD -o ppp0 -p ! icmp --match length --length
0:70 -j RETURN
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
--destination-port 80 -j CLASSIFY --set-class 1:20
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
--destination-port 80 -j RETURN
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
--destination-port 443 -j CLASSIFY --set-class 1:20
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
--destination-port 443 -j RETURN
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
--destination-port 554 -j CLASSIFY --set-class 1:10
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
--destination-port 554 -j RETURN
#if $2
#then
# iptables -t mangle -A TS_FWD -i eth2 -o ppp0 --source 192.168.0.2
-j LOG
#fi
iptables -t mangle -A TS_FWD -i eth2 -o ppp0 --source 192.168.0.2 -j
CLASSIFY --set-class 1:30
fi
It works not really good. I tested it using my internal 100MBit network
interface using multiple ftp connections and classified the packets
based on their source-ip. That works fine with same classes. Immediately
all things i expected took place. Also the prio option worked fine. If i
was running 2 simultanious downloads, the one with the higher piority
gets all borrowable downloadspeed and the one with the lower priority
gets his ashured rate.
But same classes didnt work with my 192kbit 2048kbit ppp link. Well ok,
they are working, but not like i want them to work. The speed changes
takes some seconds to take place. And the priority seems to be ignored.
I have to say, that the i tested the ppp uplink using emule with many
connections (500 - 800) and the higher priority upload was one active
ftp connection.
Whats my fault?
Regards
Richard Hauswald
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LARTC] ppp uplink shaping problems
2005-07-18 7:26 [LARTC] ppp uplink shaping problems Staenker
@ 2005-07-21 0:18 ` Andy Furniss
0 siblings, 0 replies; 2+ messages in thread
From: Andy Furniss @ 2005-07-21 0:18 UTC (permalink / raw)
To: lartc
Staenker wrote:
> Hello,
>
> i played a few days with tc htb classes and classified my packets using
> iptables CLASSIFY target.
>
> here is what i did:
> #!/bin/bash
> int='ppp0'
> #making all things clear
> tc qdisc del dev $int root
> iptables -t mangle --flush
> iptables -t mangle --delete-chain
>
> if $1
> then
> #defining classes
> tc qdisc add dev $int root handle 1: htb default 20 r2q 2
> tc class add dev $int parent 1: classid 1:1 htb rate 22kbps
>
> tc class add dev $int parent 1:1 classid 1:10 htb rate 10kbps ceil
> 22kbps prio 0
> tc class add dev $int parent 1:1 classid 1:20 htb rate 9kbps ceil 15kbps
> prio 1
> tc class add dev $int parent 1:1 classid 1:30 htb rate 3kbps ceil 13kbps
> prio 2
> tc qdisc add dev $int parent 1:10 handle 10: sfq perturb 10
> tc qdisc add dev $int parent 1:20 handle 20: sfq perturb 10
> tc qdisc add dev $int parent 1:30 handle 30: sfq perturb 10
>
> iptables -t mangle -N TS_FWD
> iptables -t mangle -A FORWARD -j TS_FWD
>
> iptables -t mangle -A TS_FWD -o ppp0 -p ! icmp --match length --length
> 0:70 -j CLASSIFY --set-class 1:10
> iptables -t mangle -A TS_FWD -o ppp0 -p ! icmp --match length --length
> 0:70 -j RETURN
>
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
> --destination-port 80 -j CLASSIFY --set-class 1:20
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
> --destination-port 80 -j RETURN
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
> --destination-port 443 -j CLASSIFY --set-class 1:20
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
> --destination-port 443 -j RETURN
>
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
> --destination-port 554 -j CLASSIFY --set-class 1:10
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 -p tcp --source 192.168.0.2
> --destination-port 554 -j RETURN
> #if $2
> #then
> # iptables -t mangle -A TS_FWD -i eth2 -o ppp0 --source 192.168.0.2
> -j LOG
> #fi
> iptables -t mangle -A TS_FWD -i eth2 -o ppp0 --source 192.168.0.2 -j
> CLASSIFY --set-class 1:30
> fi
>
> It works not really good. I tested it using my internal 100MBit network
> interface using multiple ftp connections and classified the packets
> based on their source-ip. That works fine with same classes. Immediately
> all things i expected took place. Also the prio option worked fine. If i
> was running 2 simultanious downloads, the one with the higher piority
> gets all borrowable downloadspeed and the one with the lower priority
> gets his ashured rate.
> But same classes didnt work with my 192kbit 2048kbit ppp link. Well ok,
> they are working, but not like i want them to work. The speed changes
> takes some seconds to take place. And the priority seems to be ignored.
> I have to say, that the i tested the ppp uplink using emule with many
> connections (500 - 800) and the higher priority upload was one active
> ftp connection.
>
> Whats my fault?
I can't see what rule seperates ftp from the rest, so that could be it -
check counters/classification with
tc -s class ls dev ppp0
If ftp is going to the right class then it may be that emule network
traffic consists of loads of small packets. If your ppp0 is adsl then
the difference between the ip length that htb sees and the actual length
used on the wire can be significant enough to make you go over limits
and end up with a 2+ second queue in your modem. Check with ping and
make icmp go to top priority class. It is possible to patch tc/kernel to
allow for this.
Andy.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-21 0:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-18 7:26 [LARTC] ppp uplink shaping problems Staenker
2005-07-21 0:18 ` Andy Furniss
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.