Linux Netfilter discussions
 help / color / mirror / Atom feed
* Change source address on incoming packets
@ 2004-05-09 21:50 Joel Vosu
  2004-05-09 22:14 ` Antony Stone
  2004-05-10 10:56 ` John A. Sullivan III
  0 siblings, 2 replies; 5+ messages in thread
From: Joel Vosu @ 2004-05-09 21:50 UTC (permalink / raw)
  To: netfilter

I would need to be able to change the source address of incouming 
packets. I have 2 different subnets, but I need the server to see the 
packes from the 2nd subnet as coming from the 1st.
in iptables it would be something like:
iptables -A PREROUTING -t nat -s 2nd_subnet -j SNAT --to-source 
local_machine
but this is not possible because SNAT only works for outgoing packets in 
POSTROUTING.
Is there a way to get this to work other than adding a second router box 
for NAT?
I tried to do it like this:
Added another IP address eth0:0 to the server,
added rules:
iptables -A PREROUTING -t nat -d eth0:0_ip -p tcp --dport server-port -j 
DNAT --to-destination eth0_ip:server_port
iptables -A POSTROUTING -t nat -d eth0_ip -p tcp --dport server_port -j 
SNAT --to-source eth0:0_ip
but when I check from: iptables -L -t nat -nv then the second rule does 
not get used at all. I presume the pacet intended for local machine does 
not traverse the outgoing part of the nat table.


Sincerely,
Joel


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

end of thread, other threads:[~2004-05-13 12:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-09 21:50 Change source address on incoming packets Joel Vosu
2004-05-09 22:14 ` Antony Stone
2004-05-09 22:31   ` Joel Vosu
2004-05-10 10:56 ` John A. Sullivan III
2004-05-13 12:36   ` Joel Vosu

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