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
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.