I would like to route all my *.local or *.dev domains to a specific IP, either the IP of my Ubuntu VM or localhost. Is this possible? Can I use the /etc/hosts file?

I am running Mac OS X Snow Leopard with Ubuntu Hardy Heron LTS - JeOS on VMware Fusion 3.

Right now I just keep making /etc/hosts records for each one and I would rather it be like wildcard DNS and let Apache handle the domains then manually entering it each time. I like the flexibility to update this when I do something odd or someone gives me a strange request but 90% of it I think would be best automated.

link|improve this question
feedback

4 Answers

up vote 0 down vote accepted

Unfortunately you can not add wildcard entries to /etc/hosts file. That being said This Article demonstrates a method that works with Tiger. Although I think launchctl is deprecated as of leopard but it may still work.

link|improve this answer
thanks, I got it setup with this link as well jumping between them both: geoffhankerson.com/node/108 – joelpittet Oct 30 '09 at 17:19
This one also helped and was more consolidated than jumping from one to the other: grahamweldon.com/blog/… – joelpittet Oct 30 '09 at 18:12
feedback

Setting-up the wildcard response in the apache configs is straightforward, but apache has nothing to do with your local name resolution - it only accepts connections that have been handed to it, so it's up to the network stack to direct the connection in the proper direction first.

As far as I know, this means you need to either be running a local DNS server on your network/machine, or you need to add entries in /etc/hosts for every dev domain.

link|improve this answer
feedback

Run something like dnsmasq, which will let you add a few custom DNS entries, but forward everything else to your normal DNS server.

link|improve this answer
feedback

We setup the BIND DNS-server on a linux machine to point the *.dev TLD to an Apache machine. We advertise this DNS-server to all LAN clients via DHCP, so all requests go through this server and can resolve .dev.

In the Apache config we're using so-called mass-virtual-hosting to avoid having to edit the config for every new site. This way we can simply create a new directory with the correct naming convention and it will be found.

link|improve this answer
I am working local, from Snow Leopard to Ubuntu VM, is there a reasonable setup for Bind on Snow Leopard? – joelpittet Oct 30 '09 at 16:46
feedback

Your Answer

 
or
required, but never shown

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