Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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, *, to the private IP on my host machine so that on my host machine I can resolve the domain * 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

2 Answers 2

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 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…) 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: 
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.