Linux Netfilter discussions
 help / color / mirror / Atom feed
* NAT: re-route localhost to otherhost
@ 2009-02-23 23:09 Bill Brelsford
  0 siblings, 0 replies; only message in thread
From: Bill Brelsford @ 2009-02-23 23:09 UTC (permalink / raw)
  To: netfilter

On machine host1 (10.1.1.1) I want to re-route localhost port 25
traffic to host2 (10.1.1.2).  My only nat table entries are:

 iptables -t nat -A OUTPUT -p tcp --dport 25 \
 	-j DNAT --to-destination 10.1.1.2

 iptables -t nat -A POSTROUTING -p tcp --dport 25 \
 	-j SNAT --to-source 10.1.1.1

Then "telnet host1" connects to host2 as expected (as does
"telnet host3" etc.), but "telnet localhost" hangs.  Log
statements inserted before each statement show expected results
(addresses, interfaces, etc.), except that in the localhost case
the POSTROUTING log statement is never executed; I assume SNAT is
not executed either.

The reverse translation works, i.e. changing both addresses to
127.0.0.1 results in "telnet host2" connecting to localhost.

Any explanations/fixes/suggestions?  I'm using kernel 2.6.26 and
iptables 1.4.2 (Debian lenny).

Thanks,

Bill Brelsford

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-23 23:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-23 23:09 NAT: re-route localhost to otherhost Bill Brelsford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox