mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mldonkey-users] 1/ Solving latency pb - 2/download/connect_to_serve


From: Lionel Bouton
Subject: Re: [Mldonkey-users] 1/ Solving latency pb - 2/download/connect_to_server pb
Date: Tue, 28 Jan 2003 17:48:11 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021223

tristate wrote:

Hi Lionel,

you wrote:
If people are interested I can forward my setup scripts to them or the list (for Linux 2.4 kernel based distributions).
can you send me your script?

best regards
tristate


Here they are.

wshaper is based on the "wonder shaper" from lartc.org
Works better for me than theirs.

You should call "wshaper start" when the interface goes up (rules are cleared when the interface goes down).
For ppp users (ADSL...) put the call in "/etc/ppp/ipup-local"

lbofirewall should be added to your firewall setup script.

There you should add the traffic to be priotirized.

LB.
#!/bin/bash 

UPLINK=120
DEV=ppp0
TC=/sbin/tc

if [ "$1" = "status" ]
then
        $TC -s qdisc ls dev $DEV
        $TC -s class ls dev $DEV
        exit
fi

UPLOW=$[9*$UPLINK/10]
UPLOWER=$[8*$UPLINK/10]

# clean existing down- and uplink qdiscs, hide errors
$TC qdisc del dev $DEV root    2> /dev/null > /dev/null
$TC qdisc del dev $DEV ingress 2> /dev/null > /dev/null

if [ "$1" = "stop" ] 
then 
        exit
fi


###### uplink

# install root CBQ
$TC qdisc add dev $DEV root handle 1: cbq bandwidth 10mbit avpkt 1500

# shape everything at $UPLINK speed - this prevents huge queues in your
# DSL modem which destroy latency:
# main class
$TC class add dev $DEV parent 1: classid 1:1 cbq bandwidth 10mbit rate 
${UPLINK}kbit \
allot 1518 prio 1 avpkt 1500 minburst 10 bounded



# highest prio class 1:11:
$TC class add dev $DEV parent 1:1 classid 1:11 cbq rate ${UPLINK}kbit \
   allot 1518 prio 1 avpkt 1500 bounded

# high prio class 1:13:
$TC class add dev $DEV parent 1:1 classid 1:13 cbq rate ${UPLINK}kbit \
   allot 1518 prio 3 avpkt 1500 bounded

# moderate high prio class 1:15:
$TC class add dev $DEV parent 1:1 classid 1:15 cbq rate ${UPLINK}kbit \
   allot 1518 prio 5 avpkt 1500 bounded

# low prio class 1:17: (less bandwidth)
$TC class add dev $DEV parent 1:1 classid 1:17 cbq rate ${UPLOW}kbit \
   allot 1518 prio 7 avpkt 1500 bounded

# lowest class 1:18:
# least bandwidth available
# traffic not catched by any rule go here
$TC class add dev $DEV parent 1:1 classid 1:18 cbq rate ${UPLOWER}kbit \
   allot 1518 prio 8 avpkt 1500 bounded

# all get Stochastic Fairness:
$TC qdisc add dev $DEV parent 1:11 handle 11: sfq perturb 1
$TC qdisc add dev $DEV parent 1:13 handle 13: sfq perturb 1
$TC qdisc add dev $DEV parent 1:15 handle 15: sfq perturb 1
$TC qdisc add dev $DEV parent 1:17 handle 17: sfq perturb 1
$TC qdisc add dev $DEV parent 1:18 handle 18: sfq perturb 1


# Everythink marked with 1 by iptables is highest priority
$TC filter add dev $DEV parent 1:0 protocol ip prio 11 handle 1 fw flowid 1:11
# Everythink marked with 3 by iptables is high priority
$TC filter add dev $DEV parent 1:0 protocol ip prio 13 handle 3 fw flowid 1:13
# Everythink marked with 5 by iptables is medium priority
$TC filter add dev $DEV parent 1:0 protocol ip prio 15 handle 5 fw flowid 1:15
# Everythink marked with 7 by iptables is low priority
$TC filter add dev $DEV parent 1:0 protocol ip prio 17 handle 7 fw flowid 1:17
# rest is 'non-interactive' ie 'bulk' and ends up in 1:18
$TC filter add dev $DEV parent 1:0 protocol ip prio 18 u32 \
   match ip dst 0.0.0.0/0 flowid 1:18
#! /bin/sh

IFEXT=ppp0
#IFINT=eth1
#INTERN=192.168.1.0/24
ADDRULE="/sbin/iptables --append"

## Mark packets for QOS handling
# Firewall traffic QOS
# No need to mess with outgoing packets for every
# interface, only external interface is concerned
# match from lowest to highest prio
$ADDRULE OUTPUT -t mangle -o ! $IFEXT -j ACCEPT
# POP
$ADDRULE OUTPUT -t mangle -p tcp --dport 110 -j MARK --set-mark 5
# FTP
$ADDRULE OUTPUT -t mangle -p tcp --dport 20 -j MARK --set-mark 5
$ADDRULE OUTPUT -t mangle -p tcp --dport 21 -j MARK --set-mark 5
# WWW
$ADDRULE OUTPUT -t mangle -p tcp --dport 80 -j MARK --set-mark 3
$ADDRULE OUTPUT -t mangle -p tcp --dport 443 -j MARK --set-mark 3
# DNS
$ADDRULE OUTPUT -t mangle -p udp --dport 53 -j MARK --set-mark 1
# SSH
$ADDRULE OUTPUT -t mangle -p tcp --dport 22 -j MARK --set-mark 1
$ADDRULE OUTPUT -t mangle -p tcp --sport 22 -j MARK --set-mark 1
# PING
$ADDRULE OUTPUT -t mangle -p icmp --icmp-type echo-request -j MARK --set-mark 1

## internal systems QOS
## Don't look at non-internal traffic
#$ADDRULE PREROUTING -t mangle -i ! $IFINT -j ACCEPT
#$ADDRULE PREROUTING -t mangle -d $INTERN -j ACCEPT
## Sending mail
#$ADDRULE PREROUTING -t mangle -p tcp --dport 25 -j MARK --set-mark 7 
## FTP
#$ADDRULE PREROUTING -t mangle -p tcp --dport 20 -j MARK --set-mark 5
#$ADDRULE PREROUTING -t mangle -p tcp --dport 21 -j MARK --set-mark 5
## Web
#$ADDRULE PREROUTING -t mangle -p tcp --dport 80 -j MARK --set-mark 3
#$ADDRULE PREROUTING -t mangle -p tcp --dport 443 -j MARK --set-mark 3
## News
#$ADDRULE PREROUTING -t mangle -p tcp --dport 119 -j MARK --set-mark 3
## SSH
#$ADDRULE PREROUTING -t mangle -p tcp --dport 22 -j MARK --set-mark 1
## Ping
#$ADDRULE PREROUTING -t mangle -p icmp --icmp-type echo-request -j MARK 
--set-mark 1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]