Re: [LARTC] Shaping by IP's

2006-02-25 Thread Andy Furniss

Laimis wrote:

If in one time 3 IP adresses using internet. TC script:

DEV=eth0 # LAN
SERVER_IP=192.168.1.2 # eth0 ip address
tc qdisc add dev $DEV root handle 1: htb default 255
tc class add dev $DEV parent 1: classid 1:1 htb rate 384Kbit quantum 
1500


tc class add dev $DEV parent 1:1 classid 1:20 htb rate 128Kbit ceil 
384Kbit prio 0 quantum 1500
tc class add dev $DEV parent 1:1 classid 1:21 htb rate 128Kbit ceil 
384Kbit prio 0 quantum 1500
tc class add dev $DEV parent 1:1 classid 1:22 htb rate 128Kbit ceil 
384Kbit prio 0 quantum 1500


tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 6
tc qdisc add dev $DEV parent 1:21 handle 21: sfq perturb 6
tc qdisc add dev $DEV parent 1:22 handle 22: sfq perturb 6

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 20 fw 
flowid 1:20
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 21 fw 
flowid 1:21
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 22 fw 
flowid 1:22


iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168.
1.20 -j MARK --set-mark 20
iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168.
1.21 -j MARK --set-mark 21
iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168.
1.22 -j MARK --set-mark 22


If we swiched on 2 PC's (192.168.1.20 & 192.168.1.21) many p2p 
programs, FTP with many conections, and on 3d PC
(192.168.1.22) FTP downloading with one conection. then 3d PC getin 
less than 128kbit. If i want that all 3 PC's get

NOT LESS than 128kbit, what should I do with my script?


You need to back off from your line rates. For ingress so you can shape 
at all and for egress to allow for overheads (you can get patches for 
dsl overheads).


Quantum should be 1514 as you shape on eth and sfq is really meant for 
bulk traffic. It would be better to mark say small tcp and udp and give 
them priority with the rest going to sfq. I would also limit the length 
of the sfqs default of 128 is far too long for shaping at these rates - 
you want to drop packets especially for ingress.


Perturb causes packet reordering so it's best set higher than 6 - I use 20.

Andy.
___
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc


[LARTC] Shaping by IP's

2006-02-21 Thread Laimis
If in one time 3 IP adresses using internet. TC script:

DEV=eth0 # LAN
SERVER_IP=192.168.1.2 # eth0 ip address
tc qdisc add dev $DEV root handle 1: htb default 255
tc class add dev $DEV parent 1: classid 1:1 htb rate 384Kbit quantum 
1500

tc class add dev $DEV parent 1:1 classid 1:20 htb rate 128Kbit ceil 
384Kbit prio 0 quantum 1500
tc class add dev $DEV parent 1:1 classid 1:21 htb rate 128Kbit ceil 
384Kbit prio 0 quantum 1500
tc class add dev $DEV parent 1:1 classid 1:22 htb rate 128Kbit ceil 
384Kbit prio 0 quantum 1500

tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 6
tc qdisc add dev $DEV parent 1:21 handle 21: sfq perturb 6
tc qdisc add dev $DEV parent 1:22 handle 22: sfq perturb 6

tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 20 fw 
flowid 1:20
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 21 fw 
flowid 1:21
tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 22 fw 
flowid 1:22

iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168.
1.20 -j MARK --set-mark 20
iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168.
1.21 -j MARK --set-mark 21
iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168.
1.22 -j MARK --set-mark 22


If we swiched on 2 PC's (192.168.1.20 & 192.168.1.21) many p2p 
programs, FTP with many conections, and on 3d PC
(192.168.1.22) FTP downloading with one conection. then 3d PC getin 
less than 128kbit. If i want that all 3 PC's get
NOT LESS than 128kbit, what should I do with my script?

If I could solve this BIG problem, than I could use it with my 
IPShaping script and user at night, when flow is free, he could get
all internet speed.
<===>
   DELFI mail pašto sistema http://www.mail.lt
___
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc