netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Chemla <patrick.chemla@perfaction.net>
To: netfilter@vger.kernel.org
Subject: Multiple IPs to 2 interfaces problem with default route
Date: Wed, 03 Mar 2010 10:36:01 +0200	[thread overview]
Message-ID: <4B8E1F71.6060806@perfaction.net> (raw)
In-Reply-To: <4B7ABBED.1020404@chello.at>

Hi,

I have set up a Fedora 11 NAT server to NAT outgoing traffic to 2 
interfaces to 2 ISPs.

My internal interface is eth0, the 2 external interfaces are eth1 for 
ISP1 and eth2 for ISP2, each one with a pool of IP addresses.

I wrote a script who create for each internal server the corresponding 
NAT fonction :

interface= outgoing interface for the wanted ISP
public_ip= public IP address affected to this server on the ISP network
server_ip= internal server local ip address

/sbin/iptables -t nat -A PREROUTING -p tcp -i $interface -s 
$public_ip/32 -j DNAT --to-destination $server_ip
/sbin/iptables -t nat -A POSTROUTING -s $server_ip/32 -j SNAT -o 
$interface --to-source $public_ip

It works very fine with one interface, but when I try to activate the 
second interface, I think I get a problem with the default route.

When I started the interfaces, eth1 got a public IP and a default 
gateway. This default gateway is the default gateway for all the server. 
eth2 has his own public IP, own gateway.

I tried to remove the default gateway, thinking the route will be 
according to the NAT setup, but no more packet can get out of the server.

But I need to split packets to interfaces eth1 and eth2 according to the 
public IP of the internal server, not according to a default route 
always pointing to eth1.

How can I set up these routes?

Patrick


  reply	other threads:[~2010-03-03  8:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16 11:19 I can't make forwarding Patrick Chemla
2010-02-16 14:05 ` Patrick Chemla
2010-02-16 15:38 ` Mart Frauenlob
2010-03-03  8:36   ` Patrick Chemla [this message]
2010-03-04  2:19     ` Multiple IPs to 2 interfaces problem with default route Sven-Haegar Koch

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=4B8E1F71.6060806@perfaction.net \
    --to=patrick.chemla@perfaction.net \
    --cc=netfilter@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).