6

I know I can manually flush the DNS cache, e.g. with sudo killall -HUP mDNSResponder.

But how long will the cache last if I don't do this? Does it reset on a reboot?

14

You can flush the local DNS cache with the following command:

dscacheutil -flushcache

How long a DNS entry is cached typically depends on the TTL of that DNS record, which is configured by the DNS admin of the relevant hostname.

You can find out the (remaining) TTL of any given DNS record with the dig command:

dig apple.stackexchange.com

In the answer section you'll see the remaining TTL right next to the hostname (in this example 257 seconds).

;; ANSWER SECTION:
apple.stackexchange.com. 257    IN  A   198.252.206.16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .