OSX, .local domains are not resolved - macos

I am running a webserver on my Mac with OSX 10.9. In our LAN my IP is connected to example.local, so that everybody in the LAN should access my webserver.
Unfortunately, the .local doamin is not resolved correctly from my Mac. As far as I could find out is probably due to the Bonjour service, which claims to be the .local domains.
How can I solve this problem?

Quick fix, add example.local to a line in your /etc/hosts file:
127.0.0.1 example.local

Related

Hosts file ignored Mac 10.11.4 El Capitan

I am running a RoR app on my local. I have some translations in my hosts file.
127.0.0.1 localhost
127.0.0.1 example.dev
127.0.0.1 www.example.dev
127.0.0.1 api.example.dev
They were working fine, until I updated my OS to 10.11.4. If I send ping request to www.example.dev, it seems to work fine. The IP it translates to is 127.0.0.1.
But when I visit www.example.dev in my web browser, it seems to ignore hosts file and ping DNS server for IP.
I am not sure how, but going to localhost in browser does translate to 127.0.0.1.
Dont know why but ive disabled my lookback adapter and ipv6 and now its working.
so in your host file disable these two items
# ::1 localhost
# fe80::1%lo0 localhost
Some fubar osx bug... I miss steve....
I came across this while searching for an answer to a similar problem and wanted to post my findings for anyone else in the same position.
As a team of three, we found that edits to my /etc/hosts file appeared to work, while editing the other two's host files seemingly did not. Upon further digging, we realized I was on OS X 10.10, while they were on newer versions.
We found, after trying about a million things, that additions to the hosts file in 10.11 and up apparently could not have more than one space between the IP and the domain, for example:
DID NOT WORK:
1.2.3.4 some.site.com
DID WORK:
1.2.3.4 some.site.com
After making this change, we immediately started seeing expected results without any cache clears, reboots, or otherwise.
The host you are overriding is resolving via IPV6. ::1 is the loopback address for IPV6 which is analogous to 127.0.0.1 in IPV4. Add the following entries as the last lines in your /etc/hosts file.
::1 localhost::1 www.example.dev

Mac cached routing? (traceroute)

So I got a problem regarding access to my website. Whenever I run traceroute on my computer it returns the correct traceroute to the correct site. However when I run it on someone elses pc it gives a completely different traceroute but wrong traceroute (an old one).
Some info that might help:
- My PC: Windows
- His PC: Mac
We both loaded the sites a few times before and he is still on the old traceroute from a couple of months back.
I already tried clearing the DNS server of Mac OS X, Rebooting it, Clearing browser cache (even a full reset of the browsers) and still it is not loading in any of the browsers.
if IP address of remote website is different, try to manually set DNS server to check if it solves the problem
static DNS can be changed with nslookup (windows, maybe on mac also)
you can set manual DNS by the 'server' command in nslookup prompt :
C:\Users\me>nslookup
Default Server: nfdns.bezeqint.net
Address: 192.117.235.235
> www.stackoverflow.com
# this is my dns
Server: nfdns.bezeqint.net
Address: 192.117.235.235
Non-authoritative answer:
Name: stackoverflow.com
Addresses: 104.16.37.249
# changing dns server
> server 1.2.3.4
Default Server: [1.2.3.4]
Address: 1.2.3.4
# now can check again with the new dns
> www.stackoverflow.com
Just found it, I overlooked the /etc/hosts file, so there was still an error in it. Thanks for helping!

dnsmasq doesn’t resolve domains while internet connection is disabled

On mac OS (El Capitan) I have a virtual machine vagrant with laravel-homestead box. In one of my dev projects I need to use dynamically created subdomains for each user registered on site (e.g. user.sitename.dev, user2.sitename.dev, etc.). So, I used dnsmasq to do this and everything works fine but only with internet connection. If I disable connection, dnsmasq doesn’t resolve domains. Here are my configuration files:
Local:
/etc/resolver/dev:
nameserver 192.168.10.10
/usr/local/etc/dnsmasq.conf:
address=/.dev/192.168.10.10
Virtual machine:
/etc/dnsmasq.conf:
local=/dev/
domain=dev
address=/.dev/192.168.10.10
/etc/nginx/sites-available/sitename:
server_name sitename.dev *.sitename.dev;
What can be the reason of this problem?

Access virtual host from guest os ( oracle virtual box)

I am using ubuntu 11.10 and have installed different virtual host on different ip like
127.0.0.2 www.example.local
127.0.0.3 www.wordpress.local
... etc
I want to test these website in IE9, for this i have install windows7 in oracle virtual box and also modified host file of windows7 and add this line 10.0.2.2 localhost at the end of the file and also create a new bridge adapted.
After all this setup i can access localhost of ubuntu from windows7, but find problem while accessing virtual host of ubuntu.
Please help me to access these virtual host on windows 7, i have already search google, ubuntu forum and stackoverflow for this but didnt find right answer.
If I understand you correctly, you want the virtual adapters ip, ie. the gateway ip.
Just add those lines you have added to Ubuntu's host file to the host file in your Windows 7 VM, replacing 127.0.0.x with 10.0.2.2 should make your Windows VM connect to your Ubuntu host for requests to those hosts. This should usually sufficient, unless your HTTP server is configured to serve www.example.local only for connection to 127.0.0.2 and similar for www.wordpress.local.

Using dnsmasq on a Windows VM in VirtualBox on a Mac (+ MAMP)

I'm using dnsmasq on the Mac (OS X 10.7) to facilitate local development (along with MAMP), with just this pretty simple config:
[dnsmasq.conf]
address=/dev/127.0.0.1
.. pretty darn simple. All my *.dev domains resolve to 127.0.0.1 (localhost). Together with:
[DNS Servers]
127.0.0.1
8.8.8.8
8.8.8.4
..as my Mac's DNS settings, this works a treat.
But then I also have a pretty stock Windows 7 SP 1 VM running in VirtualBox (latest). It uses 10.0.2.* as its IP subnet within Windows. At the moment I have to use a service like http://xip.io + another hostname alias to use my *.dev sites in Windows, e.g:
[ if Mac's local IP is 192.168.1.50 ]
something.dev.192.168.1.50.xip.io
..and I need to have this extra ServerAlias manually set up in my Apache config, and keep it updated each time my local IP address changes.
Is there any way I can set up either dnsmasq, VirtualBox, or my Windows IP settings (or a combination of these) so that I can use my .dev hostnames (e.g. http://something.dev/) directly from Windows?
Try this:
https://github.com/stackia/DNSAgent
It has functions similar to Dnsmasq server= and address=
and a rule converter: https://stackia.github.io/masq2agent/
If you mean that you want to run something like dnsmasq on your windows vm then I share your pain. I have been trying to get something setup on a windows host to do wildcard localhost sites without doing something like xip.io but I am having problems getting it to work. Dnsmasq on the osx machine I have was a breeze, but trying to get Acrylic DNS to work on windows the same way hasn't worked. I do have it running as a local caching DNS, and it should be doing the wildcard part, but having problems getting over the final steps.
Check it out. Looks neat, free, and a dnsmasq alternative on windows. And if you get it working post your results! I'll do the same if I can get it going.

Resources