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 firstname.lastname@example.org
at 192.168.0.1 and the other is email@example.com
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 firstname.lastname@example.org
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, email@example.com
receives incoming traffic from firstname.lastname@example.org
, and rather than use the local IP address to send traffic back, email@example.com
sends traffic back to firstname.lastname@example.org
Can /etc/hosts be edited such that traffic received on email@example.com
is sent back to firstname.lastname@example.org
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.