Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Steven M Campbell <Netfilter@SCampbell.net>
To: Jeremy Elson <jelson@gmail.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: Per-client routing, plus masquerading -- possible?
Date: Thu, 23 Mar 2006 08:46:17 -0500	[thread overview]
Message-ID: <4422A6A9.7030102@SCampbell.net> (raw)
In-Reply-To: <51e5f6120603221910j3a7d3827oddb2b3bdcacaa818@mail.gmail.com>

Jeremy Elson wrote:
> [ Oops, sent this to netfilter-devel before I realized this list
> existed.  D'oh! ]
> 
> 
> Hi,
> 
> I'm trying to set up a Linux box as a NATting router.  But here's the
> trick: my box's external interface is on a LAN that has a whole bunch
> of next-hop routers on it, any of which can be used to access the
> Internet.  I'm trying to figure out how to configure iptables so that
> the NAT box selects the router to use based on client IP address
> (i.e., the IP address on the inside interface).
> 
> In other words -- I'd like ipfilter to keep the destination IP address
> unchanged, but select a next-hop destination (e.g., by changing the
> destination MAC address) based on the source IP.   And, on top of all
> this, mangle the source address according to normal masquerading.
> 
> I've been tinkering with a command like this:
> 
> iptables -t nat -A POSTROUTING -i $INTERNAL_CLIENT_IP -o
> external-iface0 -j SNAT --to $EXTERNAL_ROUTER_IP
> 
> ...but it seems that --to controls the new source address given to the
> packet (i.e., the router's outside-interface IP), and not the
> destination to which the NATted packet is sent.
> 
> Could someone please point me in the right direction?  Or is this not possible?
> 
> Thanks!
> 
> --Jeremy
> 

You just want do to source routing, look here

http://www.linuxguruz.com/iptables/howto/2.4routing-4.html#ss4.1


      parent reply	other threads:[~2006-03-23 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-23  3:10 Per-client routing, plus masquerading -- possible? Jeremy Elson
2006-03-23  7:35 ` Menno Smits
2006-03-23  9:35   ` Jeremy Elson
2006-03-23 12:23     ` Sven Schuster
2006-03-27  6:13       ` Menno Smits
2006-03-23 13:46 ` Steven M Campbell [this message]

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=4422A6A9.7030102@SCampbell.net \
    --to=netfilter@scampbell.net \
    --cc=jelson@gmail.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