Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Chinh Nguyen <cnguyen@certicom.com>
To: netfilter@lists.netfilter.org
Subject: Re: Dual-home and forward outgoing requests
Date: Thu, 02 Mar 2006 10:24:50 -0500	[thread overview]
Message-ID: <44070E42.6000808@certicom.com> (raw)
In-Reply-To: <a46d47540603020533v6093ac9et4a1f3677e0f490cc@mail.gmail.com>

Andy Lego wrote:
> Hello,
> 
> I have a dual-homed network. Is there any way to tell iptables to
> forward all requests for specific service, that come from one
> interface, to go back out on the same interface?
> 
> Right now I have simply:
> 
> -A POSTROUTING -o eth0 -j MASQUERADE
> -A POSTROUTING -o eth1 -j MASQUERADE
> 
> So, what am I missing?
> 
> Thank you.
> 
> --
> http://legoandy.com
> 
Not sure what you mean. Say your device is 10.0.1.5, do you mean that if someone
was to telnet to 10.0.1.5 you would forward it to 10.0.1.10 (10.0.1.0/24 is on
eth0)?

The simplest is to have ip_forwarding on. Then add DNAT and MASQUERADE rules.
Linux routing should take care of the rest.

iptables -A PREROUTING -t nat -p tcp -s 10.0.1.0/24 --dport 23 -j DNAT --to
10.0.1.10
iptables -A POSTROUTING -t nat -j MASQUERADE


      reply	other threads:[~2006-03-02 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02 13:33 Dual-home and forward outgoing requests Andy Lego
2006-03-02 15:24 ` Chinh Nguyen [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=44070E42.6000808@certicom.com \
    --to=cnguyen@certicom.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