All of lore.kernel.org
 help / color / mirror / Atom feed
* Outgoing redirection with iptables - TCP skips NAT?
@ 2009-03-19 11:09 Kristian Evensen
  2009-03-19 14:43 ` wlet
  0 siblings, 1 reply; 5+ messages in thread
From: Kristian Evensen @ 2009-03-19 11:09 UTC (permalink / raw)
  To: netfilter

Hello,

I am working on configuring a multihomed machine, and one of my goals
is to redirect some outgoing TCP-traffic originating from this machine
using iptables. Currently, I have got it working with UDP and if I add
the rule to the output-chain of the NAT-table before I start the
connection, it works.

However, sometimes I want to start doing redirection in the middle of
a TCP connection and this does not seem to work. I do not get any
matches to my LOG-target (except for the first SYN packet) and the
packets still go through the old interface. In other words, it somehow
seems like TCP is skipping the NAT's output-chain. Does anyone have
any ideas how to solve this?

The iptables rule I use is:
sudo iptables -A OUTPUT -t nat -p tcp -d 192.168.101.14 --dport 9999
-j DNAT --to 192.168.100.250:9999

The LOG rule is constructed like this:
sudo iptables -A OUTPUT -t nat -p udp -d 192.168.101.14 --dport 9999
-m state --state NEW,ESTABLISHED,RELATED --sport 1024:65535 -j LOG
--log-prefix "INFO,OUTPUT,NAT(tcp): " --log-level debug

Thanks in advance,
Kristian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-19 22:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-19 11:09 Outgoing redirection with iptables - TCP skips NAT? Kristian Evensen
2009-03-19 14:43 ` wlet
2009-03-19 14:55   ` Kristian Evensen
2009-03-19 22:57     ` whiplash
2009-03-19 15:19   ` Christoph Paasch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.