It may become necessary to redirect some outgoing traffic to a different IP address from time to time ….
Recently the route to a mail server became unreachable from our mail server and we had to route traffic via an alternative relay server.
I achieved this using the trusty old iptables.
Here is the rule:
iptables -t nat -A OUTPUT -d <OriginalDestinationIPAaddress> -p tcp –dport <OriginalDestinationPort> -j DNAT –to-destination <NewDestinationIPAddress>:<NewDestinationPort>