From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chinh Nguyen Subject: Re: Dual-home and forward outgoing requests Date: Thu, 02 Mar 2006 10:24:50 -0500 Message-ID: <44070E42.6000808@certicom.com> References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-bounces@lists.netfilter.org Errors-To: netfilter-bounces@lists.netfilter.org Content-Type: text/plain; charset="us-ascii" To: netfilter@lists.netfilter.org 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