Source and Destination Network Address Translation (SNAT / DNAT) with iptables

A colleague of mine approached me with a need to do some IP address translation.

He had a machine (A) with an IP of and he wanted any connections coming to this machine to get rerouted to another machine (B) with an IP address of

Machine A was a linux system and was the default gateway for machine B (*). This was a perfect fit for a  SNAT/DNAT using iptables.

Read more of this post