All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John A. Sullivan III" <john.sullivan@nexusmgmt.com>
To: ggerard@mac.com
Cc: netfilter@lists.netfilter.org
Subject: Re: Network mapping from internal and external
Date: Mon, 04 Oct 2004 06:38:12 -0400	[thread overview]
Message-ID: <1096886292.2069.12.camel@localhost> (raw)
In-Reply-To: <200410040342.i943gOqM012108@ylpvm15.prodigy.net>

On Sun, 2004-10-03 at 23:42, Gregory Gerard wrote:
> I'm not sure how to describe my setup and intended network in iptables
> parlance. Have searched much and can't find anything that matches my
> situation.
> 
>  
> 
> I have 5 static IPs from my ISP. Out the Ethernet end of my DSL box I see
> those 5 IPs directly. I have no control over the router but that's fine.
> 
>  
> 
> I have many more than 5 machines in my network.
> 
>  
> 
> Internally, I have 10.9.x.x (255.255.0.0).
> 
>  
> 
> I would like to setup iptables such that 4 of the external IP addresses map
> completely map onto exactly 4 internal IP addresses. The fifth external
> address will simply be used to NAT for internal only machines.
> 
>  
> 
> What's the right mix of NICs and settings?
> 
>  
> 
> I was thinking about bringing up several eth0:1..4 interfaces to accept
> those 4 external addresses and map them that way.
<snip>
It's reasonably straightforward to accomplish this.  The ISCS project
will do all of this automatically for you -- map the addresses exactly
as you describe and take care of binding the needed addresses addresses
to the NICs (http://iscs.sourceforge.net).  The fully functioning code
has not yet been released but enough of it is there to split out the
rules.

However, if all you have is a single device, you're probably better off
setting it up manually.  The rule order will be important.  I assume you
know which internal addresses you want assigned to the four public
addresses.

You can create an SNAT/DNAT pair for each

iptables -t nat -A PREROUTING -d $PUBIP1 -i $PUBIF -j DNAT
--to-destination $INTIP1
iptables -t nat -A POSTROUTING -s $INTIP1 -o $PUBIF -j SNAT --to-source
$PUBIP1

Then, create another rule for the rest of the protected addresses which
is evaluated after all the other rules which will NAPT them all to a
single public IP address:

iptables -t nat -A POSTROUTING -o $PUBIF -j SNAT --to-source $MAINPUBIP

Then, to enable the public interface to respond to all the ARP requests,
bind the additional addresses to them:

ip address add <PUBIP1>/<MASK LENGTH> dev <PUBIF> brd +

for each public IP.

I think that will do it for you.  Good luck - John
-- 
John A. Sullivan III
Chief Technology Officer
Nexus Management
+1 207-985-7880
john.sullivan@nexusmgmt.com
---
If you are interested in helping to develop a GPL enterprise class
VPN/Firewall/Security device management console, please visit
http://iscs.sourceforge.net 



  parent reply	other threads:[~2004-10-04 10:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-04  3:42 Network mapping from internal and external Gregory Gerard
2004-10-04  5:43 ` Craig Steadman
2004-10-04 10:38 ` John A. Sullivan III [this message]
2004-10-04 10:42 ` Jason Opperisano

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=1096886292.2069.12.camel@localhost \
    --to=john.sullivan@nexusmgmt.com \
    --cc=ggerard@mac.com \
    --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.