<DIV><FONT size=2>
<P>Hi Andreas!</P>
<P>I mainly understand what you mean, I tried to fix something on the script, I don't know if I did it well.</P>
<P>Can you take another look on it please and if is wrong to make the corrections directly on it so that I see where the mistake is... </P>
<P>With this script&nbsp;I want to make limits for IP class 85.120.48.0/25 for international traffic in&nbsp;256 KBps classes and for metropolitan traffic 100 MB or approximatively.</P>
<P>Thank you!</P>
<P>&nbsp;</P>
<P>#!/bin/bash </P>
<P>### unitati de masura pt debit </P>
<P># kbps - kilobytes per second </P>
<P># mbps - megabytes per second </P>
<P># kbit - kilbits per second </P>
<P># mbit - megabits per second </P>
<P>EXT_IF="eth0" </P>
<P>INT_IF="eth1" </P>
<P>TC=/sbin/tc</P>
<P>IPTABLES=/sbin/iptables</P>
<P># RATE DOWNLOAD </P>
<P>RAD_INET_ALL="1736kbit"</P>
<P>RAD_INET_LOW="64kbit" </P>
<P>RAD_INET_HIGH="256kbit"</P>
<P></P>
<P>RAD_METRO_ALL="90mbit" </P>
<P>RAD_METRO_LOW="70mbit" </P>
<P>RAD_METRO_HIGH="80mbit" </P>
<P># RATE UPLOAD </P>
<P>RUP_INET_ALL="1536kbit" </P>
<P>RUP_INET="128kbit" </P>
<P>RUP_METRO_ALL="90mbit" </P>
<P>RUP_METRO="70mbit" </P>
<P># RATA INTRANET </P>
<P>RATE_INTRA="80mbit" </P>
<P>DEST="85.120.48.128/25 192.171.172.0/24 10.10.10.0/24 217.156.110.86/32 193.226.18.0/24" </P>
<P>if [ "$1" = "status" ] </P>
<P>then </P>
<P>clear </P>
<P>echo "* [ discipline interfata $EXT_IF ]" </P>
<P>$TC qdisc show dev $EXT_IF </P>
<P>echo "* [ disciplinele interfata $INT_IF ]" </P>
<P>$TC qdisc show dev $INT_IF </P>
<P>echo "* [ clase interfata $EXT_IF ]" </P>
<P>$TC class show dev $EXT_IF </P>
<P>echo "* [ clase interfata $INT_IF ]" </P>
<P>$TC class show dev $INT_IF </P>
<P>echo "* [ filtre interfata $EXT_IF ]" </P>
<P>$TC filter show dev $EXT_IF </P>
<P>$TC filter show dev $EXT_IF parent 1:20 </P>
<P>$TC filter show dev $EXT_IF parent 1:30 </P>
<P>echo "* [ filtre interfata $INT_IF ]" </P>
<P>$TC filter show dev $INT_IF </P>
<P>$TC filter show dev $INT_IF parent 1:20 </P>
<P>$TC filter show dev $INT_IF parent 1:30 </P>
<P>echo </P>
<P>echo "* [ marcarea traficului ]" </P>
<P>$IPTABLES -n -t mangle -L POSTROUTING </P>
<P>exit </P>
<P>fi </P>
<P>$TC qdisc delete dev $EXT_IF root 2&gt; /dev/null </P>
<P>$TC qdisc delete dev $INT_IF root 2&gt; /dev/null </P>
<P>$TC qdisc delete dev $INT_IF ingress 2&gt; /dev/null </P>
<P>$IPTABLES -t mangle -F POSTROUTING </P>
<P>if [ "$1" = "stop" ] </P>
<P>then </P>
<P>echo "[*] Managementul debitului este oprit." </P>
<P>exit </P>
<P>fi </P>
<P>### //// 1] Clasele pentru traficul metropolitan/internet pt ambele interfeşe: </P>
<P>$TC qdisc add dev $EXT_IF root handle 1: htb default 30</P>
<P>$TC class add dev $EXT_IF parent 1: classid 1:1 htb rate 100mbit</P>
<P>$TC class add dev $EXT_IF parent 1:1 classid 1:20 htb rate $RUP_METRO_ALL</P>
<P>$TC class add dev $EXT_IF parent 1:1 classid 1:30 htb rate $RUP_INET_ALL</P>
<P>$TC qdisc add dev $INT_IF root handle 1: htb default 30</P>
<P>$TC class add dev $INT_IF parent 1: classid 1:1 htb rate 100mbit</P>
<P>$TC class add dev $INT_IF parent 1:1 classid 1:20 htb rate $RAD_METRO_ALL</P>
<P>$TC class add dev $INT_IF parent 1:1 classid 1:30 htb rate $RAD_INET_ALL</P>
<P>### //// 2] Clasificarea explicita a traficului metropolitan</P>
<P>for i in $DEST; do</P>
<P>$TC filter add dev $EXT_IF parent 1: protocol ip u32 match ip dst $i flowid 1:20</P>
<P>$TC filter add dev $INT_IF parent 1: protocol ip u32 match ip src $i flowid 1:20</P>
<P>done</P>
<P>### Client 1 =&gt; #85.120.48.0/25</P>
<P># clas</FONT><FONT face="Courier New" size=2>s</FONT><FONT size=2> </P>
<P>$TC class add dev $EXT_IF parent 1:20 classid 1:21 htb rate $RUP_METRO </P>
<P>$TC class add dev $EXT_IF parent 1:30 classid 1:31 htb rate $RUP_INET </P>
<P>$TC class add dev $INT_IF parent 1:20 classid 1:21 htb rate $RAD_METRO_LOW ceil $RAD_METRO_HIGH </P>
<P>$TC class add dev $INT_IF parent 1:30 classid 1:31 htb rate $RAD_INET_LOW ceil $RAD_INET_HIGH </P>
<P>&nbsp;</P>
<P># </FONT><FONT face="Courier New" size=2>MARK</FONT><FONT size=2> </P>
<P>$IPTABLES -t mangle -A POSTROUTING -o $EXT_IF -s 85.120.48.0/25 -j MARK --set-mark 1 </P>
<P>$IPTABLES -t mangle -A POSTROUTING -o $INT_IF -d 85.120.48.0/25 -j MARK --set-mark 1 </P>
<P>&nbsp;</P>
<P># clasificare </P>
<P>$TC filter add dev $EXT_IF parent 1:20 protocol ip handle 1 fw flowid 1:21 </P>
<P>$TC filter add dev $EXT_IF parent 1:30 protocol ip handle 1 fw flowid 1:31 </P>
<P>$TC filter add dev $INT_IF parent 1:20 protocol ip handle 1 fw flowid 1:21 </P>
<P>$TC filter add dev $INT_IF parent 1:30 protocol ip handle 1 fw flowid 1:31 </P>
<P>&nbsp;</P>
<P>echo "[*] Managementul debitului este activ."</P></FONT><BR><BR><B><I>lartc-request@mailman.ds9a.nl</I></B> wrote:
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Send LARTC mailing list submissions to<BR>lartc@mailman.ds9a.nl<BR><BR>To subscribe or unsubscribe via the World Wide Web, visit<BR>http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc<BR>or, via email, send a message with subject or body 'help' to<BR>lartc-request@mailman.ds9a.nl<BR><BR>You can reach the person managing the list at<BR>lartc-owner@mailman.ds9a.nl<BR><BR>When replying, please edit your Subject line so it is more specific<BR>than "Re: Contents of LARTC digest..."<BR><BR><BR>Today's Topics:<BR><BR>1. Re: Traffic Control (Andreas Klauer)<BR>2. Re: LARTC Digest, Vol 7, Issue 6 (Gobbledegeek)<BR>3. ip route add default mpath (rr| drr|random|wrandom)... (Krzysiek)<BR><BR><BR>----------------------------------------------------------------------<BR><BR>Message: 1<BR>Date: Sun, 25 Sep 2005 12:09:52 +0200<BR>From: Andreas Klauer <ANDREAS.KLAUER@METAMORPHER.DE><BR>Subject: Re:
 [LARTC] Traffic Control<BR>To: lartc@mailman.ds9a.nl<BR>Message-ID: &lt;200509251209.52461.Andreas.Klauer@metamorpher.de&gt;<BR>Content-Type: text/plain; charset="iso-8859-15"<BR><BR>On Sunday 25 September 2005 07:37, Daniel Phlander wrote:<BR>&gt; I made a script as the attached one but it doesn't make any limit and I<BR>&gt; can't figure out what the problem is.<BR><BR>This is only a quick guess by glancing at your script, but it seems that <BR>your HTB class tree is messed up. You have 'only child' classes - a parent <BR>with only one child does not make sense, a child class needs at least one <BR>sibling. Your default/filter rules point to parent classes, which won't <BR>work. You must put packets into leaf classes. Attach filter rules to the <BR>qdisc (attaching them to classes may not work) and have them point to leaf <BR>classes (make sure the default class is a leaf class as well).<BR><BR>HTH<BR>Andreas<BR><BR><BR>------------------------------<BR><BR>Message: 2<BR>Date:
 Mon, 26 Sep 2005 12:25:34 +0530<BR>From: Gobbledegeek <GOBBLEDEGEEK@GMAIL.COM><BR>Subject: [LARTC] Re: LARTC Digest, Vol 7, Issue 6<BR>To: lartc@mailman.ds9a.nl<BR>Message-ID: &lt;463aea57050925235541c3820e@mail.gmail.com&gt;<BR>Content-Type: text/plain; charset=ISO-8859-1<BR><BR>&gt;<BR>&gt; 1. iproute2/nano-howto: dual external routing, a "virtual<BR>&gt; subnet" (/dev/rob0)<BR>&gt;<BR>&gt; Success!! I played around with this off and on all day, and now it<BR>&gt; works. I turned on /proc/sys/net/ipv4/conf/dummy0/proxy_arp (how can<BR>&gt; the interface be flagged NOARP and yet do proxy ARP?)<BR><BR>Hmm there are a few arp patches on julians pages for lvs.. read<BR>their readme's to find out how they are applicable....<BR><BR><BR>Rgrds<BR><BR><BR>------------------------------<BR><BR>Message: 3<BR>Date: 26 Sep 2005 09:56:18 +0200<BR>From: Krzysiek <SZAFOT@POCZTA.FM><BR>Subject: [LARTC] ip route add default mpath (rr|<BR>drr|random|wrandom)...<BR>To:
 lartc@mailman.ds9a.nl<BR>Message-ID: &lt;20050926075618.721CC173E66@poczta.interia.pl&gt;<BR>Content-Type: TEXT/plain; CHARSET=ISO-8859-2<BR><BR>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_MULTIPATH_CACHED=n. 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 needed at all? - They do not apply cean. The kernel is 2.6.13.<BR>This configuration does not work:<BR>CONFIG_IP_ROUTE_MULTIPATH=y<BR>CONFIG_IP_ROUTE_MULTIPATH_CACHED=y<BR>CONFIG_IP_ROUTE_MULTIPATH_RR=m<BR>CONFIG_IP_ROUTE_MULTIPATH_RANDOM=m<BR>CONFIG_IP_ROUTE_MULTIPATH_WRANDOM=m<BR>CONFIG_IP_ROUTE_MULTIPATH_DRR=m<BR><BR>How should i use these modules? ip route add 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 feature is not enebled does not report any error.<BR><BR>Krzysiek<BR><BR><BR>----------------------------------------------------------------------<BR>Sa niesamowite, zobaczysz... ;-) &gt;&gt;&gt; link http://link.interia.pl/f18b9<BR><BR><BR><BR>------------------------------<BR><BR>_______________________________________________<BR>LARTC mailing list<BR>LARTC@mailman.ds9a.nl<BR>http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc<BR><BR><BR>End of LARTC Digest, Vol 7, Issue 7<BR>***********************************<BR></BLOCKQUOTE></DIV><BR><BR>Cu respect,<br>Daniel Sandulescu<br><br>Telefon: 0722-217018  0788-656.946                                   <br>Tel/Fax: 0245-614556                           <br>E-mail : office@optinet.ro<p>
                <hr size=1>Yahoo! for Good<br> 
<a href="http://store.yahoo.com/redcross-donate3/">Click here to donate</a> to the Hurricane Katrina relief effort.