Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Enthusiast Zone > Networking > Slow DNS lookups after MacOS update

Slow DNS lookups after MacOS update
Thread Tools
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Feb 13, 2019, 09:19 AM
 
I used to have a problem that DNS lookups on one of my Macs were very slow - as in, glacial. It could take 30 seconds to get a response, when every other device on the network was fast. One evening I decided to just dig through this problem until I found the issue, and since I did, I figured it might be interesting for someone else who might have the same issue.

The TL;DR is that I had an /etc/hosts file full of dummy redirects to block certain spammy sites, as I tried to avoid installing a full adblocker for the longest time. Because of a change in how MacOS handles these lookups, this was now the cause for the slowdowns.

If you hadn't heard, an old trick for blocking a certain server is to redirect its name to your own computer. You do this by editing the /etc/hosts file to say

Code:
127.0.0.1 spammysite.com
after all the other things that are there at startup. I had done this with a number of servers that I found especially annoying.

What I discovered during my investigation was that this caused the Mac to see those addresses, but notice that they only had IPv4 addresses. It then proceeded to look up the IPv6 addresses for all of these. Since IPv6 fails in my setup (which is probably due to the super-old cable modem I have from my ISP), it retries, one addresses at a time. My slowdowns were the timeout for IPv6 lookups.

The fix for this would have been to just add IPv6 addresses to all those servers as well, like this

Code:
::1 spammysite.com
but at that point I decided that I had had enough and just removed my ancient blocklist. I need to make a Pihole server at some point instead.

Since the /etc/hosts trick was very common back in the day, I figured that this might affect someone else as well.
The new Mac Pro has up to 30 MB of cache inside the processor itself. That's more than the HD in my first Mac. Somehow I'm still running out of space.
     
turtle777
Clinically Insane
Join Date: Jun 2001
Location: planning a comeback !
Status: Offline
Reply With Quote
Feb 16, 2019, 02:59 PM
 
Interesting and good to know.

I never used this scheme.
If I had to block stuff, I used Little Snitch.

-t
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:44 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,