Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Patrick Chemla <patrick.chemla@perfaction.net>
To: netfilter@vger.kernel.org
Subject: iptables NATed or not NATed
Date: Thu, 11 Mar 2010 09:04:54 +0200	[thread overview]
Message-ID: <4B989616.7000904@perfaction.net> (raw)

Hi,

I am using iptables NAt to route outgoing packets from my LAN (eth0) to 
specific public IPs on 2 ISPs links (eth1 and eth2), according to the 
internal IP of a local server.

Here is how I NAT the addresses:

/sbin/iptables -t nat -A PREROUTING -p tcp -i $interface -s 
$public_ip/32 -j DNAT --to-destination $server_ip
/sbin/iptables -t nat -A POSTROUTING -s $server_ip/32 -j SNAT -o 
$interface --to-source $public_ip

Here is how I route the packets to the right outgoing interface:

I have 2 routing tables declared. Default route is on eth2.

/sbin/ip rule add from $server_ip table $route_table

It works, but with tcpdump I have recorded packets on outgoing 
interfaces where addresses are NOT NATed, means, packets issued from 
internal servers on eth0, are routed to default route eth2 with there 
internal address 10.0.0.xx.

It is very strange because it is a small percentage of packets, not all 
the packets from a specific server, directed to the same port than 
others who are routed and NATed the right way, at the same time.

Again: a small percentage of packets issued by the same server, to the 
same destination port, maybe not the same public server are routed 
without NATing, while most of the packets from the same computer are 
well routed and NATed.

Of course, the dialog fails because there is no back route to address 
10.0.0.xx

Does someone have any idea?
Thanks for help
Patrick



             reply	other threads:[~2010-03-11  7:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11  7:04 Patrick Chemla [this message]
2010-03-11  8:21 ` iptables NATed or not NATed Marek Kierdelewicz
2010-03-11 20:39 ` Pascal Hambourg
2010-03-12  9:19   ` ratheesh k
2010-03-12 20:24     ` Pascal Hambourg

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=4B989616.7000904@perfaction.net \
    --to=patrick.chemla@perfaction.net \
    --cc=netfilter@vger.kernel.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