How to reload /etc/hosts file in AIX without reboot

20,846

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! :)

Share:
20,846

Related videos on Youtube

Gok Demir
Author by

Gok Demir

I like GNU

Updated on September 18, 2022

Comments

  • Gok Demir
    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
      Mark almost 13 years
      You 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
      EightBitTony almost 13 years
      Need 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
    Gok Demir almost 13 years
    local is listed first. However still it does respect my new entries
  • EightBitTony
    EightBitTony almost 13 years
    ipconfig 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
    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.