Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Luis Hernán Otegui" <louie_the_o@hotmail.com>
To: netfilter@lists.netfilter.org
Subject: Three NICs, three LANs, only one must be MASQued
Date: Tue, 16 Mar 2004 10:20:20 -0300	[thread overview]
Message-ID: <BAY7-F8tCcVGtDmAkYx0006b199@hotmail.com> (raw)

Hi, everyone. I decided to write to the list because, frankly, I've been 
overwhelmed by this problem, and I couldn't find any previously solved 
similar issue.
Here's the scenario:
I manage a network with a proxy server (running SQUID and IPTABLES, kernel 
2.4.18-14) which used to have two NICs, both networks attached to those NICs 
with public IP addresses. Recently, we had to put a third NIC in the proxy, 
with private reserved (10.0.0.x) addresses. So, we had to masquerade all the 
traffic from the two "internal" networks. Here's the diagram:

      INTERNET
             |                              (public IPs network(A))
             |                             /
(corporative LAN)-----(proxy)<
                                           \
                                            (private IPs network(B))

So far, so good, but the point is that I need the servers in the (A) network 
to maintain their IPs, since they're well known in the net. And also we need 
the hosts in the (B) network to be masqued, since their IPs cannot be routed 
over the internet.
My questions are:
a) Are there any way to masquerade only the (B) network? Currently, I have a 
line like this in the *nat section of the /etc/sysconfig/iptables file:
-A POSTROUTING -o eth0 -j MASQUERADE
b) Is there any better way to do this?

ok, I think you'll get it better if I post the iptables script, so here it 
goes:

Remarks: 163.10.5.75 is the outer interface (eth0), 163.10.7.126 is the NIC 
of the "public" inner network, and 10.0.0.1 is the address of the "private" 
inner network.

# Generated by iptables-save v1.2.6a on Tue Feb  3 11:44:12 2004
*nat
:PREROUTING ACCEPT [28330:2376442]
:POSTROUTING ACCEPT [2964:192723]
:OUTPUT ACCEPT [22208:1482370]
-A PREROUTING -d ! 163.10.5.75 -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT 
--to-ports 3128
#-A PREROUTING -s 163.10.7.114 -i eth1 -p tcp -m tcp -j ACCEPT
-A PREROUTING -d ! 163.10.5.75 -i eth2 -p tcp -m tcp --dport 80 -j REDIRECT 
--to-ports 3128
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Tue Feb  3 11:44:12 2004
# Generated by iptables-save v1.2.6a on Tue Feb  3 11:44:12 2004
*filter
:INPUT ACCEPT [475802:357605367]
:FORWARD ACCEPT [14845:1895096]
:OUTPUT ACCEPT [1360638:579882577]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -i eth2 -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -i eth2 -j ACCEPT
COMMIT

I forgot to mention that I forward all traffic from the inner interfaces to 
port 80 to port 3128 (SQUID)

Any suggestions will be very wellcomed

Oh, and finally, sorry about my English, I learned by post mail, and I 
managed to choice the worst time to do this, since the postmans were on 
strike... ;-)

                    Luis Hernán Otegui
                  Administrador de Red
             Facultad de Ciencias Exactas
                              UNLP
----------------------------------------------------
GNU-GPL: "May The Source Be With You..."
----------------------------------------------------

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.latam.msn.com/



             reply	other threads:[~2004-03-16 13:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-16 13:20 Luis Hernán Otegui [this message]
2004-03-16 13:32 ` Three NICs, three LANs, only one must be MASQued Antony Stone

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=BAY7-F8tCcVGtDmAkYx0006b199@hotmail.com \
    --to=louie_the_o@hotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox