I wrote:
> Apparently the reason it [iptables SNAT/DNAT] doesn't work is because
> I'm running a 2.6.12.1 kernel. The rules work perfectly under 2.6.10.
In comp.os.linux.networking
gg-(E-Mail Removed) wrote:
> I'm not sure what's going on there, but one thing you might do is
> insert LOG rules into the POSTROUTING chain to see what the packets
> look like before and after your SNAT rule.
DNAT and SNAT rewrites both terminate the processing chain, so it's not
possible to log the packet addresses this way. However, what I had done
before posting is to use a number of tcpdump processes to watch what
was going on.
Here are the rules (for brevity, I've omitted some fields, which in all
cases are: prot=all, opt=--, in=*, out=*):
| Chain PREROUTING (policy ACCEPT 81366 packets, 17M bytes)
| pkts bytes target source destination
| 0 0 DNAT 0.0.0.0/0 10.1.1.105 to:192.168.130.103
|
| Chain POSTROUTING (policy ACCEPT 15975 packets, 5766K bytes)
| pkts bytes target source destination
| 44229 7144K ACCEPT 10.0.0.0/8 10.0.0.0/8
| 2645 164K SNAT 192.168.128.0/21 0.0.0.0/0 to:10.1.1.105
There are three boxes C (client), N (nat box), S (server). Pinging S
from C via N shows that C's source IP address is present, but the packet
has been correctly routed to S. Obviously the replies then go AWOL
because S can't route to C. The same happens for non-ICMP traffic.
> Also what does "ip route show" give you?
| 192.168.133.14 dev tun0 proto kernel scope link src 192.168.133.13
| 192.168.128.0/21 via 192.168.133.14 dev tun0
| 10.1.0.0/16 dev br0 proto kernel scope link src 10.1.1.106
| default via 10.1.254.254 dev br0
To give you the context, C is on the network 192.168.128.0/21, and S is
on 10.1.0.0/16
Chris