And here’s the answer:
- Turn airplane mode on, then off
The fastest way to do this is to swipe up from the bottom of the screen to access the control center, then tap the airplane icon:
Wait for the other icons to darken, as the phone turns off wifi, bluetooth, and cellular signals, then tap the airplane to turn those back on again. After doing this, you should be able to load anything on your local network using its .local address (as long as it’s configured correctly on the remote device).
This is a temporary solution. Access to .local addresses will stop again at some point and you will have to repeat this work-around to regain access.
Here’s to cause and why this solution works:
At some point, an iOS update seems to have caused this issue. The problem is Apple’s usage of .local addresses for its bonjour services (which allows devices to advertise their services, such as printing an airplay). Bonjour does not play nicely with other services which use .local. Bonjour is somehow interrupting the DNS resolution of these addresses. It intercepts the communication of for example, your browser and the device providing the service and the presenting symptom (at least in my case) is a browser timeout. The browser claims that the website simply stopped responding. Each device has its own strategy to try and resolve domain names. On a mac, that can be configured using the /etc/hosts file, but on an iPhone, the user doesn’t have a way of editing that equivalent setting. What’s more is, the iPhone caches these shortcuts, and it’s that cache that is the problem. Turning on airplane mode flushes that cache and allows your services you’ve manually set up on your network’s devices to get through. However at some point, bonjour is going to come along and cause that cache to be reinitialized and cause the issue to recur. This is why this is not a permanent solution.
What is a .local address?
Dot local addresses are memorable shortcuts to access other devices on your local network. It’s like your own personal dot com. All major OS’s support them: macOS, Windows, Linux, even RaspberryPi. You can use it for screen sharing, file access, web pages, ssh, etc.. If you’re running a web server on a computer in your home, you can access it from a web browser on another device by going to it’s .local address in a web browser, e.g. mymac.local.
I use my .local domains from my iPhone to do a number of things when I’m at home on my local network: screen sharing via the VNC app, ssh via the Terminus app, watching live TV via the iPhone’s Safari browser that accesses my EyeTV media server, and some websites I created for fun. I usually add bookmarks to local web URLs to my home screen for easy access.
How do I find/edit my computer’s .local domain name?
Each mac on your network has a .local address based on your computer’s name. You can find it in the Sharing pane of the System Preferences app. At the top of the pane, there’s a entry field for your computer’s name and underneath that is some descriptive text. You can enter any name you want, but not all characters on your keyboard are allowed to be used in a domain name. macOS thus removes some characters, such as apostrophes, and replaces other characters (such as spaces) with dashes.
I tried using the .local address after this fix, but it doesn’t work.
macOS doesn’t activate a .local address by default. You must share the service you want to use in the Sharing pane of the System Preferences app. The section under the computer name has a panel with checkboxes where you can turn on or off certain services. As long as one is turned on, the .local address is active. However, the only devices that can access it are ones that are on the same network. If you’re trying to access it from an iPhone, for example, make sure that you are connected to the same WiFi network as the computer you’re trying to reach. If all else fails, you can use the computer’s local IP address (assigned by DHCP). You can find that address in the Network pane of the System Preferences app. If that works, and you’ve tried turning airplane mode on & off on your iPhone, then the .local should work. If that doesn’t work, let me know in the comments.
Other things I tried.
I first encountered this issue when I was trying to access my EyeTV media server. I have used this server for over a decade, but about 4 or 5 years ago, I moved and no longer was receiving a good broadcast TV signal. I recently bought a new outdoor directional antenna however, and now had stuff to watch. So I opened up the old bookmark I used to reliably use on my iPhone for years that used the .local address of the computer with the EyeTV media server. It wouldn’t work! I discovered that if I went to the computer’s DHCP address, it did work. I could have just changed the bookmark, but it irks me when stuff that should work, doesn’t, so I called Apple.
Apple Support had me “Reset All Settings” because they could not explain why it didn’t work. (I’ll be submitting a bug report after this post.) It worked! It was a heavy-handed solution and I spent a week returning my phone to its normal behavior. Then the next day I tried to access the server, the problem was back!
Googling this was not much help. There are many solutions out there that suggest things like turning your phone off/on, clearing your browser cache, turning sharing preferences off and back on, etc.. None of them worked. Every once in awhile, I randomly noticed that the .local addresses started working, but shortly there-after would stop working again. And I didn’t want to have to reset all settings every time this happened. Finally, after reading about the /etc/hosts file and mDNSresponder, I started googling things like “reset iphone dns”, which lead me to a solution for another problem that involved cycling the airplane mode setting and to my delight, it worked.
I’ll probably use the DHCP-assigned IP address for bookmarks in the future, but I finally know enough about what’s going on to be satisfied. I hate it when things don’t work.