Hi, is there a way I can edit my /etc/hosts file to resolve the hostname to a local network IP address? Currently the /etc/hosts file only has the external IP address there, with a bunch of variations for the host name.
For example, I have two servers comprising a local network. One server is email@example.com
at 192.168.0.1 and the other is firstname.lastname@example.org
The servers will still need to accept and work with external networks using their hostnames, as done currently. But, additionally I want traffic on the local network using hostnames of email@example.com
to be recognized as on the local network and revert to IP addresses of the local network rather than use the external IP addresses (which would send the traffic onto the external network and make for a much larger distance to travel) when talking to each other.
The situation I'm experiencing is, firstname.lastname@example.org
receives incoming traffic from email@example.com
, and rather than use the local IP address to send traffic back, firstname.lastname@example.org
sends traffic back to email@example.com
Can /etc/hosts be edited such that traffic received on firstname.lastname@example.org
is sent back to email@example.com
using the local IP address of 192.168.0.2? If so, I'll change it similarly on both servers.
Is there anything special I need to do to ensure ALL applications revert to the local IP addresses when communicating to each other on the local network? Some applications, like Oracle database, can only use a hostname with external IP address, and so there's no option to include the local IP address. I'm hoping /etc/hosts can achieve this for me. Thanks in advance for any comments.