How to reload /etc/hosts file in AIX without reboot
Solution 1
Flush the netcd DNS cache:
netcdctrl -t dns -e hosts -f
Hostname lookup order is determined using /etc/irs.conf, /etc/netsvc.conf and then $NSORDER.
Keep in mind though, that irs.conf and $NSORDER are typically not used.
Solution 2
The hosts file change should be immediate. But AIX can be configured to look at DNS first and the hosts file second. Check the /etc/netsvc.conf
file to see if "local" is listed first.
If you are running named on the server you may need to restart it for DNS lookups... but the hosts file isn't normally cached anywhere.
Solution 3
I had the same problem and my new entry was the last line in the /etc/hosts file. I added a new blank line to the end of the file and magically it worked! :)
Related videos on Youtube
Comments
-
Gok Demir almost 2 years
How to reload /etc/hosts file in AIX without reboot? I am trying to ping a new entry but it still shows previous version. Thanks
-
Mark almost 13 yearsYou should probably update this with more information. Have you used nslookup or dig to test the dns lookup. What, exactly, are you pinging? Detail would help solve this.
-
EightBitTony almost 13 yearsNeed more detail. Including some output. Are you running the ping from a session on the AIX machine, or are you running the ping from a client which is using the AIX machine for host lookups?
-
-
Gok Demir almost 13 yearslocal is listed first. However still it does respect my new entries
-
EightBitTony almost 13 yearsipconfig doesn't work on AIX and you can't put order hosts,bind into an AIX resolv.conf. I assume you that you assume the original question was about a client of an AIX machine.
-
djangofan almost 13 years@EightBitTony - thanks for calling me out on that. i did some research and changed my answer. thanks, i upvoted your comment.