I have two servers A and B.
Server A has a private ip 10.0.0.4 and a public ip of 1.2.3.4 Server B has a private ip 10.0.0.5 and a public ip of 5.6.7.8
running ifconfig on Server A says eth0 has inet addr: 10.0.0.4
running ifconfig on Server B says eth0 has inet addr: 10.0.0.5
Servers A and B are on the same network, and when Server A talks to Server B, they talk using their private IPs. I would like to, however, have them communicate using their public IPs. I believe this involves some NAT trickery with iptables.
How can I get Server A to communicate with Server B through their public IPs and not the private IPs? Do I need to have in place a SNAT and DNAT rule? I realize I am a noob, so any advice is helpful.
The motivation for this is that I'm trying to set up a VPN connection where there are conflicting IPs on either network- thus I need to NAT my private IP to something else.
Thanks!