Advance working of /etc/hosts file in Linux
I have a java application which is distributed and having a network connection with a nfs share. Application is using DNS to connected to network share. we wanted to test a network connection failure when the application is running.
We edit /etc/hosts file while the application is running,this simulate a network connection failure. and got the expected outcome.
I just don't understand how editing the hosts file with the new (fake) ip address. gets realtime updated with the new IP with already running process.
can someone explain the implementation of this in the OS and how the new ips are getting mapped to already running process. Is the OS all the time monitoring the host file and updating or when a new connection is created it checks.