Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Joel Newkirk <netfilter@newkirk.us>
To: Michal Kepien <lordpopcorn@poczta.onet.pl>
Cc: Christo Bezuidenhout <christo@it4africa.co.za>,
	netfilter@lists.netfilter.org
Subject: Re: Firewall Setup on RH 9
Date: 05 Jul 2003 01:35:24 -0400	[thread overview]
Message-ID: <1057383324.2821.34.camel@alpha.newkirk.us> (raw)
In-Reply-To: <n6tbgvkvn94tuq3f8m01d5rah2n97tgnol@4ax.com>

On Fri, 2003-07-04 at 17:54, Michal Kepien wrote:
> >2. Both NIC1 and NIC3 Should be able to Connect VIA NIC2 to Internet. 
> >NIC1 Should be able to connect to NIC3 but NIC3 must not be ABLE to
> >Connect to NIC1 's network
> 
> NIC1 ---> eth0
> NIC2 ---> eth1
> NIC3 ---> eth2
> 
> NIC1's NETWORK: 192.168.0.0
> NIC3's NETWORK: 192.168.1.0

> # First, deny packets from NIC3 to NIC1
> iptables -A INPUT -i eth2 -s 192.168.1.0/24 -d 192.168.0.0/24 -j DROP

This needs to be FORWARD chain, not INPUT.  Since the traffic isn't
destined for the firewall box itself, it goes to the FORWARD chain.


> # Then, enable all other packets (needed for Internet access)
> iptables -A INPUT -i eth0 -s 192.168.0.0/24 -d 0.0.0.0/0 -j ACCEPT
> iptables -A INPUT -i eth2 -s 192.168.1.0/24 -d 0.0.0.0/0 -j ACCEPT

Same here.  All these rules do is allow those two subnets to access the
box itself, not the internet.


> ######## OUTPUT rules ########
> # We don't need to deny the packets from NIC3 to NIC1 once more as
> # every packet goes through the INPUT chain _first_
> 
> # Accept re-masqueraded packets for both networks
> iptables -A OUTPUT -o eth0 -s 0.0.0.0/0 -d 192.168.0.0/24 -j ACCEPT
> iptables -A OUTPUT -o eth2 -s 0.0.0.0/0 -d 192.168.1.0/24 -j ACCEPT

As above, this affects only traffic from the box itself, NOT forwarded
traffic.


> BTW - why is there no packet tester in iptables (like the 'ipchains
> -C' command)? This little thing was _so_ useful...

As I suspected from your misconception about forwarded traffic, you're 
an ipchains veteran... ;^)  With iptables FORWARD traffic never touches
the INPUT or OUTPUT chains, those are explicitly for INPUT and OUTPUT
to and from the box itself.

j




  reply	other threads:[~2003-07-05  5:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-01  8:04 Firewall Setup on RH 9 Christo Bezuidenhout
2003-07-04 21:54 ` Michal Kepien
2003-07-05  5:35   ` Joel Newkirk [this message]
2003-07-05  7:30     ` Michal Kepien
2003-07-05 18:20       ` Joel Newkirk
  -- strict thread matches above, loose matches on Subject: below --
2003-07-03  6:37 Christo Bezuidenhout
2003-07-03  8:07 ` Michael K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1057383324.2821.34.camel@alpha.newkirk.us \
    --to=netfilter@newkirk.us \
    --cc=christo@it4africa.co.za \
    --cc=lordpopcorn@poczta.onet.pl \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox