I am moving a server from one local IP address to another, and I have a lot of places on my network which statically reference the old IP address. I'd like to re-route that traffic to the new address, while also being able to directly use the new address.
I expected a simple DNAT in the PREROUTING nat table would do the trick, but it doesn't work. I used the below, and I see the entry added in
iptables -nvL -t nat:
iptables -I PREROUTING -t nat -d $OLD_ADDR -j DNAT --to-destination $NEW_ADDR
A quick look on tcpdump on the interface which has the new address doesn't show anything hitting, while looking at it on the old interface shows traffic is still trying to go that direction. What am I missing?
EDIT: The PREROUTING rule above was added on the router. The server is reachable from a different interface than it originally was, but both interfaces exist on the router.