Closed dominiquevilain closed 4 years ago
If it's being caused by dnsmasq, I wonder if you could remedy it by editing the dnsmasq config. There are a few ways that could be done, some of which are more complicated than others.
One way is to manually edit ~/.config/valet/dnsmasq.conf
and add the following:
# alternate dns servers
server=1.1.1.1
server=1.0.0.1
server=8.8.8.8
Note that if you run valet tld xyz
to change valet's default tld from .test
to .xyz
it will replace all changes in that file, so you'd have to apply the edits again.
Thanks for the answer. It’s ok with this update of the config.
I’m sorry, it was a false positive (was in a rush and concluded a bit fast).
I reopen the issue because it’s still not working.
I’ve tried to completely remove valet (including dsnmasq) from my computer and Internet Sharing came back to life, including through Lightning/USB connection.
Then, I installed Valet again and Internet Sharing stopped. I tried to fix the config, adding the servers like suggested by @drbyte, but it didn't change, Internet Sharing was still broken.
I’ve read extensively about DNSMasq configuration before coming back here, but I feel a bit overwhelmed by the amount of settings and possible interactions.
I’ve installed a network analyzer on my iPhone and noticed that the IP address it uses while connected through USB is an APIPA address (169.254.x.x), not coming from my computer if I understand correctly.
I've not used USB tethering in awhile, and previously that was only to share the phone's connection to the Macbook, not the other way around as a sharing service from the Macbook.
However, after setting it up just now: it works for me.
This is what I did:
sudo brew services stop dnsmasq
, then sudo brew services start dnsmasq
Note: I do have the extra DNS settings in my config like I mentioned in my previous post above. I didn't test without them. Also, in System Preferences, Network, Adv, DNS I have 127.0.0.1 as the only DNS Server.
Thanks Chris for your clear and detailed explanation.
It doesn’t seem to work for me…
Following your steps, my phone detects no Internet connection.
I’ve also tried to just stop DNSMasq (and checked that it is actually stopped with brew services list
), but Internet Sharing fails to work again. In this case, it’s a bit different though. Some apps seem to detect that there is an internet connection (for instance, Photos tries to update and Tidal activates some online functionnalities) but there is no data coming to the phone. I suspect a problem with DNS resolution.
The only way to make Internet Sharing work again is to completely uninstall valet :(
Diagnostic question to help narrow down the scope:
When you say "completely uninstall valet", have you tried simply brew uninstall dnsmasq
, and then the Sharing works again?
Valet can't work without something telling your DNS to resolve the local domains ... But in theory instead of dnsmasq you might get away with manual edits to your hosts
file for the domains you know you want to serve with valet.
I understand why dnsmasq is included in the package and I know I can get rid of it, but then we lose a bit of the interest of valet which is something like « don’t worry too much about the infrastructure and the settings, just focus on your app ». Maintaining the hosts file is not my favorite occupation.
About the diagnostic question, I’ve been a bit more violent than that 🤗
Removing with valet uninstall
was not enough to get sharing back.
After uninstall
, it appeared that the services (nginx, dnsmasq, php) were still there (diagnosed using brew) and running! The uninstall
process said it succeeded but nope… maybe a permission issue?
So I stoped and uninstalled the services added by valet with brew and checked that everything was ok with brew doctor
. It appeared that a cleanup was still necessary. brew cleanup
failed because of permissions issues, so I removed the remaining links manually with rm
.
After that, I've searched for all traces of valet components (valet+nginx+dnsmasq) using the find
command and removed everything I found (there was a small amount of files & folders remaining).
Then I restarted the MacBook Pro and reset the DNS settings in SP/NWK/ADV/DNS to auto.
Internet Sharing came back 🎉
So I finally decided to go back to MAMP Pro. Sounds old school, but I've spent a significant amount of time trying to find a way to make it work and I don’t want other people to lose more time neither (and thanks to you!).
Trying to use valet was part of the process of reinstalling my MBP with the new OS. Obviously, it didn't work as expected. I don’t necessarily care about extreme speed and low ram impact, and I don’t need virtual machines nor docker containers since I work alone and can deploy easily using git. So MAMP Pro is an acceptable solution for me.
Do I close or do you consider the issue still pending?
@dominiquevilain Thanks for your responses, and @drbyte thanks as always for helping out here! I would say since neither Chris nor I can reproduce this, and you've found something you like well enough for yourself, we can close it. Thanks!
For several months, I use my MacBook Pro as an internet relay for my iPhone through USB most of the time, and rarely through WiFi too.
Recently, I've decided to drop MAMP and use Valet instead for web development.
Since then, it no longer is possible to use my MBP as a relay for my iPhone, whatever the kind of connection, WiFi or USB.
After several hours of investigations and a clean install of Mac OS Catalina, it finally appeared to me that the problem was coming from DNS resolution. The suspicion came from the fact that some apps seemed to detect that there was a connection, but failed to retrieve datas from the Internet. Sharing my connection through WiFi, I've been able to use my MBP again as a relay by defining manually a DNS Server address on my iPhone (8.8.8.8). Unfortunately, setting a DNS Server manually for the USB connection is not possible (or I don’t know how).
I guess the problem comes from dnsmasq, installed with valet and used for DNS resolution locally on the dev machine. Maybe is it linked to an interaction with mDNSResponder, the server involved natively by Mac OS in Internet Sharing ?
Has anybody encountered such an issue before ? If yes, how do we have to configure dnsmasq to make sharing of Internet connection possible again ?
I’m using a fresh Mac OS Catalina on a mid-2012 ❤️ MBP and an XS Max iPhone with the latest iOS.