* how can i combine these 2 iprules
@ 2004-03-05 18:27 Technical
2004-03-05 18:33 ` Antony Stone
2004-03-05 23:16 ` Luciano Miguel Ferreira Rocha
0 siblings, 2 replies; 7+ messages in thread
From: Technical @ 2004-03-05 18:27 UTC (permalink / raw)
To: netfilter, fedora-list
-A RH-Firewall-1-INPUT ! -s cnnp1.com -j LOG --log-prefix "IPTABLES: "
-A RH-Firewall-1-INPUT ! -s cnnp2.com -j LOG --log-prefix "IPTABLES: "
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how can i combine these 2 iprules
2004-03-05 18:27 how can i combine these 2 iprules Technical
@ 2004-03-05 18:33 ` Antony Stone
2004-03-05 18:53 ` Technical
2004-03-05 23:16 ` Luciano Miguel Ferreira Rocha
1 sibling, 1 reply; 7+ messages in thread
From: Antony Stone @ 2004-03-05 18:33 UTC (permalink / raw)
To: netfilter
On Friday 05 March 2004 6:27 pm, Technical wrote:
> -A RH-Firewall-1-INPUT ! -s cnnp1.com -j LOG --log-prefix "IPTABLES: "
> -A RH-Firewall-1-INPUT ! -s cnnp2.com -j LOG --log-prefix "IPTABLES: "
iptables -N mychain
iptables -A mychain -s cnnp1.com -j RETURN
iptables -A mychain -s cnnp2.com -j RETURN
iptables -A mychain -j LOG --log-prefix "IPTABLES: "
iptables -A RH-Firewall-1-INPUT -j mychain
Note that it is not recommended to use hostnames in netfilter rules - better
to identify the IP addresses and put them in yourself, to avoid possibly
hidden problems.
Antony.
--
Behind the counter a boy with a shaven head stared vacantly into space,
a dozen spikes of microsoft protruding from the socket behind his ear.
- William Gibson, Neuromancer (1984)
Please reply to the list;
please don't CC me.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: how can i combine these 2 iprules
2004-03-05 18:33 ` Antony Stone
@ 2004-03-05 18:53 ` Technical
2004-03-05 19:17 ` Rob Sterenborg
0 siblings, 1 reply; 7+ messages in thread
From: Technical @ 2004-03-05 18:53 UTC (permalink / raw)
To: Antony Stone; +Cc: netfilter
What is -j Return doing
> On Friday 05 March 2004 6:27 pm, Technical wrote:
>
>> -A RH-Firewall-1-INPUT ! -s cnnp1.com -j LOG --log-prefix "IPTABLES: "
>> -A RH-Firewall-1-INPUT ! -s cnnp2.com -j LOG --log-prefix "IPTABLES: "
>
> iptables -N mychain
> iptables -A mychain -s cnnp1.com -j RETURN
> iptables -A mychain -s cnnp2.com -j RETURN
> iptables -A mychain -j LOG --log-prefix "IPTABLES: "
> iptables -A RH-Firewall-1-INPUT -j mychain
>
> Note that it is not recommended to use hostnames in netfilter rules -
> better
> to identify the IP addresses and put them in yourself, to avoid possibly
> hidden problems.
>
> Antony.
>
> --
> Behind the counter a boy with a shaven head stared vacantly into space,
> a dozen spikes of microsoft protruding from the socket behind his ear.
>
> - William Gibson, Neuromancer (1984)
>
> Please reply to the
> list;
> please don't CC
> me.
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: how can i combine these 2 iprules
2004-03-05 18:53 ` Technical
@ 2004-03-05 19:17 ` Rob Sterenborg
2004-03-05 20:04 ` Technical
0 siblings, 1 reply; 7+ messages in thread
From: Rob Sterenborg @ 2004-03-05 19:17 UTC (permalink / raw)
To: netfilter
> > On Friday 05 March 2004 6:27 pm, Technical wrote:
> >
> >> -A RH-Firewall-1-INPUT ! -s cnnp1.com -j LOG --log-prefix
> "IPTABLES: "
> >> -A RH-Firewall-1-INPUT ! -s cnnp2.com -j LOG --log-prefix
> "IPTABLES: "
> >
> > iptables -N mychain
> > iptables -A mychain -s cnnp1.com -j RETURN
> > iptables -A mychain -s cnnp2.com -j RETURN
> > iptables -A mychain -j LOG --log-prefix "IPTABLES: "
> > iptables -A RH-Firewall-1-INPUT -j mychain
>
> What is -j Return doing
Your match is reversed.
You matched everything that does not cnnp1.com and LOGged it. After that you
matched everything that does not match cnnp2.com and LOGged it.
So, you logged everything that matched cnnp1.com or cnnp2.com once, else
twice.
Antony's solution redirects a packet to the "mychain" user chain.
If a packet matches either cnnp1.com or cnnp2.com, it RETURNs to the
"RH-Firewall-1-INPUT" chain.
If a packet didn't match, it gets logged and the "mychain" chain ends, thus
the packet returns to the chain that called it ; the "RH-Firewall-1-INPUT"
chain.
Gr,
Rob
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: how can i combine these 2 iprules
2004-03-05 19:17 ` Rob Sterenborg
@ 2004-03-05 20:04 ` Technical
2004-03-05 20:24 ` Antony Stone
0 siblings, 1 reply; 7+ messages in thread
From: Technical @ 2004-03-05 20:04 UTC (permalink / raw)
To: Rob Sterenborg; +Cc: netfilter
Ok I got that but i am confused about how true iptables' sequential
execution of rules is.
Say for example that my I ping this machine from a host other than
cnnp1.com and cnnp2.com. The packet should be logged by >> > iptables -A
mychain -j LOG --log-prefix "IPTABLES: "
My question is should not the execution of the rest of the rules in
RH-Firewall-1-INPUT not happen
>> > On Friday 05 March 2004 6:27 pm, Technical wrote:
>> >
>> >> -A RH-Firewall-1-INPUT ! -s cnnp1.com -j LOG --log-prefix
>> "IPTABLES: "
>> >> -A RH-Firewall-1-INPUT ! -s cnnp2.com -j LOG --log-prefix
>> "IPTABLES: "
>> >
>> > iptables -N mychain
>> > iptables -A mychain -s cnnp1.com -j RETURN
>> > iptables -A mychain -s cnnp2.com -j RETURN
>> > iptables -A mychain -j LOG --log-prefix "IPTABLES: "
>> > iptables -A RH-Firewall-1-INPUT -j mychain
>>
>> What is -j Return doing
>
> Your match is reversed.
> You matched everything that does not cnnp1.com and LOGged it. After that
> you
> matched everything that does not match cnnp2.com and LOGged it.
> So, you logged everything that matched cnnp1.com or cnnp2.com once, else
> twice.
>
> Antony's solution redirects a packet to the "mychain" user chain.
> If a packet matches either cnnp1.com or cnnp2.com, it RETURNs to the
> "RH-Firewall-1-INPUT" chain.
> If a packet didn't match, it gets logged and the "mychain" chain ends,
> thus
> the packet returns to the chain that called it ; the "RH-Firewall-1-INPUT"
> chain.
>
>
> Gr,
> Rob
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how can i combine these 2 iprules
2004-03-05 20:04 ` Technical
@ 2004-03-05 20:24 ` Antony Stone
0 siblings, 0 replies; 7+ messages in thread
From: Antony Stone @ 2004-03-05 20:24 UTC (permalink / raw)
To: netfilter
On Friday 05 March 2004 8:04 pm, Technical wrote:
> Ok I got that but i am confused about how true iptables' sequential
> execution of rules is.
>
> Say for example that my I ping this machine from a host other than
> cnnp1.com and cnnp2.com. The packet should be logged by >> > iptables -A
> mychain -j LOG --log-prefix "IPTABLES: "
>
> My question is should not the execution of the rest of the rules in
> RH-Firewall-1-INPUT not happen
Once a packet RETURNs from a user-defined chain, or gets to the end of a
user-defined chain (as it will if it matches the LOG target - this target
does not terminate processing), it continues to be processed through the rest
of the rules in the built-in chain which called it.
The two rules which you posted in your question only LOGged the packets - did
not ACCEPT or DROP them, therefore the version I suggested to you in my
answer did exactly the same - LOG without ACCEPTing or DROPping.
If you want to ACCEPT or DROP the packets and thereby avoid further processing
in the INPUT chain, do so at the end of the user-defined "mychain".
Antony.
--
If you can't find an Open Source solution for it, then it isn't a real
problem.
Please reply to the list;
please don't CC me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how can i combine these 2 iprules
2004-03-05 18:27 how can i combine these 2 iprules Technical
2004-03-05 18:33 ` Antony Stone
@ 2004-03-05 23:16 ` Luciano Miguel Ferreira Rocha
1 sibling, 0 replies; 7+ messages in thread
From: Luciano Miguel Ferreira Rocha @ 2004-03-05 23:16 UTC (permalink / raw)
To: fedora-list; +Cc: netfilter
On Fri, Mar 05, 2004 at 01:27:53PM -0500, Technical wrote:
> -A RH-Firewall-1-INPUT ! -s cnnp1.com -j LOG --log-prefix "IPTABLES: "
> -A RH-Firewall-1-INPUT ! -s cnnp2.com -j LOG --log-prefix "IPTABLES: "
-N iptlog
-A iptlog -s cnnp1.com -j RETURN
-A iptlog -s cnnp2.com -j RETURN
-A -j LOG --log-prefix "IPTABLES: "
Should do it.
Regards,
Luciano Rocha
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-03-05 23:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-05 18:27 how can i combine these 2 iprules Technical
2004-03-05 18:33 ` Antony Stone
2004-03-05 18:53 ` Technical
2004-03-05 19:17 ` Rob Sterenborg
2004-03-05 20:04 ` Technical
2004-03-05 20:24 ` Antony Stone
2004-03-05 23:16 ` Luciano Miguel Ferreira Rocha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox