configure /etc/hosts file so ALL applications always use local network when it makes sense to do so?

Posted by gkdsp on Server Fault See other posts from Server Fault or by gkdsp
Published on 2012-03-27T01:49:22Z Indexed on 2012/03/27 5:31 UTC
Read the original article Hit count: 412

Filed under:
|

I have two Linux CentOS servers setup in a local network. ServerA is 192.168.0.1 and serverB is 192.168.0.2.

There's an application on serverA that communicates with serverB using host2.serverAname.com. But, the traffic is blocked on serverB because the port being used has a firewall that only allows traffic on the local network to pass. Thus, serverB needs to see traffic from serverA as originating from 192.168.0.1 (instead of host2.serverA.com).

Is there a way I can configure the /etc/hosts file to ensure traffic always sent between the two servers uses local IP addresses, regardless of what hostname is in use, and for ALL applications?

If so, could someone walk me through an example? I only have 2 servers, so the simpler the better.

© Server Fault or respective owner

Related posts about linux

Related posts about firewall