configuring linux server to send traffic to local machines using local IP address

Posted by gkdsp on Server Fault See other posts from Server Fault or by gkdsp
Published on 2012-03-27T17:00:01Z Indexed on 2012/03/27 17:32 UTC
Read the original article Hit count: 243

Filed under:

Two linux servers, server1 and server2, are on the same local network (they also have access to an external network).

Server2 has a local IP of 192.168.0.2 and a host name of host2.mydomain.com.

QUESTION 1: If an application on server1 sends traffic to server2 using a host name of host2.mydomain.com, what determines whether this traffic is routed to server2 using the local or external network?

QUESTION 2: To ensure that all traffic sent from server1 to server2 always uses the local network, could I simply include in the server1 /etc/hosts file the following?

192.168.0.2 host2.mydomain.com

...the thinking being, if the servers are always on the same network there should never be a need for server2 to send traffic to server1 via the external network (that I can think of anyway). Is this done in practice, or is some other method preferred?

© Server Fault or respective owner

Related posts about linux