From: =?koi8-r?Q?=F0=CF=CB=CF=D4=C9=CC=C5=CE=CB=CF_?= =?koi8-r?Q?=EB=CF=D3=D4=C9=CB?= Subject: RE: General question about chains Date: Fri, 17 Oct 2008 11:40:17 +0300 Message-ID: <1224232817.4187.12.camel@casper.meteor.dp.ua> References: <001501c92f41$d380c0a0$7a8241e0$@net> <1224163165.3999.7.camel@grateful.d.umn.edu> <000a01c92fdc$e5776ed0$b0664c70$@net> Reply-To: casper@meteor.dp.ua Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <000a01c92fdc$e5776ed0$b0664c70$@net> Sender: netfilter-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="koi8-r" To: Joey Cc: IPTables =F7 =FE=D4=D7, 16/10/2008 =D7 18:16 -0400, Joey =D0=C9=DB=C5=D4: > > -----Original Message----- > > From: Matt Zagrabelny [mailto:mzagrabe@d.umn.edu] > > Sent: Thursday, October 16, 2008 9:19 AM > > To: Joey > > Cc: netfilter@vger.kernel.org > > Subject: Re: General question about chains > >=20 > > # create the chain > > iptables -N CIDR-ASIAN > >=20 > > # hook the chain into another chain (PREROUTING, INPUT, FORWARD, et= c) > iptables > > -A INPUT -j CIDR-ASIAN > >=20 > > # add rules to the new chain > > iptables -A CIDR-ASIAN -p tcp -s 118.242.0.0/16 -j LOG --log-prefix= SPAM- > > BLOCK-CIDR-ASIAN > >=20 > > iptables -A CIDR-ASIAN -p tcp -s 118.242.0.0/16 --dport 25 -j DROP > >=20 > > # flush the chain > > iptable -F CIDR-ASIAN > >=20 > >=20 > > > This didn't work for me and I have tried several varients with no= luck. > > > > > > So my first question is do I understand correcty how to utilize c= hains? > > > > > > Will I be able to load and unload chains rather than flush everyt= hing > > > end reload everything? ( I have a lot of rules ) > >=20 > > I don't quite understand your question. > >=20 > > You 'create' and 'delete' user-defined chains. You can, of course, = flush > > chains individually as well. >=20 >=20 > That's what I was looking for, however I have updated my script to cr= eate > the entries as shown, but seems like it's not working: > Do I have to tell iptables to activate a specific table of entries? > Here is a snip from iptables-save and basically NOTHING is being bloc= ked. >=20 > Thanks! >=20 > # Generated by iptables-save v1.2.11 on Thu Oct 16 17:08:54 2008 > *filter > :INPUT ACCEPT [129969:48753771] > :FORWARD ACCEPT [0:0] > :OUTPUT ACCEPT [128669:50573226] > :CIDR-ASIAN - [0:0] > :CIDR-CZECH - [0:0] > :CIDR-IISG - [0:0] > :CIDR-INDIA-KOREA - [0:0] > :CIDR-POLAND - [0:0] > :CIDR-RUSSIA - [0:0] > :CIDR-TURKEY - [0:0] > :CIDR-UK - [0:0] > :TEST-JACK - [0:0] > :fail2ban-postfix - [0:0] > :fail2ban-postfix-log - [0:0] > -A CIDR-ASIAN -s 58.14.0.0/255.254.0.0 -p tcp -j LOG --log-prefix > "SPAM-BLOCK-CIDR-ASIAN"=20 > -A CIDR-ASIAN -s 58.14.0.0/255.254.0.0 -p tcp -m tcp --dport 25 -j DR= OP=20 > -A CIDR-ASIAN -s 58.16.0.0/255.248.0.0 -p tcp -j LOG --log-prefix > "SPAM-BLOCK-CIDR-ASIAN"=20 > -A CIDR-ASIAN -s 58.16.0.0/255.248.0.0 -p tcp -m tcp --dport 25 -j DR= OP=20 > -A CIDR-ASIAN -s 58.24.0.0/255.254.0.0 -p tcp -j LOG --log-prefix > "SPAM-BLOCK-CIDR-ASIAN"=20 > -A CIDR-ASIAN -s 58.24.0.0/255.254.0.0 -p tcp -m tcp --dport 25 -j DR= OP=20 > -A CIDR-ASIAN -s 58.29.0.0/255.255.0.0 -p tcp -j LOG --log-prefix > "SPAM-BLOCK-CIDR-ASIAN"=20 > -A CIDR-ASIAN -s 58.29.0.0/255.255.0.0 -p tcp -m tcp --dport 25 -j DR= OP Did you forgot COMMIT at the end? Entries are actually being add all-in-one-time on COMMIT. --=20 =F0=CF=CB=CF=D4=C9=CC=C5=CE=CB=CF =EB=CF=D3=D4=C9=CB