Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Assume I have a VM running on OSX with private IP which can be accessed from the host machine.

I was wondering how can I map a pseudo domain, *.app.dev, to the private IP on my host machine so that on my host machine I can resolve the domain *.app.dev to

The purpose of this setup is to have virtual environment for development and not pollute my host machine with unnecessary packages and services.

edit: I realize that /etc/hosts can accomplish non wildcard domain names, I should have been more clear and mention wildcard domain names.

share|improve this question
up vote 2 down vote accepted

You can do this with dnsmasq.

Dnsmasq is a very small DNS server usually used as a proxy. It offers a lot of ways to manipulate DNS lookups, one of which is to respond to all DNS queries for a domain with a single IP.

The example dnsmasq.conf file has specific example for this:

# Add domains which you want to force to an IP address here.
# The example below send any host in double-click.net to a local
# web-server.

The following 2 lines are all that you would need to get running


(You can change the server parameter to whatever upstream server you want. Or use resolv-file to use a resolv.conf file)

Then just configure your system to use as a DNS server.

share|improve this answer
Thanks for this answer, (with the help of bhamrick.com/2013/04/18/…) I was able to achieve the desired outcome! – Bill Oct 27 '13 at 3:44

The easiest way is to add the following line to /private/etc/hosts:  app.dev 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.