قالب وردپرس درنا توس
Home / Mac / Slow DNS lookup after MacOS update

Slow DNS lookup after MacOS update



I used to have a problem that DNS lookup on one of my Macs was very slow – like in the glacier. It can take 30 seconds to get an answer when all other devices on the network were fast. One night I decided to just dig through this problem until I found the problem, and since I did, I might find it interesting for someone else who might have the same problem.

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

If you hadn't heard, an old trick to blocking a particular server is to redirect the name to your own computer. To do this, edit 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 particularly annoying.

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

The solution for this would have been to simply add IPv6 addresses to all these servers as well as this

but at that time I decided that I had had enough and just removed my old block list. I have to make a Pihole server at some point instead.

Since the / etc / hosts trick was very common in the day, I realized that this could also affect someone else.


Source link