How can I flush the DNS Cache?

  • How can I clear my DNS cache on my android phone? (Droid3, Gingerbread, rooted to be specific)

    Ideally I'm looking for a command to run through a terminal emulator, something similar to

    ipconfig /flushdns
    

    On a windows machine.

    What's the Linux version of this?

    Do you need to do this for a system app, third party app or your app?

    Third party I guess? I need it for when I ping a server via Terminal Emulator.

    Please update your title to reflect that you want a CLI-based answer. This is ranking in Google and 99% of people searching this title do not have root or CLI skills.

  • onik

    onik Correct answer

    9 years ago

    On a typical Linux system the cache is cleared by running /etc/init.d/nscd restart, but at least my ROM doesn't use nscd to cache DNS. You can check if yours does, but I doubt it. I've seen suggestions that clearing the brower cache would clear DNS cache too, but one sure way is to do a hard reboot (shutdown, remove battery for 30s, reattach battery and boot).

    All of my googling also brings up the "hard reboot" suggestion.

    I'm downvoting because the answer requires root and/or assumes shell access which is unrealistic for most Android users. The rest of the answer did not solve my problem. Also I believe Matthew Read should reconsider locking the question because this is absolutely not a "done deal." DNS is extremely complex and there will be more legitimate answers from people without Android accounts here yet, I'm an example of that. FWIW I do have 10+ reputation and still could not answer the question.

    @PJBrunet To be accurate, you have 1 rep and 100 rep from association bonus, which does not count since you haven't earned it on this site. See What is a "protected" question? for more details. As for the question, I'll unprotect it for now.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM