All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexis <alexis@attla.net.ar>
To: Kean Pedersen <netfilter@zakarun.dk>
Cc: netfilter <netfilter@lists.netfilter.org>
Subject: Re: Running iptables behind router
Date: Tue, 17 Feb 2004 09:39:07 -0300	[thread overview]
Message-ID: <632269680.20040217093907@attla.net.ar> (raw)
In-Reply-To: <20040216235513.GA1219@room101>

yes, do this


echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -p FORWARD DROP

iptables -A FORWARD -s 192.168.2.0/24 -j ACCEPT

then, you have 2 options

1 to use 1 ip of 192.168.1 to nat all the .2 network, or use a pool,
its your choice

1st case
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j SNAT --to
192.168.1.254

or

iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE


2nd case

iptables  -t nat -A POSTROUTING -s 192.168.2.0/24 -j SNAT --to
192.168.1.50-192.168.1.60




Hello Kean,

Monday, February 16, 2004, 8:55:14 PM, you wrote:

KP> Hi, I have some problems setting up iptables on a linux box, acting as a
KP> router between two networks. I have an internet connection through a
KP> hardware router, which I have no access to. This router uses NAT, and
KP> has an interface on 192.168.1.1. So far I've had my LAN on
KP> 192.168.1.0/24, with no problems, but would like to split it into two
KP> LANs, one on 192.168.1.0/24, having the hardware router and some hosts,
KP> and another one on 192.168.2.0/24, acting as an "internal" LAN.

KP> I'd then like to connect these two LANs with a linux box running
KP> iptables, so the both LANs have access to the internet through the
KP> hardware router.

KP> I sat up the iptables machine (which have two NICs) to the IPs
KP> 192.168.1.100 and 192.168.2.100, one on each interface. How should I set
KP> up iptables, so the 192.168.2.0/24 range have access through iptables,
KP> and further through the hardware router onto the internet? Only outbound
KP> connections will be made. (Inbound connections are mapped in the
KP> hardware router to 192.168.1.x to specific hosts, no problem there).

KP> The computers on the 192.168.2.0/24 range should be able to make
KP> connections to the 192.168.1.0/24 range, but not the other way around.

KP> Any help is appreciated.

KP> --
KP> Kean Pedersen


-- 
Best regards,
 Alexis                            mailto:alexis@attla.net.ar




  reply	other threads:[~2004-02-17 12:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-16 23:55 Running iptables behind router Kean Pedersen
2004-02-17 12:39 ` Alexis [this message]
2004-02-24  0:13   ` Kean Pedersen
2004-02-24  4:31     ` John A. Sullivan III
2004-02-24 12:07       ` Kean Pedersen
2004-02-25 18:40         ` John A. Sullivan III
2004-02-25 19:41           ` Kean Pedersen
2004-02-24 11:06     ` Antony Stone
2004-02-24 14:13     ` Jeffrey Laramie

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=632269680.20040217093907@attla.net.ar \
    --to=alexis@attla.net.ar \
    --cc=netfilter@lists.netfilter.org \
    --cc=netfilter@zakarun.dk \
    /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.