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 18.104.22.168
The machine has a route to 22.214.171.124 via a gateway reachable from eth0: 126.96.36.199 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?