From: "Saulo Silva" Date: Sat, 09 Jun 2007 16:29:38 +0000 Subject: Re: [LARTC] CBQ + Layer7 x Emule Message-Id: <3ddff6900706090929n74449871xccd070da9b835c43@mail.gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1618422508==" List-Id: References: <3ddff6900706081026h2f2c763al9bc7b272b86cb75c@mail.gmail.com> In-Reply-To: <3ddff6900706081026h2f2c763al9bc7b272b86cb75c@mail.gmail.com> To: lartc@vger.kernel.org --===============1618422508== Content-Type: multipart/alternative; boundary="----=_Part_53677_22930747.1181406578297" ------=_Part_53677_22930747.1181406578297 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Marcos , Now works with l7 and this iptables lines . I the first email we got only 4 lines and now we have 5 . Its working nice . Thanks the help . Saulo Silva 2007/6/9, Marco Aurelio : > > from ipp2p news page > ""quote"" > > I suggest the following tcp and udp for connection tracking (see docu > section) > > 01# iptables -t mangle -A PREROUTING -p tcp -j CONNMARK --restore-mark > 02# iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEPT > 03# iptables -t mangle -A PREROUTING -p tcp -m ipp2p --ipp2p -j MARK > --set-mark 1 > 04# iptables -t mangle -A PREROUTING -p tcp -m mark --mark 1 -j > CONNMARK --save-mark > 05# iptables -t mangle -A PREROUTING -p udp -m ipp2p --ipp2p -j MARK > --set-mark 1 > > > detect TCP FIRST, SAVE MARK , and detect udp after you saved the mark !! > You will have now every p2p packet marked, but a dramtic reduce of udp > missmatches. > > ""quote"" > > On 6/8/07, Salatiel Filho wrote: > > > > > > On 6/8/07, Saulo Silva wrote: > > > HI Marcos , > > > > > > I tried your rules, but without success . Thank for that help . > > > And , how about ip2pp ? Is this application could do that ? Help me t= o > > shape edonkey traffic ??? > > > > > > Best Regards, > > > > > > Saulo Silva > > > > > > > > > 2007/6/8, Marco Aurelio : > > > > > > > l7's edonkey filter does not match all edonkey traffic, it does not > > > > match data packets (that you want to shape). It matches however the > > > > signaling packets that can be related to data connections. > > > > > > > > I never tried L7 but I think these may help you > > > > > > > > iptables -t mangle -A PREROUTING -p tcp -j CONNMARK --restore-mark > > > > iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEP= T > > > > iptables -t mangle -A PREROUTING -mlayer7 --l7proto edonkey -j MARK > > --set-mark 2 > > > > iptables -t mangle -A PREROUTING -p tcp -m mark --mark 2 -j CONNMAR= K > > --save-mark > > > > > > > > > > > > On 6/8/07, Saulo Silva < sauloaugustosilva@gmail.com> wrote: > > > > > Hi All , > > > > > > > > > > My first message and I have a little problem with my FC6 box > trying to > > block > > > > > emule traffic using layer7 . > > > > > > > > > > Here my network : > > > > > > > > > > Internet --------- ADSL Router ------------------- FC6 Box > > > > > -------------------- Emule Box > > > > > > > > > > external ADSL : Dynamic > > > > > Internal ADSL : 192.168.254.1 > > > > > > > > > > external FC6 : 192.168.254.3 > > > > > internal FC6 : 192.168.253.1 > > > > > > > > > > Emule Box : 192.168.253.3 > > > > > > > > > > I guess that everything is ok with layer7 . Here my mangle rules = . > > > > > > > > > > # iptables -t mangle -A PREROUTING -mlayer7 --l7proto edonkey -j > MARK > > > > > --set-mark 2 > > > > > # iptables -t mangle -A PREROUTING -m mark --mark 2 -j LOG > > --log-prefix > > > > > "PREROUTING MARK : " > > > > > > > > > > > > > > > iptables -t mangle -A FORWARD -mlayer7 --l7proto edonkey -j MARK > > --set-mark > > > > > 2 > > > > > iptables -t mangle -A FORWARD -m mark --mark 2 -j LOG --log-prefi= x > > "FORWARD > > > > > MARK : " > > > > > > > > > > The output from log is : > > > > > > > > > > Jun 8 14:18:46 fs-linux kernel: FORWARD MARK : IN=3Deth0 OUT=3De= th1 > > > > > SRC=3D 203.91.83.127 DST=3D192.168.253.3 LEN=3D180 TOS=3D0x00 PRE= C=3D0x00 > > TTL=3D105 > > > > > ID=3D18725 PROTO=3DTCP SPT=3D51674 DPT=3D4662 WINDOW=3D16944 RES= =3D0x00 ACK > PSH > > URGP=3D0 > > > > > > > > > > Jun 8 14:18:48 fs-linux kernel: PREROUTING MARK : IN=3Deth0 OUT= =3D > > > > > MAC=3D00:06:4f:47:ad:e0:00:0f:3d:cc:29:e0:08:00 > > > > > SRC=3D200.209.170.138 DST=3D 192.168.254.3 LEN=3D139 TOS=3D0x00 P= REC=3D0x00 > > TTL=3D115 > > > > > ID=3D18002 DF PROTO=3DTCP SPT=3D1476 DPT=3D4662 WINDOW=3D65535 RE= S=3D0x00 ACK > PSH > > URGP=3D0 > > > > > Jun 8 14:18:48 fs-linux kernel: FORWARD MARK : IN=3Deth0 OUT=3De= th1 > SRC=3D > > > > > 200.209.170.138 DST=3D 192.168.253.3 LEN=3D139 TOS=3D0x00 PREC=3D= 0x00 > TTL=3D114 > > > > > ID=3D18002 DF PROTO=3DTCP SPT=3D1476 DPT=3D4662 WINDOW=3D65535 RE= S=3D0x00 ACK > PSH > > URGP=3D0 > > > > > > > > > > Jun 8 14:18:51 fs-linux kernel: PREROUTING MARK : IN=3Deth0 OUT= =3D > > > > > MAC=3D00:06:4f:47:ad:e0:00:0f:3d:cc:29:e0:08:00 SRC=3D > > > > > 200.244.104.10 DST=3D 192.168.254.3 LEN=3D40 TOS=3D0x00 PREC=3D0x= 00 > TTL=3D117 > > ID=3D7042 > > > > > PROTO=3DTCP SPT=3D50675 DPT=3D4662 WINDOW=3D64952 RES=3D0x00 ACK = FIN URGP=3D0 > > > > > > > > > > Jun 8 14:18:51 fs-linux kernel: FORWARD MARK : IN=3Deth0 OUT=3De= th1 > SRC=3D > > > > > 200.244.104.10 DST=3D 192.168.253.3 LEN=3D40 TOS=3D0x00 PREC=3D0x= 00 > TTL=3D116 > > ID=3D7042 > > > > > PROTO=3DTCP SPT=3D50675 DPT=3D4662 WINDOW=3D64952 RES=3D0x00 ACK = FIN URGP=3D0 > > > > > > > > > > So it's look like mark is working . > > > > > > > > > > So now I use the cbq.init script with that configuration : > > > > > > > > > > cat /etc/sysconfig/cbq/cbq- 0002.emule_in > > > > > > > > > > DEVICE=3Deth0,100Mbit,10Mbit > > > > > RATE=3D3Kbit > > > > > WEIGHT=3D1Kbit > > > > > PRIO=3D5 > > > > > BOUNDED=3Dyes > > > > > ISOLATED=3Dyes > > > > > MARK=3D2 > > > > > > > > > > cat /etc/sysconfig/cbq/cbq-0002.emule_out > > > > > DEVICE=3Deth1,100Mbit,10Mbit > > > > > RATE=3D3Kbit > > > > > WEIGHT=3D1Kbit > > > > > PRIO=3D5 > > > > > BOUNDED=3Dyes > > > > > ISOLATED=3Dyes > > > > > MARK=3D2 > > > > > > > > > > that generate this tc codes . > > > > > > > > > > /sbin/tc qdisc add dev eth0 root handle 1 cbq bandwidth 100Mbit > avpkt > > 3000 > > > > > cell 8 > > > > > /sbin/tc class change dev eth0 root cbq weight 10Mbit allot 1514 > > > > > > > > > > /sbin/tc qdisc del dev eth1 root > > > > > /sbin/tc qdisc add dev eth1 root handle 1 cbq bandwidth 100Mbit > avpkt > > 3000 > > > > > cell 8 > > > > > /sbin/tc class change dev eth1 root cbq weight 10Mbit allot 1514 > > > > > > > > > > /sbin/tc class add dev eth0 parent 1: classid 1:2 cbq bandwidth > > 100Mbit rate > > > > > 3Kbit weight 1Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 300= 0 > > bounded > > > > > isolated > > > > > /sbin/tc qdisc add dev eth0 parent 1:2 handle 2 tbf rate 3Kbit > buffer > > 10Kb/8 > > > > > limit 15Kb mtu 1500 > > > > > /sbin/tc filter add dev eth0 parent 1:0 protocol ip prio 200 > handle 2 > > fw > > > > > classid 1:2 > > > > > > > > > > /sbin/tc class add dev eth1 parent 1: classid 1:2 cbq bandwidth > > 100Mbit rate > > > > > 3Kbit weight 1Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 300= 0 > > bounded > > > > > isolated > > > > > /sbin/tc qdisc add dev eth1 parent 1:2 handle 2 tbf rate 3Kbit > buffer > > 10Kb/8 > > > > > limit 15Kb mtu 1500 > > > > > /sbin/tc filter add dev eth1 parent 1:0 protocol ip prio 200 > handle 2 > > fw > > > > > classid 1:2 > > > > > > > > > > Can anyone explain me what is wrong . Why I cannot shape this > traffic > > ???? > > > > > > > > > > Any help will be appreciated . > > > > > > > > > > Best Regards , > > > > > > > > > > Saulo Silva > > > > > > > > > > _______________________________________________ > > > > > LARTC mailing list > > > > > LARTC@mailman.ds9a.nl > > > > > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc > > > > > > > > > > > > > > > > > > > > > > -- > > > > Marco Casaroli > > > > SapucaiNet Telecom > > > > +55 35 34712377 ext 5 > > > > > > > > > > > > > _______________________________________________ > > > LARTC mailing list > > > LARTC@mailman.ds9a.nl > > > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc > > > > > > > > I block all P2P traffic with ipp2p , it works great. > > iptables -t mangle -i eth0 -A FORWARD -m ipp2p --ipp2p -j DROP > > > > > > -- > > []'s > > Salatiel > > > > "O maior prazer do inteligente =E9 bancar o idiota > > diante de um idiota que banca o inteligente". > > > -- > Marco Casaroli > SapucaiNet Telecom > +55 35 34712377 ext 5 > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc > ------=_Part_53677_22930747.1181406578297 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Marcos ,


Now works with l7 and this iptables lines . I the f= irst email we got only 4 lines and now we have 5 . Its working  nice .=

Thanks the help .

Saulo Silva

2007/6/9, Marco Aurelio <mar= co.casaroli@gmail.com>:
from ipp2p news page
""quote""

I suggest the = following tcp and udp for connection tracking (see docu section)

01#= iptables -t mangle -A PREROUTING -p tcp -j CONNMARK --restore-mark
02# iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEPT03# iptables -t mangle -A PREROUTING -p tcp -m ipp2p --ipp2p -j MARK
--= set-mark 1
04# iptables -t mangle -A PREROUTING -p tcp -m mark --mark 1 = -j
CONNMARK --save-mark
05# iptables -t mangle -A PREROUTING -p udp -m = ipp2p --ipp2p -j MARK
--set-mark 1


detect TCP FIRST, SAVE MAR= K , and detect udp after you saved the mark !!
You will have now every p= 2p packet marked, but a dramtic reduce of udp
missmatches.

""quote""

On 6/8/07, Sal= atiel Filho <salatiel.filho@= gmail.com> wrote:
>
>
> On 6/8/07, Saulo Silva <= ; sauloaugustosilva@gmail.com<= /a>> wrote:
> > HI Marcos ,
> >
> > I tried y= our rules,  but without success  . Thank for that help = .
> > And , how about ip2pp ? Is this application could do that ? = Help me to
> shape edonkey traffic ???
> >
> > Best Regards,<= br>> >
> > Saulo Silva
> >
> >
> >= ; 2007/6/8, Marco Aurelio <
marco.casaroli@gmail.com>:
> >
> > > l7's e= donkey filter does not match all edonkey traffic, it does not
> > = > match data packets (that you want to shape). It matches however the
> > > signaling packets that can be related to data connection= s.
> > >
> > > I never tried L7 but I think these m= ay help you
> > >
> > > iptables -t mangle -A PRERO= UTING -p tcp -j CONNMARK --restore-mark
> > > iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark= 0 -j ACCEPT
> > > iptables -t mangle -A PREROUTING -mlayer7 --= l7proto edonkey -j MARK
> --set-mark 2
> > > iptables -t = mangle -A PREROUTING -p tcp -m mark --mark 2 -j CONNMARK
> --save-mark
> > >
> > >
> > > = On 6/8/07, Saulo Silva < = sauloaugustosilva@gmail.com> wrote:
> > > > Hi All ,
> > > >
> > > > My first message and I have = a little problem with my FC6 box trying to
> block
> > > = > emule traffic using layer7 .
> > > >
> > > = > Here my network :
> > > >
> > > > Internet --------- &nbs= p; ADSL  Router ------------------- FC6  Box
> &g= t; > > --------------------   Emule Box
> > > &= gt;
> > > > external ADSL : Dynamic
> > > > Internal ADSL  : 192.168.254.1
> > > >
> > > > ex= ternal FC6  : 192.168.254.3<= br>> > > > internal FC6 :=20 192.168.253.1
> > > >> > > > Emule Box : 192.168.= 253.3
> > > >
> > > > I guess that everyt= hing is ok with layer7 . Here my mangle rules .
> > > >
> > > > # iptables -t mangle -A PRER= OUTING -mlayer7 --l7proto edonkey -j MARK
> > > > --set-mark= 2
> > > > # iptables -t mangle -A PREROUTING -m mark --mark= 2 -j LOG
> --log-prefix
> > > > "PREROUTING MARK : "=
> > > >
> > > >
> > > > iptab= les -t mangle -A FORWARD -mlayer7 --l7proto edonkey -j MARK
> --set-m= ark
> > > > 2
> > > > iptables -t mangle -A FORW= ARD -m mark --mark 2 -j LOG --log-prefix
> "FORWARD
> >= > > MARK : "
> > > >
> > > > The = output from log is :
> > > >
> > > > Jun  8 14:18:46 fs= -linux kernel: FORWARD MARK : IN=3Deth0 OUT=3Deth1
> > > > S= RC=3D 203.91.83.127 DST=3D 192.168.253.3 LEN=3D180 TOS=3D0x00 PREC=3D0x00
> TTL=3D105
>= ; > > > ID=3D18725 PROTO=3DTCP SPT=3D51674 DPT=3D4662 WINDOW=3D169= 44 RES=3D0x00 ACK PSH
> URGP=3D0
> > > >
> > = > > Jun  8 14:18:48 fs-linux kernel: PREROUTING MARK : IN= =3Deth0 OUT=3D
> > > > MAC=3D00:06:4f:47:ad:e0:00:0f:3d:cc:29:e0:08:00
= > > > > SRC=3D200.209.170.13= 8 DST=3D 192.168.254.3 LEN=3D139 T= OS=3D0x00 PREC=3D0x00
> TTL=3D115
> > > > ID=3D18002 DF PROTO=3DTCP SPT=3D1= 476 DPT=3D4662 WINDOW=3D65535 RES=3D0x00 ACK PSH
> URGP=3D0
> &= gt; > > Jun  8 14:18:48 fs-linux kernel: FORWARD MARK : IN= =3Deth0 OUT=3Deth1 SRC=3D
> > > > 200.209.170.138 = DST=3D 192.168.253.3 LEN=3D139 TOS=3D0= x00 PREC=3D0x00 TTL=3D114
> > > > ID=3D18002 DF PROTO=3DTCP = SPT=3D1476 DPT=3D4662 WINDOW=3D65535 RES=3D0x00 ACK PSH
> URGP=3D0
> > > >
> > > > Jun &n= bsp;8 14:18:51 fs-linux kernel: PREROUTING MARK : IN=3Deth0 OUT=3D
> = > > > MAC=3D00:06:4f:47:ad:e0:00:0f:3d:cc:29:e0:08:00 SRC=3D
&g= t; > > >=20 200.244.104.10 DST=3D 192.168.254.3 LEN=3D40 TOS=3D0x00 PREC=3D0x00 TTL=3D1= 17
> ID=3D7042
> > > > PROTO=3DTCP SPT=3D50675 DPT=3D4= 662 WINDOW=3D64952 RES=3D0x00 ACK FIN URGP=3D0
> > > >
> > > > Jun  8 14:18:51 fs= -linux kernel: FORWARD MARK : IN=3Deth0 OUT=3Deth1 SRC=3D
> > >= > 200.244.104.10 DST=3D 192.168.253.3 LEN=3D40 TOS=3D0x00 PREC=3D0x00 TTL=3D116
> ID=3D70= 42
> > > > PROTO=3DTCP SPT=3D50675 DPT=3D4662 WINDOW=3D64952= RES=3D0x00 ACK FIN URGP=3D0
> > > >
> > > > = So it's look like mark is working .
> > > >
> > > > So now I use the cbq.init sc= ript with that configuration :
> > > >
> > > >= ; cat /etc/sysconfig/cbq/cbq- 0002.emule_in
> > > >
> = > > > DEVICE=3Deth0,100Mbit,10Mbit
> > > > RATE=3D3Kbit
> > > > WEIGHT=3D1Kbit<= br>> > > > PRIO=3D5
> > > > BOUNDED=3Dyes
>= ; > > > ISOLATED=3Dyes
> > > > MARK=3D2
> >= ; > >
> > > > cat /etc/sysconfig/cbq/cbq-0002.emule_out
> &= gt; > > DEVICE=3Deth1,100Mbit,10Mbit
> > > > RATE=3D3K= bit
> > > > WEIGHT=3D1Kbit
> > > > PRIO=3D5> > > > BOUNDED=3Dyes
> > > > ISOLATED=3Dyes
> > > > MARK=3D2
&= gt; > > >
> > > > that generate this tc codes .
= > > > >
> > > > /sbin/tc qdisc add dev eth0 root= handle 1 cbq bandwidth 100Mbit avpkt
> 3000
> > > > cell 8
> > > > /sbin/tc= class change dev eth0 root cbq weight 10Mbit allot 1514
> > > = >
> > > > /sbin/tc qdisc del dev eth1 root
> > &= gt; > /sbin/tc qdisc add dev eth1 root handle 1 cbq bandwidth 100Mbit av= pkt
> 3000
> > > > cell 8
> > > > /sbin/tc= class change dev eth1 root cbq weight 10Mbit allot 1514
> > > = >
> > > > /sbin/tc class add dev eth0 parent 1: classid 1= :2 cbq bandwidth
> 100Mbit rate
> > > > 3Kbit weight 1Kbit prio 5 allo= t 1514 cell 8 maxburst 20 avpkt 3000
> bounded
> > > >= isolated
> > > > /sbin/tc qdisc add dev eth0 parent 1:2 han= dle 2 tbf rate 3Kbit buffer
> 10Kb/8
> > > > limit 15Kb mtu 1500
> > >= ; > /sbin/tc filter add dev eth0 parent 1:0 protocol ip prio 200 handle = 2
> fw
> > > > classid 1:2
> > > >
> > > > /sbin/tc class add dev eth1 parent 1: classid 1:2 cbq b= andwidth
> 100Mbit rate
> > > > 3Kbit weight 1Kbit pri= o 5 allot 1514 cell 8 maxburst 20 avpkt 3000
> bounded
> > &= gt; > isolated
> > > > /sbin/tc qdisc add dev eth1 parent 1:2 handle 2 tbf= rate 3Kbit buffer
> 10Kb/8
> > > > limit 15Kb mtu 150= 0
> > > > /sbin/tc filter add dev eth1 parent 1:0 protocol i= p prio 200 handle 2
> fw
> > > > classid 1:2
> > > >
&g= t; > > > Can anyone explain me what is wrong . Why I cannot shape = this traffic
> ????
> > > >
> > > > Any= help will be appreciated .
> > > >
> > > > Best Regards ,
> > = > >
> > > > Saulo Silva
> > > >
>= > > > _______________________________________________
> >= ; > > LARTC mailing list
> > > > LARTC@mail= man.ds9a.nl
> > > > http://mailman.ds9a.nl/cgi-bin/mailman/listin= fo/lartc
> > > >
> > > >
> > >
>= ; > >
> > > --
> > > Marco Casaroli
> &= gt; > SapucaiNet Telecom
> > > +55 35 34712377 ext 5
> > >
> >
> >
> > _____________________= __________________________
> > LARTC mailing list
> > LARTC@mailman.ds9a.nl
> >= ;=20 http://ma= ilman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
> >
> ><= br>> I block all P2P traffic with ipp2p , it works great.
> iptabl= es  -t mangle -i eth0 -A FORWARD -m ipp2p --ipp2p -j DROP
>
>
> --
> []'s
> Salatiel
>
&g= t; "O maior prazer do inteligente =E9 bancar o  idiota
&g= t;    diante de um  idiota que banca o inteli= gente".


--
Marco Casaroli
SapucaiNet Telecom
+55 35 34712377 ext 5
________________________= _______________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
<= /div>
------=_Part_53677_22930747.1181406578297-- --===============1618422508== 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 --===============1618422508==--