How can I refresh cached IP for a website in CentOS

8,117

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:
8,117

Related videos on Youtube

Vero
Author by

Vero

Updated on September 18, 2022

Comments

  • Vero
    Vero almost 2 years

    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.

    Output of dig www.example.com, as requested:

    ; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6_2.3 <<>> www.example.com  
    ;; global options: +cmd  
    ;; Got answer:  
    
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20322  
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0  
    
    ;; QUESTION SECTION:  
    ;www.example.com.         IN      A  
    
    ;; ANSWER SECTION:  
    
    www.example.com.        8084    IN      CNAME   example.com.  
    example.com.            8084    IN      A       xxx.xxx.xx.xxx  
    
    ;; Query time: 8 msec  
    ;; SERVER: 8.8.8.8#53(8.8.8.8)  
    ;; WHEN: Thu Jun 21 15:23:03 2012  
    ;; MSG SIZE  rcvd: 69  
    
    • Ladadadada
      Ladadadada about 12 years
      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.
  • Vero
    Vero about 12 years
    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?
  • Travis Pessetto
    Travis Pessetto about 12 years
    @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.
  • Vero
    Vero about 12 years
    Thanks, but there is no /etc/init.d/dnsmasq on server. I looked at /etc/init.d, and no dnsmasq listed.
  • Vero
    Vero about 12 years
    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.