I'm trying to set up my local web development environment to map all .test domains to 192.168.10.10 IP. The problem is that I find all the tutorials extremely confusing.
Here's what I did already:
I installed dnsmasq using Homebrew with brew install dnsmasq command.
I put address=/.test/192.168.10.10 to /usr/local/etc/dnsmasq.conf.
I'm not sure what to do with the resolver. I have an /etc/resolv.conf file containing nameserver 172.20.10.1 (I don't know where it comes from) and then some tutorials say to create /etc/resolver/test file and putting nameserver 127.0.0.1 there.
Here's where I'm lost. First of all, which resolver should I use? The resolv.conf file or /etc/resolver/test? If that's the latter one, should I edit out the resolv.conf? And also, should I put nameserver 127.0.0.1 or nameserver 192.168.10.10? I don't understand if that's supposed to be the IP of my local machine (127.0.0.1) or my web dev machine (192.168.10.10).
Please help me to understand it better.
Related
I'd like to point all *.test domains to my Laravel Homestead machine on 192.168.10.10. I used to have it working with *.dev domains, but after new *.dev policy implemented by Chrome 63, I prefer to change it to *.test.
I fail to understand how local DNS works, as it seems to use trillion different configs and caches. What I did is:
Making sure 192.168.10.10 with HTTP Host set to me.test works. It works.
In /usr/local/etc/dnsmasq.conf, I do have an entry address=/.test/192.168.10.10 (I also tried with 127.0.0.1)
In /etc/resolver/test file, I put nameserver 127.0.0.1 - it used to work this way with /etc/resolver/dev. I still don't understand why it's 127.0.0.1 and not 192.168.10.10. I tried both anyway.
Clearing DNS cache with sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache
Restarting dnsmasq with sudo launchctl stop homebrew.mxcl.dnsmasq; sudo launchctl start homebrew.mxcl.dnsmasq.
Trying to visit http://me.test/.
It doesn't work. The domain will take forever to be loaded and nothing happens.
What am I doing wrong?
My OS is High Sierra, dnsmasq installed via homebrew.
I don't use dnsmasq, but I believe you want to edit /usr/local/etc/dnsmasq.conf and have listen-address=127.0.0.1 set so dnsmasq is listening on that IP, but have address=/.test/192.168.10.10 so that .test is routed to 192.168.10.10.
Then make sure System Preferences -> Advanced you have 127.0.0.1 as the first DNS server entry for your connection.
Make sure you're restarting dnsmasq every time you edit the configuration file.
Hey guys I have two vagrant machines running, one is the app code base and the other is the api code base for the app. I want to be able to do a curl call from my app machine to the api machine.
On my computer I can call both because I have them in my etc/hosts file, but what do I need to do to successfully request from vagrant to vagrant.
I tried to go into my app vagrant machine's etc/hosts and add the domain with the 127.0.0.1 but no cigar.
So it turns out that Vagrant makes your guest machine's ip to 10.0.2.2. So what I did on my App code base vagrant machine. I edited the /etc/hosts to;
10.0.2.2 api.local.com
previously I tried 127.0.0.1, and that didn't work, so I just checked the apache access logs saw the ip and gave that a whirl. and that worked.
On my local machine I have;
127.0.0.1 api.local.com
I hope this helps.
So I'm using dnsmasq for my local dev environment & I need to set it up to use multiple domains ex. (.dev, .test, .somethingelse) how can this be done?
currently It's working with .dev only
this is how my dnsmasq.conf looks like
address=/dev/127.0.0.1
listen-address=127.0.0.1
For every (sub)domain you want to server locally, add the following entry to your dnsmasq.conf:
address=/.domain/127.0.0.1
Now let your OS know, that you want to redirect requests to this domain to your local dnsmasq nameserver. Do this by creating a file "domain" in "/etc/resolvers".
/etc/resolvers/domain has the following content:
nameserver 127.0.0.1
More info about the resolver thing.
A more generic answer would be to have in /etc/dnsmasq.conf
local=/mylan/
and in /etc/hosts
192.168.1.3 dev dev.mylan
192.168.1.3 test test.mylan
192.168.1.4 build build.mylan
as per https://serverfault.com/questions/136332/setting-up-dnsmasq-for-a-local-network
(note that the solution comes in aid for the DHCP settings where you cannot have 2 hosts on the same IP, as the OP liked)
for me, address=/.aaa.com/.bbb.com/127.0.0.1 do the trick.
.dev is not recommended to be used in development as Google actually owns that top level domain.
You might want to use reserved TLDs, like .localhost, for development.
Good article about the same problem: https://web.archive.org/web/20180722223228/https://iyware.com/dont-use-dev-for-development/
In your /usr/local/etc/dnsmasq.conf add:
address=/dev/test/127.0.0.1
And then create files:
/etc/resolver/dev and /etc/resolver/test. Both with content:
nameserver 127.0.0.1
From now all xyz.dev and xyz.test domains will point to 127.0.0.1.
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.
Here the problem, I have two servers on EC2, which have internal/private IPs (10.148.73.230, 10.148.73.231), unfortunately I do not have Elastic IPs available and connect to these servers using External DNS like: ec2-50-132-69-161.us-west-2.compute.amazonaws.com (IP:50.132.69.161) and ec2-50-132-69-162.us-west-2.compute.amazonaws.com (IP:50.132.69.162).
I have macbook and now I need to simulate access to these EC2 servers using their internal IPs.
The first idea was to setup IP forwarding on mac using: ipfw and natd... but after several hours it still not working for some reason. Im fine to make quick and dirty, or using any GUI, but didn't find any...
Desperate for help, here my current script:
sysctl -w net.inet.ip.forwarding=1
ipfw add 1000 forward 10.148.73.230,80 log ip from me 80 to 50.132.69.162) dst-port 80
/usr/sbin/natd -alias_address 10.148.73.230 -interface en1 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface en0 -redirect_port tcp 50.132.69.162:1-10000 1-10000 -l
Or is there any better solution to make the forwarding?
Just taking a shot in the dark here as as windows/linux guy. I do understand your problem with EC2 and use it myself, generally with elastic ip's however.
Is it possible to just setup the hosts file like you could on windows/linux??
http://support.apple.com/kb/TA27291?viewlocale=en_US