All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anders Fugmann <afu@fugmann.dhs.org>
To: Mattia Martinello <m.martinello@iol.it>
Cc: netfilter@lists.netfilter.org
Subject: Re: Nat
Date: Sun, 08 Sep 2002 23:49:34 +0200	[thread overview]
Message-ID: <3D7BC5EE.7040000@fugmann.dhs.org> (raw)
In-Reply-To: 3D7BB687.6010300@iol.it

Mattia Martinello wrote:
> 
> iptables -t nat -F POSTROUTING
> iptables -t nat -A POSTROUTING -j DROP
This drops every packet, leaving the box. This is not what you want.

> iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -o ppp0 -j 
> MASQUERADE
> 

First masquerade the packets:
$ iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -o ppp0 \
	-j MASQUERADE

Now only allow packets from the network that is to have internet access 
to pass through the firewall. All these packets go through the FORWARD 
chain in the FILTER tables. This is where you want to filter who should 
have internet access or not.

$ iptables -P FORWARD DROP
$ iptables -A FORWARD -s 192.168.1.0/255.255.255.0 -o ppp0 -j ACCEPT

Now allow only packets related to a connection from the lan to pass 
through the firewall from the internet.

$iptables -A FORWARD -i ppp0 -m state --state RELATED,ESTABLISHED \
	-j ACCEPT

And lastly close up the firewall, but allow the firewall itself to 
receive replys:

$iptables -P INPUT DROP
$iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

And allow clients from the lan's to ssh to the firewall.
$ iptables -A INPUT -i eth+ -p tcp --dport ssh -j ACCEPT

Thats it. If you want the two lans to be able to talk to eachother then add:

$ iptables -A FORWARD -i eth+ -o eth+ -j ACCPET

Hope it helps.
If not, then read and unserstand (thats the importent part) the howtos 
and tutorials for iptables.

Regards
Anders Fugmann

--
Author of FIAIF
FIAIF Is An Intelligent Firewall
http://fiaif.fugmann.dhs.org





  parent reply	other threads:[~2002-09-08 21:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-08 20:43 Nat Mattia Martinello
2002-09-08 21:00 ` Nat Antony Stone
2002-09-08 21:27 ` Nat R. Sterenborg
2002-09-08 21:49 ` Anders Fugmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-03  6:52 NAT Martin Schiøtz
2007-07-03  7:27 ` NAT Grant Taylor
2007-07-03  7:55   ` NAT Martin Schiøtz
2007-07-03 14:29     ` NAT Robert LeBlanc
2004-06-06 17:36 Nat mafioso1823
2004-06-07  7:38 ` Nat Antony Stone
2003-11-26  5:31 nat Paul Fontenot
2003-11-26  6:33 ` nat Daniel Chemko
2003-10-01 11:11 NAT tlussnig
2003-10-03 10:22 ` NAT Harald Welte
2002-06-14  8:29 nat saied tabandeh

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=3D7BC5EE.7040000@fugmann.dhs.org \
    --to=afu@fugmann.dhs.org \
    --cc=m.martinello@iol.it \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.