Today, I encountered a problem when the edits I made to ‘/etc/hosts’ file on a Linux box didn’t work as expected.
In the /etc/hosts file I added the following line,
192.168.50.2 shaakunthala.com
And to test, issued the following command,
$ ping shaakunthala.com
And the result was,
PING shaakunthala.com (184.168.221.17) 56(84) bytes of data.
That’s not the IP address I wanted to temporarily set it to. So I looked up the Internet and various sources gave me the following firsthand solution.
# /etc/init.d/nscd restart
Restart the name service cache daemon. Similar to the ‘ipconfig/flushdns’ thing you would do on a Windows box.
And it worked!