Hi! I'm trying to get a simple static DNAT mapping working and I can't seem to make it work. In my case, eth1 is the external internet and eth4 is a DMZ (10.0.0.0/24). The machine I'm trying to NAT is 10.0.0.2.
eth1:3 is aliased to 1.2.3.4
eth4 is 10.0.0.1
I'm trying to do this:
Code:
iptables -t nat -A PREROUTING -j DNAT -i eth1 -d 1.2.3.4 --to-destination 10.0.0.2
Now, I realize that eth1 has to answer ARP requests for 1.2.3.4 for this to work. I've tried using proxy arp and adding an alias with ifconfig. Neither one works. tcpdump shows packets arriving for 1.2.3.4 on eth1 but never leaving eth4 for 10.0.0.4. I double-checked that routes exist for 10.0.0.0/8 and that no iptables rules are dropping the packets. But it seems the DNAT just isn't working for some reason. I am able to talk to 10.0.0.2 from the internal network (on eth0, 192.168.1.0/24), so routing through this box is obviously working. Any ideas?
I know it's possible to set LOG targets in iptables, but I'm not sure how to do that. So if anyone's thinking of suggesting that, please include a short example.
This is all under a custom-compiled Linux 2.4.27 kernel on a RedHat 9 system, by the way.