Re: Policy routing problem

"Christoph Pleger" <[email protected]> Thu, 25 Oct 2012 14:57:20 +0200 (MEST)
Newsgroups org.kernel.vger.linux-admin
Message-ID <58606.129.217.4.64.1351169840.squirrel@postamt.cs.uni-dortmund.de>
Hello,

> I tried to set the correct IP address with
> SNAT, but it seems that SNAT refuses to use the same port where some
> application is listening on. So, if I use "iptables -t nat -A POSTROUTING
> ... --to-source 129.217.14.81:67", nothing is sent, in contrast to other
> ports.

For some experiments, I added an iptables-rule, so that the mark is not
only set if the source port is bootps, but also if the destination port is
bootpc. And now, I am completely confused, because I found out that though
there is a relation between the port I use in "iptables -t nat ..." and if
a message is sent, there must also be another reason why messages are not
sent with this kind of NAT. When a DHCP client sends a unicast request to
port bootps, the DHCP unicast reply is never sent when I use port 67 in
SNAT. But when I use netcat sessions in a command line on the DHCP server
to send messages to port bootpc of a client, messages are sent in some
netcat sessions, but in other sessions, they do not, no matter which port
I use in SNAT. Maybe the OS sometimes decides that the port is already in
use and refuses to send messages from that port?

Regards
  Christoph