Closed taher-pro closed 6 years ago
Unless I am mistaken, I think there is something missing in the documentation. The documentation only covers running a DNS server locally (dnsmasq), but does not talk about getting Mac OS X to find the nameserver. Most references I found about adding the TLD to /etc/resolver/TLD
did not work for me.
After a bit of reading, I found that this address has to be added either via the System Preferences app (search for 'DNS') or the networksetup -setdnsservers Wi-Fi 127.0.0.1
command.
@hussainweb
Thank you for the analysis!
After a bit of reading, I found that this address has to be added either via the System Preferences app (search for 'DNS') or the networksetup -setdnsservers Wi-Fi 127.0.0.1 command.
Is ☝️ working for you?
Unfortunately in my case when I add 127.0.0.1
as a DNS, All the internet pages throw up DNS_PROBE_FINISHED_NXDOMAIN
error along with http://taher.local , https://taher.local
@taherj Yes, I tried it and it worked. Make sure that 127.0.0.1
is the first IP in the list. Double check with scutil --dns
.
Also, try running dig taher.local @127.0.0.1
to see if dnsmasq is working properly.
Okay, I reread and realised what happened. I should have clarified that add on 127.0.0.1
to output from existing entries from networksetup -getdnsservers Wi-Fi
. Can you manually set it to your router's IP address for now?
e.g., networksetup -setdnsservers Wi-Fi 127.0.0.1 192.168.0.1
Replace 192.168.0.1
with your router's address.
On further reading, I found that there is an issue with .local
TLD (not conclusive). In my case, dig
was working fine but ping
wasn't. Like suggested by the answer, I simply tried another TLD .site
. Both dig
and ping
work fine now.
EDIT: More info: https://en.wikipedia.org/wiki/.local
I see this documentation was added in lando/docs#106 and the link over there is the one I referred to as well. However, the documentation missed out on the last section which is to let OS X know to check dnsmasq as well.
@hussainweb
Thank you for all of the above.
After detailed debugging and following the steps mentioned I found
networksetup -setdnsservers Wi-Fi 127.0.0.1 192.168.0.1
dnsmasq
using sudo
. Strangely restarting it without sudo does give a false positive. -- This was isolated by using dig.I will supply a patch for the documentation inline with my learnings shortly.
I got stuck on the second issue as well. There is no error, but apparently it cannot bind to system ports as a regular user. It is an important gotcha for sure. :)
Have you tried visiting http://localhost:32896 ?
@Mchampsee Yes http://localhost:32896 works.
The goal here is to get the TLD to work while we are offline.
I wrote that doc page, huh, weird. I ran through the whole thing and had no issues, but it may be because I had DNSMasq running previously and tore down / rebuilt, so maybe it had some preset magic going. It may also be possible that High Sierra changed something about the setup. The .local domain issue would definitely cause problems, but I've never, ever had to do the whole networksetup -setdnsservers Wi-Fi 127.0.0.1
business, I'd question if that is necessary. The need to add sudo to the restart of DNSMasq could definitely have been something I missed.
@dustinleblanc Would you please inform regarding the following :
127.0.0.1
added in your networks entry already?I understand the issue with the .local
TLD. I have since changed it to .dev
(as per the documentation) and checked as well. It does not seem to work on any browser without adding the 127.0.0.1
to the DNS.
It is probably a macOS High Sierra specific issue. I would propose we keep the docs updated to include these edge cases as well.
Thoughts??
Edit 1: @dustinleblanc You are right. Ideally, we don't really need networksetup -setdnsservers Wi-Fi 127.0.0.1
. Here is a summary :
.local
,.dev
( Google 😞 ) TLDs. refer 1, 2.dev
or any other reserved TLDs they need to add the DNS locally using networksetup -setdnsservers Wi-Fi 127.0.0.1 <router_ip>
The current documentation has .dev
TLD as the example so including 2
makes sense. Or we can update any other TLD instead of .local
,.dev
in the example and we don't need not handle the DNS entry business altogether.
Thoughts??
I had no clue .dev was a no go, wowsers! I've been using that for quite some time (hence the documentation). All four of tld's they list as safe look absolutely lame, but I guess .localhost
makes semantic sense...
I'd definitely support updating it so folks don't run into that issue. I like to err on the side of humor as the Lando team have, so pick something comical imo :1st_place_medal:
Definitely recommend .localhost as well.
What also might help with some dns issues on OSX is doing a
dscacheutil -flushcache
I can't get localhost working without doing the following steps:
For OS X to resolve requests from *.local to localhost we need to add a resolver:
$ sudo mkdir /etc/resolver
$ sudo touch /etc/resolver/local
edit /etc/resolver/local
nameserver 127.0.0.1
re-start the computer to enable the resolver
@pirog, I updated the documentation to get it working on OS X and also added the recommendation to not use *.dev as a TLD for development.
@jbertoen awesome! thanks so much.
@jbertoen i had the same issue on archlinux (manjaro), there is another configuration for my system ??
Bug Report
Setup
Lando version and operating system
v3.0.0-beta.22 on macOS High Sierra 10.13
Local
.lando.yml
What am I trying to do?
Following the instructions for macOS verbatim from Documentation
Error
/usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
sudo brew services restart dnsmasq
~/.lando/config.yml
filelando start
as per step 8 from Documentation I get the followingOffline development using the domain name is not working locally for me.
More Debugging Info
lando info
in my apps directory (ran in a new terminal while thelando start
command was stuck).In Chrome I get the following