From: Daniel Phlander Date: Sat, 01 Oct 2005 12:50:54 +0000 Subject: [LARTC] Re: RE: Control Traffic Message-Id: <20051001125054.84506.qmail@web32406.mail.mud.yahoo.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0687920690==" List-Id: To: lartc@vger.kernel.org --===============0687920690== Content-Type: multipart/alternative; boundary="0-2093877315-1128171054=:81091" Content-Transfer-Encoding: 8bit --0-2093877315-1128171054=:81091 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Andreas! I mainly understand what you mean, I tried to fix something on the script, = I don't know if I did it well. Can you take another look on it please and if is wrong to make the correcti= ons directly on it so that I see where the mistake is...=20 With this script I want to make limits for IP class 85.120.48.0/25 for inte= rnational traffic in 256 KBps classes and for metropolitan traffic 100 MB o= r approximatively. Thank you! =20 #!/bin/bash=20 ### unitati de masura pt debit=20 # kbps - kilobytes per second=20 # mbps - megabytes per second=20 # kbit - kilbits per second=20 # mbit - megabits per second=20 EXT_IF=3D"eth0"=20 INT_IF=3D"eth1"=20 TC=3D/sbin/tc IPTABLES=3D/sbin/iptables # RATE DOWNLOAD=20 RAD_INET_ALL=3D"1736kbit" RAD_INET_LOW=3D"64kbit"=20 RAD_INET_HIGH=3D"256kbit" RAD_METRO_ALL=3D"90mbit"=20 RAD_METRO_LOW=3D"70mbit"=20 RAD_METRO_HIGH=3D"80mbit"=20 # RATE UPLOAD=20 RUP_INET_ALL=3D"1536kbit"=20 RUP_INET=3D"128kbit"=20 RUP_METRO_ALL=3D"90mbit"=20 RUP_METRO=3D"70mbit"=20 # RATA INTRANET=20 RATE_INTRA=3D"80mbit"=20 DEST=3D"85.120.48.128/25 192.171.172.0/24 10.10.10.0/24 217.156.110.86/32 1= 93.226.18.0/24"=20 if [ "$1" =3D "status" ]=20 then=20 clear=20 echo "* [ discipline interfata $EXT_IF ]"=20 $TC qdisc show dev $EXT_IF=20 echo "* [ disciplinele interfata $INT_IF ]"=20 $TC qdisc show dev $INT_IF=20 echo "* [ clase interfata $EXT_IF ]"=20 $TC class show dev $EXT_IF=20 echo "* [ clase interfata $INT_IF ]"=20 $TC class show dev $INT_IF=20 echo "* [ filtre interfata $EXT_IF ]"=20 $TC filter show dev $EXT_IF=20 $TC filter show dev $EXT_IF parent 1:20=20 $TC filter show dev $EXT_IF parent 1:30=20 echo "* [ filtre interfata $INT_IF ]"=20 $TC filter show dev $INT_IF=20 $TC filter show dev $INT_IF parent 1:20=20 $TC filter show dev $INT_IF parent 1:30=20 echo=20 echo "* [ marcarea traficului ]"=20 $IPTABLES -n -t mangle -L POSTROUTING=20 exit=20 fi=20 $TC qdisc delete dev $EXT_IF root 2> /dev/null=20 $TC qdisc delete dev $INT_IF root 2> /dev/null=20 $TC qdisc delete dev $INT_IF ingress 2> /dev/null=20 $IPTABLES -t mangle -F POSTROUTING=20 if [ "$1" =3D "stop" ]=20 then=20 echo "[*] Managementul debitului este oprit."=20 exit=20 fi=20 ### //// 1] Clasele pentru traficul metropolitan/internet pt ambele interfe= =FEe:=20 $TC qdisc add dev $EXT_IF root handle 1: htb default 30 $TC class add dev $EXT_IF parent 1: classid 1:1 htb rate 100mbit $TC class add dev $EXT_IF parent 1:1 classid 1:20 htb rate $RUP_METRO_ALL $TC class add dev $EXT_IF parent 1:1 classid 1:30 htb rate $RUP_INET_ALL $TC qdisc add dev $INT_IF root handle 1: htb default 30 $TC class add dev $INT_IF parent 1: classid 1:1 htb rate 100mbit $TC class add dev $INT_IF parent 1:1 classid 1:20 htb rate $RAD_METRO_ALL $TC class add dev $INT_IF parent 1:1 classid 1:30 htb rate $RAD_INET_ALL ### //// 2] Clasificarea explicita a traficului metropolitan for i in $DEST; do $TC filter add dev $EXT_IF parent 1: protocol ip u32 match ip dst $i flowid= 1:20 $TC filter add dev $INT_IF parent 1: protocol ip u32 match ip src $i flowid= 1:20 done ### Client 1 =3D> #85.120.48.0/25 # class=20 $TC class add dev $EXT_IF parent 1:20 classid 1:21 htb rate $RUP_METRO=20 $TC class add dev $EXT_IF parent 1:30 classid 1:31 htb rate $RUP_INET=20 $TC class add dev $INT_IF parent 1:20 classid 1:21 htb rate $RAD_METRO_LOW = ceil $RAD_METRO_HIGH=20 $TC class add dev $INT_IF parent 1:30 classid 1:31 htb rate $RAD_INET_LOW c= eil $RAD_INET_HIGH=20 =20 # MARK=20 $IPTABLES -t mangle -A POSTROUTING -o $EXT_IF -s 85.120.48.0/25 -j MARK --s= et-mark 1=20 $IPTABLES -t mangle -A POSTROUTING -o $INT_IF -d 85.120.48.0/25 -j MARK --s= et-mark 1=20 =20 # clasificare=20 $TC filter add dev $EXT_IF parent 1:20 protocol ip handle 1 fw flowid 1:21 = $TC filter add dev $EXT_IF parent 1:30 protocol ip handle 1 fw flowid 1:31 = $TC filter add dev $INT_IF parent 1:20 protocol ip handle 1 fw flowid 1:21 = $TC filter add dev $INT_IF parent 1:30 protocol ip handle 1 fw flowid 1:31 = =20 echo "[*] Managementul debitului este activ." lartc-request@mailman.ds9a.nl wrote:Send LARTC mailing list submissions to lartc@mailman.ds9a.nl To subscribe or unsubscribe via the World Wide Web, visit http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc or, via email, send a message with subject or body 'help' to lartc-request@mailman.ds9a.nl You can reach the person managing the list at lartc-owner@mailman.ds9a.nl When replying, please edit your Subject line so it is more specific than "Re: Contents of LARTC digest..." Today's Topics: 1. Re: Traffic Control (Andreas Klauer) 2. Re: LARTC Digest, Vol 7, Issue 6 (Gobbledegeek) 3. ip route add default mpath (rr| drr|random|wrandom)... (Krzysiek) ---------------------------------------------------------------------- Message: 1 Date: Sun, 25 Sep 2005 12:09:52 +0200 From: Andreas Klauer=20 Subject: Re: [LARTC] Traffic Control To: lartc@mailman.ds9a.nl Message-ID: <200509251209.52461.Andreas.Klauer@metamorpher.de> Content-Type: text/plain; charset=3D"iso-8859-15" On Sunday 25 September 2005 07:37, Daniel Phlander wrote: > I made a script as the attached one but it doesn't make any limit and I > can't figure out what the problem is. This is only a quick guess by glancing at your script, but it seems that=20 your HTB class tree is messed up. You have 'only child' classes - a parent = with only one child does not make sense, a child class needs at least one=20 sibling. Your default/filter rules point to parent classes, which won't=20 work. You must put packets into leaf classes. Attach filter rules to the=20 qdisc (attaching them to classes may not work) and have them point to leaf = classes (make sure the default class is a leaf class as well). HTH Andreas ------------------------------ Message: 2 Date: Mon, 26 Sep 2005 12:25:34 +0530 From: Gobbledegeek=20 Subject: [LARTC] Re: LARTC Digest, Vol 7, Issue 6 To: lartc@mailman.ds9a.nl Message-ID: <463aea57050925235541c3820e@mail.gmail.com> Content-Type: text/plain; charset=3DISO-8859-1 > > 1. iproute2/nano-howto: dual external routing, a "virtual > subnet" (/dev/rob0) > > Success!! I played around with this off and on all day, and now it > works. I turned on /proc/sys/net/ipv4/conf/dummy0/proxy_arp (how can > the interface be flagged NOARP and yet do proxy ARP?) Hmm there are a few arp patches on julians pages for lvs.. read their readme's to find out how they are applicable.... Rgrds ------------------------------ Message: 3 Date: 26 Sep 2005 09:56:18 +0200 From: Krzysiek=20 Subject: [LARTC] ip route add default mpath (rr| drr|random|wrandom)... To: lartc@mailman.ds9a.nl Message-ID: <20050926075618.721CC173E66@poczta.interia.pl> Content-Type: TEXT/plain; CHARSET=3DISO-8859-2 Anyone using it? I've tried but after about 5 min I always get kernel panic= . My setup is based on nano.txt. I works well but only if CONFIG_IP_ROUTE_M= ULTIPATH_CACHED=3Dn. I just wanted to play with the new mpath feature of ip= . But enabling CONFIG_IP_ROUTE_MULTIPATH_CACHED always resuts in kernel pan= ic. I'm not using any kernel patches from http://www.ssi.bg/~ja/ - are they= needed at all? - They do not apply cean. The kernel is 2.6.13. This configuration does not work: CONFIG_IP_ROUTE_MULTIPATH=3Dy CONFIG_IP_ROUTE_MULTIPATH_CACHED=3Dy CONFIG_IP_ROUTE_MULTIPATH_RR=3Dm CONFIG_IP_ROUTE_MULTIPATH_RANDOM=3Dm CONFIG_IP_ROUTE_MULTIPATH_WRANDOM=3Dm CONFIG_IP_ROUTE_MULTIPATH_DRR=3Dm How should i use these modules? ip route add default mpath (rr| drr|random|= wrandom)... does not load the appropriate module automatically. Loading the= m manualy changes nothing. And issuing this command on kernel where this fe= ature is not enebled does not report any error. Krzysiek ---------------------------------------------------------------------- Sa niesamowite, zobaczysz... ;-) >>> link http://link.interia.pl/f18b9 ------------------------------ _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc End of LARTC Digest, Vol 7, Issue 7 *********************************** Cu respect, Daniel Sandulescu Telefon: 0722-217018 0788-656.946 =20 Tel/Fax: 0245-614556 =20 E-mail : office@optinet.ro =09 --------------------------------- Yahoo! for Good Click here to donate to the Hurricane Katrina relief effort.=20 --0-2093877315-1128171054=:81091 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi Andreas!

I mainly understand what you mean, I tried to fix something on the scrip= t, I don't know if I did it well.

Can you take another look on it please and if is wrong to make the corre= ctions directly on it so that I see where the mistake is...

With this script I want to make limits for IP class 85.120.48.0/25 = for international traffic in 256 KBps classes and for metropolitan tra= ffic 100 MB or approximatively.

Thank you!

 

#!/bin/bash

### unitati de masura pt debit

# kbps - kilobytes per second

# mbps - megabytes per second

# kbit - kilbits per second

# mbit - megabits per second

EXT_IF=3D"eth0"

INT_IF=3D"eth1"

TC=3D/sbin/tc

IPTABLES=3D/sbin/iptables

# RATE DOWNLOAD

RAD_INET_ALL=3D"1736kbit"

RAD_INET_LOW=3D"64kbit"

RAD_INET_HIGH=3D"256kbit"

RAD_METRO_ALL=3D"90mbit"

RAD_METRO_LOW=3D"70mbit"

RAD_METRO_HIGH=3D"80mbit"

# RATE UPLOAD

RUP_INET_ALL=3D"1536kbit"

RUP_INET=3D"128kbit"

RUP_METRO_ALL=3D"90mbit"

RUP_METRO=3D"70mbit"

# RATA INTRANET

RATE_INTRA=3D"80mbit"

DEST=3D"85.120.48.128/25 192.171.172.0/24 10.10.10.0/24 217.156.110.86/3= 2 193.226.18.0/24"

if [ "$1" =3D "status" ]

then

clear

echo "* [ discipline interfata $EXT_IF ]"

$TC qdisc show dev $EXT_IF

echo "* [ disciplinele interfata $INT_IF ]"

$TC qdisc show dev $INT_IF

echo "* [ clase interfata $EXT_IF ]"

$TC class show dev $EXT_IF

echo "* [ clase interfata $INT_IF ]"

$TC class show dev $INT_IF

echo "* [ filtre interfata $EXT_IF ]"

$TC filter show dev $EXT_IF

$TC filter show dev $EXT_IF parent 1:20

$TC filter show dev $EXT_IF parent 1:30

echo "* [ filtre interfata $INT_IF ]"

$TC filter show dev $INT_IF

$TC filter show dev $INT_IF parent 1:20

$TC filter show dev $INT_IF parent 1:30

echo

echo "* [ marcarea traficului ]"

$IPTABLES -n -t mangle -L POSTROUTING

exit

fi

$TC qdisc delete dev $EXT_IF root 2> /dev/null

$TC qdisc delete dev $INT_IF root 2> /dev/null

$TC qdisc delete dev $INT_IF ingress 2> /dev/null

$IPTABLES -t mangle -F POSTROUTING

if [ "$1" =3D "stop" ]

then

echo "[*] Managementul debitului este oprit."

exit

fi

### //// 1] Clasele pentru traficul metropolitan/internet pt ambele inte= rfe=FEe:

$TC qdisc add dev $EXT_IF root handle 1: htb default 30

$TC class add dev $EXT_IF parent 1: classid 1:1 htb rate 100mbit

$TC class add dev $EXT_IF parent 1:1 classid 1:20 htb rate $RUP_METRO_AL= L

$TC class add dev $EXT_IF parent 1:1 classid 1:30 htb rate $RUP_INET_ALL=

$TC qdisc add dev $INT_IF root handle 1: htb default 30

$TC class add dev $INT_IF parent 1: classid 1:1 htb rate 100mbit

$TC class add dev $INT_IF parent 1:1 classid 1:20 htb rate $RAD_METRO_AL= L

$TC class add dev $INT_IF parent 1:1 classid 1:30 htb rate $RAD_INET_ALL=

### //// 2] Clasificarea explicita a traficului metropolitan

for i in $DEST; do

$TC filter add dev $EXT_IF parent 1: protocol ip u32 match ip dst $i flo= wid 1:20

$TC filter add dev $INT_IF parent 1: protocol ip u32 match ip src $i flo= wid 1:20

done

### Client 1 =3D> #85.120.48.0/25

# class=

$TC class add dev $EXT_IF parent 1:20 classid 1:21 htb rate $RUP_METRO <= /P>

$TC class add dev $EXT_IF parent 1:30 classid 1:31 htb rate $RUP_INET

$TC class add dev $INT_IF parent 1:20 classid 1:21 htb rate $RAD_METRO_L= OW ceil $RAD_METRO_HIGH

$TC class add dev $INT_IF parent 1:30 classid 1:31 htb rate $RAD_INET_LO= W ceil $RAD_INET_HIGH

 

# MARK =

$IPTABLES -t mangle -A POSTROUTING -o $EXT_IF -s 85.120.48.0/25 -j MARK = --set-mark 1

$IPTABLES -t mangle -A POSTROUTING -o $INT_IF -d 85.120.48.0/25 -j MARK = --set-mark 1

 

# clasificare

$TC filter add dev $EXT_IF parent 1:20 protocol ip handle 1 fw flowid 1:= 21

$TC filter add dev $EXT_IF parent 1:30 protocol ip handle 1 fw flowid 1:= 31

$TC filter add dev $INT_IF parent 1:20 protocol ip handle 1 fw flowid 1:= 21

$TC filter add dev $INT_IF parent 1:30 protocol ip handle 1 fw flowid 1:= 31

 

echo "[*] Managementul debitului este activ."



la= rtc-request@mailman.ds9a.nl wrote:
Send LARTC mailing list submissions to
lar= tc@mailman.ds9a.nl

To subscribe or unsubscribe via the World Wide We= b, visit
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
or, vi= a email, send a message with subject or body 'help' to
lartc-request@mai= lman.ds9a.nl

You can reach the person managing the list at
lartc-= owner@mailman.ds9a.nl

When replying, please edit your Subject line s= o it is more specific
than "Re: Contents of LARTC digest..."


= Today's Topics:

1. Re: Traffic Control (Andreas Klauer)
2. Re: LA= RTC Digest, Vol 7, Issue 6 (Gobbledegeek)
3. ip route add default mpath = (rr| drr|random|wrandom)... (Krzysiek)


-------------------------= ---------------------------------------------

Message: 1
Date: Su= n, 25 Sep 2005 12:09:52 +0200
From: Andreas Klauer
Subject: Re: [LARTC] Traffic Control
To: lartc@mailman.ds9a.nl
Message-ID: <20= 0509251209.52461.Andreas.Klauer@metamorpher.de>
Content-Type: text/pl= ain; charset=3D"iso-8859-15"

On Sunday 25 September 2005 07:37, Dani= el Phlander wrote:
> I made a script as the attached one but it doesn= 't make any limit and I
> can't figure out what the problem is.
This is only a quick guess by glancing at your script, but it seems that =
your HTB class tree is messed up. You have 'only child' classes - a par= ent
with only one child does not make sense, a child class needs at lea= st one
sibling. Your default/filter rules point to parent classes, whic= h won't
work. You must put packets into leaf classes. Attach filter rul= es to the
qdisc (attaching them to classes may not work) and have them = point to leaf
classes (make sure the default class is a leaf class as w= ell).

HTH
Andreas


------------------------------
Message: 2
Date: Mon, 26 Sep 2005 12:25:34 +0530
From: Gobbledegeek
Subject: [LARTC] Re: LARTC Digest, Vol 7, Issue 6
To: lartc@mail= man.ds9a.nl
Message-ID: <463aea57050925235541c3820e@mail.gmail.com>= ;
Content-Type: text/plain; charset=3DISO-8859-1

>
> 1. = iproute2/nano-howto: dual external routing, a "virtual
> subnet" (/de= v/rob0)
>
> Success!! I played around with this off and on all = day, and now it
> works. I turned on /proc/sys/net/ipv4/conf/dummy0/p= roxy_arp (how can
> the interface be flagged NOARP and yet do proxy A= RP?)

Hmm there are a few arp patches on julians pages for lvs.. read=
their readme's to find out how they are applicable....


Rgrds=


------------------------------

Message: 3
Date: 26 Se= p 2005 09:56:18 +0200
From: Krzysiek
Subject: [LAR= TC] ip route add default mpath (rr|
drr|random|wrandom)...
To: lartc@mailman.ds9a.nl
Message-ID: <20050926075618.721CC173E66@poczta= .interia.pl>
Content-Type: TEXT/plain; CHARSET=3DISO-8859-2

An= yone using it? I've tried but after about 5 min I always get kernel panic. = My setup is based on nano.txt. I works well but only if CONFIG_IP_ROUTE_MUL= TIPATH_CACHED=3Dn. I just wanted to play with the new mpath feature of ip. = But enabling CONFIG_IP_ROUTE_MULTIPATH_CACHED always resuts in kernel panic= . I'm not using any kernel patches from http://www.ssi.bg/~ja/ - are they n= eeded at all? - They do not apply cean. The kernel is 2.6.13.
This confi= guration does not work:
CONFIG_IP_ROUTE_MULTIPATH=3Dy
CONFIG_IP_ROUTE= _MULTIPATH_CACHED=3Dy
CONFIG_IP_ROUTE_MULTIPATH_RR=3Dm
CONFIG_IP_ROUT= E_MULTIPATH_RANDOM=3Dm
CONFIG_IP_ROUTE_MULTIPATH_WRANDOM=3Dm
CONFIG_I= P_ROUTE_MULTIPATH_DRR=3Dm

How should i use these modules? ip route a= dd default mpath (rr| drr|random|wrandom)... does not load the appropriate = module automatically. Loading them manualy changes nothing. And issuing this command on kernel where this fea= ture is not enebled does not report any error.

Krzysiek


-= ---------------------------------------------------------------------
Sa= niesamowite, zobaczysz... ;-) >>> link http://link.interia.pl/f18= b9



------------------------------

___________________= ____________________________
LARTC mailing list
LARTC@mailman.ds9a.nl=
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc


End of= LARTC Digest, Vol 7, Issue 7
***********************************


Cu respect,
Daniel Sandulescu

Telefon: 07= 22-217018 0788-656.946
Tel/Fax: 0245-614556
E-mail : of= fice@optinet.ro


Yahoo! for Good
=20 Click here to donate to the Hurricane Katrina relief effort.=20 --0-2093877315-1128171054=:81091-- --===============0687920690== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============0687920690==--