10

The typical way of flushing the dns cache does not seem possible in Amazon Linux AMI:

  • service nscd restart does not work because it's not included within the VM.
  • service dnsmasq restart does not work because it too is not part of the VM.
  • service dns-clean restart does not work because it's not part of the VM.

Amazon does use the old /etc/init.d/networking for network setup; would restarting this also flush the DNS cache?

1
  • 1
    What DNS cache?
    – sciurus
    Feb 18, 2014 at 4:26

2 Answers 2

13

There is no DNS cache unless you have installed and configured nscd or a caching name server.

1
  • 1
    I seem to have a somewhat related issue; there's no DNS cache, but something definitely seems to have cached the namesevers to use and I can't figure out how to force the server to realise that the nameservers have now changed... Any ideas?
    – El Yobo
    Sep 29, 2014 at 7:25
14

This is because your EC2 instance uses amazon's dns server, which you can't refresh (e.g. 172.xxx.xxx.xxx). you just have to wait it out.

1
  • and if you really can't wait for it, a temporary workaround is to fake it by putting a DNS entry into the /etc/hosts file (but remember to delete it later!), assuming that it's one particular entry you're trying to refresh.
    – Octopus
    Feb 7, 2017 at 23:30

You must log in to answer this question.