I have two servers A and B.
Server A has a private ip 10.0.0.4 and a public ip of 220.127.116.11 Server B has a private ip 10.0.0.5 and a public ip of 18.104.22.168
ifconfig on Server A says eth0 has inet addr: 10.0.0.4
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.