So I have a machine with a single interface. It has 2 ip addresses (eth0: 192.168.2.3, eth0:1 192.168.2.4). I'd like to take any traffic coming in on 192.168.2.4 and NAT it to an external ip address. As best I can tell I've done everything needed to make it work, but it doesn't so I'm missing something.
/proc/sys/net/ipv4/ip_forward is set to 1
my iptables are all set to default ACCEPT, here is my DNAT rule:
iptables -t nat -A PREROUTING -d 192.168.2.4 -j DNAT --to-destination 192.1.1.2
The machine has a route to 192.1.1.2 via a gateway reachable from eth0: 192.1.1.2 192.168.2.248 255.255.255.0 UG 0 0 0 eth0
The DNAT rule doesn't seem to actually be doing any sort of NAT/redirection.
What have I missed?