Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > Mac OS X 10.7 Lion

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 16, 2011, 01:08 PM   #1
HenryAZ
macrumors regular
 
Join Date: Jan 2010
Location: South Congress AZ
Flush DNS cache changed in Lion

After a bit of beating my head against the wall yesterday, trying to flush out the local resolver cache, I finally learned it has changed a bit under Lion.

In 10.6, and prior, the method was to issue

dscachutil -flushcache

from a Terminal prompt.

This no longer works, as I learned trying to flush an Address record I knew had changed (because I changed it myself on one of my domains). The new record had propagated on the Internet, and dig was getting the proper response from various external servers. But anything using the local resolver cache kept getting the old IP address, even after "flushing" with the old command.

I tracked it down by doing a dump of the local cache into system.log

sudo killall -INFO mDNSResponder

before and after using the old flush command. The old record remained in the cache, along with lots of others.

I dragged out my 10.6.8 external disk and booted from it. When you issue the old command (dscacheutil -flushcache) under 10.6, the following line is logged to system.log:
Oct 16 10:37:54 helios mDNSResponder[12]: SIGHUP: Purge cache

and of course the cache is flushed.

Using the old command under 10.7, there is no "Purge cache" being logged, and the cache remains intact.

What works under 10.7 is:
sudo killall -HUP mDNSResponder

That logs the purge, and flushes the cache.
HenryAZ is offline   0 Reply With Quote
Old Oct 22, 2011, 06:33 PM   #2
kbmb
macrumors 68030
 
kbmb's Avatar
 
Join Date: Mar 2007
Location: NH
Quote:
Originally Posted by HenryAZ View Post
After a bit of beating my head against the wall yesterday, trying to flush out the local resolver cache, I finally learned it has changed a bit under Lion.

In 10.6, and prior, the method was to issue

dscachutil -flushcache

from a Terminal prompt.

This no longer works, as I learned trying to flush an Address record I knew had changed (because I changed it myself on one of my domains). The new record had propagated on the Internet, and dig was getting the proper response from various external servers. But anything using the local resolver cache kept getting the old IP address, even after "flushing" with the old command.

I tracked it down by doing a dump of the local cache into system.log

sudo killall -INFO mDNSResponder

before and after using the old flush command. The old record remained in the cache, along with lots of others.

I dragged out my 10.6.8 external disk and booted from it. When you issue the old command (dscacheutil -flushcache) under 10.6, the following line is logged to system.log:
Oct 16 10:37:54 helios mDNSResponder[12]: SIGHUP: Purge cache

and of course the cache is flushed.

Using the old command under 10.7, there is no "Purge cache" being logged, and the cache remains intact.

What works under 10.7 is:
sudo killall -HUP mDNSResponder

That logs the purge, and flushes the cache.
Thanks for this. Was wondering if the old method worked or not.

-Kevin
__________________
2010 Mac Pro 2.8 Quad, 27" ACD - Mid 2012 MacBook Air
kbmb is offline   0 Reply With Quote
Old Nov 13, 2011, 03:56 PM   #3
Crismj
macrumors newbie
 
Join Date: Nov 2011
Flush cache

Hello,

I've used this command before as you said and it worked fine, now I am trying to do the same in another computer (Mac 10.7 Lion as well) and it isn't working. I keep getting the old results. Can you help me???

Thank you so much
Crismj is offline   0 Reply With Quote
Old Nov 13, 2011, 04:27 PM   #4
HenryAZ
Thread Starter
macrumors regular
 
Join Date: Jan 2010
Location: South Congress AZ
Quote:
Originally Posted by Crismj View Post
Hello,

I've used this command before as you said and it worked fine, now I am trying to do the same in another computer (Mac 10.7 Lion as well) and it isn't working. I keep getting the old results. Can you help me???

Thank you so much

I just tried my two systems again (updated to 10.7.2 now), and this Terminal command still works here:

sudo killall -HUP mDNSResponder

The easiest way to see if it worked (easier than examining the cache contents), is to open Console, look at system.log, and look for a line similar to this resulting from the command:

Nov 13 15:12:48 helios mDNSResponder[12]: SIGHUP: Purge cache


You might really be flushing the local resolver (on that workstation), but perhaps your router is also caching records in its name server? I don't know if home routers do that as normal procedure, as I don't regularly use their (the routers') DNS services.
HenryAZ is offline   0 Reply With Quote
Old Nov 13, 2011, 05:18 PM   #5
Crismj
macrumors newbie
 
Join Date: Nov 2011
flush cache

Thank you for the quick answer. Well, I did what you said and it appears as you mentioned. Actually, it worked but as soon as I went online it went back to the old numbers again.

I am not really an expert...:-)
Crismj is offline   0 Reply With Quote
Old Jan 3, 2012, 07:52 AM   #6
vikinge
macrumors newbie
 
Join Date: Nov 2006
Thank you

I was searching for a reason why Lion flushdns did not work. THANK YOU!
vikinge is offline   0 Reply With Quote
Old Jan 17, 2012, 02:14 PM   #7
srogers1
macrumors newbie
 
Join Date: Oct 2007
Had to use Lion command on Snow Leopard?

Strangely, I had to use the killall command on Snow Leopard (10.6.8) to get the cache to flush - the dscacacheutil command wouldn't work. I've used that command plenty of times in Snow Leopard, but probably with earlier versions. Could it be that Snow Leopard and Lion both use the new command now? Or is there something else about system configuration that requires one vs. the other?
srogers1 is offline   0 Reply With Quote
Old Jan 17, 2012, 02:32 PM   #8
HenryAZ
Thread Starter
macrumors regular
 
Join Date: Jan 2010
Location: South Congress AZ
It appears the dscacheutil command is simply a shortcut to the killall -HUP method. The giveaway is what is logged on a successful flush, identical by either method:
Oct 16 10:37:54 helios mDNSResponder[12]: SIGHUP: Purge cache

I am unsure why it (dscacheutil) doesn't work for you on Snow Leapord; it does for me, and does not on Lion. Perhaps there is another reason besides simply OS version? I am wondering if dscacheutil -flushcache works for anyone on Lion? I tried it on two Lion installs, but though they are different hardware, they are both set up identically to my liking, and maybe that has something to do with it?

At any rate, it is hardly ever super-useful, as the records can be cached several places.
HenryAZ is offline   0 Reply With Quote
Old Jan 17, 2012, 10:49 PM   #9
srogers1
macrumors newbie
 
Join Date: Oct 2007
Snow Leopard vs Lion

I wonder if dscachutil fails silently if you don't use sudo? I'll have to try that next time I get a chance.
srogers1 is offline   0 Reply With Quote
Old Feb 9, 2012, 01:00 PM   #10
Lane Roathe
macrumors newbie
 
Join Date: Sep 2011
In my testing under 10.7.3 'sudo dscachutil -flushcache' doesn't work (no pause while cache is flushed, no log of purge as when the killall method is used) but the killall method does.

Just as an aside, I also found that MainMenu v2.1.2 (1412)'s Flush DNS option works under 10.6 and 10.7
Lane Roathe is offline   0 Reply With Quote
Old May 9, 2012, 01:55 AM   #11
adt
macrumors member
 
Join Date: Jan 2004
Location: Perth, Western Australia
Anytime you'd like to spell it correctly, there is the option of typing:

dscacheutil -flushcache
adt is offline   0 Reply With Quote
Old May 9, 2012, 03:18 AM   #12
sidewinder
macrumors 68020
 
sidewinder's Avatar
 
Join Date: Dec 2008
Location: Northern California
Quote:
Originally Posted by adt View Post
Anytime you'd like to spell it correctly, there is the option of typing:

dscacheutil -flushcache
Spelled correctly, it still doesn't work. You need to use:

sudo killall -HUP mDNSResponder

As HenryAZ stated...

Also, that command works as stated on my Mac Pro (Early 2008) running Mac OS X 10.7.3. Here is the output to "/var/log/system.log":

May 9 01:13:10 Mac-Pro mDNSResponder[36]: SIGHUP: Purge cache

S-
__________________
Mac Pro: 8-core 2.8 GHz, 10GB RAM, OS X 10.8.4; iPhone 5 32GB iOS 6.1.2
sidewinder is offline   0 Reply With Quote
Old May 10, 2012, 01:28 AM   #13
sidewinder
macrumors 68020
 
sidewinder's Avatar
 
Join Date: Dec 2008
Location: Northern California
Quote:
Originally Posted by sidewinder View Post
Spelled correctly, it still doesn't work. You need to use:

sudo killall -HUP mDNSResponder

As HenryAZ stated...

Also, that command works as stated on my Mac Pro (Early 2008) running Mac OS X 10.7.3. Here is the output to "/var/log/system.log":

May 9 01:13:10 Mac-Pro mDNSResponder[36]: SIGHUP: Purge cache

S-
Just tested Mac OS X 10.7.4 and you still need to use:

sudo killall -HUP mDNSResponder

S-
__________________
Mac Pro: 8-core 2.8 GHz, 10GB RAM, OS X 10.8.4; iPhone 5 32GB iOS 6.1.2
sidewinder is offline   0 Reply With Quote
Old Jul 15, 2012, 04:54 AM   #14
distre1
macrumors newbie
 
Join Date: Jul 2012
Warning?

When I entered the "sudo.." command I receive the following warning...

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

I'm currently a novice at all of this, so just want to make sure I'm not doing something wrong before I enter my password and ruin my system!
distre1 is offline   0 Reply With Quote
Old Jul 15, 2012, 05:02 AM   #15
madmin
macrumors member
 
Join Date: Jun 2012
Quote:
Originally Posted by distre1 View Post
When I entered the "sudo.." command I receive the following warning...

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

I'm currently a novice at all of this, so just want to make sure I'm not doing something wrong before I enter my password and ruin my system!


Everyone gets that message the first time they run sudo, it's normal and not in itself something to worry about. However, running sudo is dangerous if you're not sure what you're doing.
madmin is offline   1 Reply With Quote
Old Jul 15, 2012, 09:04 AM   #16
srogers1
macrumors newbie
 
Join Date: Oct 2007
Quote:
Originally Posted by madmin View Post
Everyone gets that message the first time they run sudo, it's normal and not in itself something to worry about. However, running sudo is dangerous if you're not sure what you're doing.
Right - it's a legacy message that's been around much longer than the Mac. For most average users, you can muck things up much worse without sudo. In the worst case, you have to reinstall the OS, but say, you drag your iPhoto lib to the trash and you're not backed up - you're really hosed then.
srogers1 is offline   0 Reply With Quote
Old Sep 10, 2013, 04:38 PM   #17
J3STER
macrumors newbie
 
Join Date: Mar 2012
so before you flush it if your trying to look at it it was dscacheutil -cachedump -entries host... what would it be now??
J3STER is offline   0 Reply With Quote
Old Sep 10, 2013, 05:08 PM   #18
HenryAZ
Thread Starter
macrumors regular
 
Join Date: Jan 2010
Location: South Congress AZ
Quote:
Originally Posted by J3STER View Post
so before you flush it if your trying to look at it it was dscacheutil -cachedump -entries host... what would it be now??
sudo killall -INFO mDNSResponder

dumps the cache to the System Log (Console).
HenryAZ is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X > Mac OS X 10.7 Lion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
DNS problems after updating to Mountain Lion (10.8) wouteronline OS X 44 Apr 21, 2014 02:51 PM
DNS problems in OS X server (Mountain Lion) mherz Mac OS X Server, Xserve, and Networking 0 Apr 20, 2014 07:06 AM
Mac Mini, OS 10.5.8, Flush DNS Prometheus01 OS X 0 Mar 18, 2013 03:57 PM
DNS Lion Server kingdonk Mac OS X Server, Xserve, and Networking 0 Jun 18, 2012 09:07 AM
Lion server preconfigured DNS settings. (please help!) David Hurd Mac OS X Server, Xserve, and Networking 0 May 31, 2012 09:55 AM

Forum Jump

All times are GMT -5. The time now is 10:40 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC