Flush DNS cache on Centos Server

Flush DNS Cache on CentosI have a client with a Centos 6.9 server acting as the internal DNS server.  This client made some DNS changes through register.com for their domain. If the TTL (time to live) for the DNS record is too long the local DNS server will not refresh the entry until the TTL expires.  If you confirm that a public DNS lookup is showing the correct DNS record and your local DNS server does not have the update yet, the below steps to manually flush dns cache may work for you.

  1. SSH into your Centos Server as an account that has the necessary permissions (root works)
  2. Enter “service nscd restart” and press enter
  3. Next Enter “/etc/init.d/dnsmasq restart” and press enter
  4. Enter “nslookup [domainname.com]” and press enter to confirm the record is refreshed

This may not work for everyone or for every version of Centos but It Fixed it for me.

Hope it helps.

For some of our other Linux Lovers posts