Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I ping a given website from a CentOS 6.2 server console, it pings to that website's old IP address. How can I force CentOS to refresh the cached IP for the website?

I searched and found I could use:

nscd -i hosts

But I get command not found when I try this.


EDIT Adding output of dig as requested, changed real domain for


; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6_2.3 <<>>
;; global options: +cmd
;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20322
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

; IN A


;; Query time: 8 msec
;; WHEN: Thu Jun 21 15:23:03 2012
;; MSG SIZE rcvd: 69

share|improve this question
Could you add the output of dig to your question? – Ladadadada Jun 21 '12 at 18:50
There you go. Google's cache of that result expires in 8084 seconds which is about 2 hours, 11 minutes. After that, it will get a fresh result. – Ladadadada Jun 21 '12 at 21:42
Yes, you are right. The problem is the Google Public DNS. For some reason, it resolves ok, but not for this domain. It has been hours and the issue doesn't fix. – Vero Jun 22 '12 at 1:31

If the DNS was changed recently you may have to wait up to 48 hours for the DNS servers around the globe to catch-up. So, if your CentOS 6.2 server is in a different location it may not be ready yet. You can avoid such delays by reducing TTL (Time to Live) values in your DNS settings a few days before.

share|improve this answer
I forgot to mention that now this website is on this same centos server. Is there a way I can force this centos server to know when it resolves the domain, that it is now located in the server shared IP address? – Vero Jun 21 '12 at 18:38
@Vero yes, I believe if you are using the server as also your nameserver just make sure your values are correct for Bind then restart Bind. – Travis Pessetto Jun 21 '12 at 18:44
Thanks. I have restarted DNS server in WHM (this server has cpanel), but it still pings to the old IP address. The problem happens when pinging to the site, from the same server. I need processes running on server to connect to this website using curl, and they fail because the server is looking for the website in the old ip. – Vero Jun 21 '12 at 18:55

It the IP has been changed for the host name on their DNS server and you are wanting to refresh your local DNS you can run (as root):

/etc/init.d/dnsmasq restart

This will refresh all the cached DNS entries. Sometimes there are other processes that run dnsmasq. You may have to manually kill dnsmasq and restart it using the above command.

(as root)

ps aux |grep dnsmasq
killall dnsmasq
/etc/init.d/dnsmasq start
ps aux |grep dnsmasq

best of luck!

share|improve this answer
Thanks, but there is no /etc/init.d/dnsmasq on server. I looked at /etc/init.d, and no dnsmasq listed. – Vero Jun 21 '12 at 18:54

To ensure your DNS server is reading the current files (do this on the DNS SOA server): rndc reload

To ensure your local DNS cache is flushed so that the old IP disappears (do this on the box that does DNS recursion for your client): rndc flush

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.