Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have the following scenario: A host machine (OS X) and a guest machine (Ubuntu). The guest is running through Virtual Box, and the network configurations is set to "Bridged adapter". Both machines have a hostname, host.local for the host, and guest.local for the guest. They can communicate with each other using the hostnames, e.g. ping host.local.

I'd like to use the guest machine as a development server for websites. The sites will be located on the host, and are accessible to the guest using a shared folder. I've configured Apache to use a virtual document root, which will make the sites available on site.guest.local. However, this would require me to setup site.guest.local, site2.guest.local etc in my hosts file, pointing to the IP of the guest.

I don't want to depend on the IP address of the guest, since the computer might be connected to different networks, with a different IP address from time to time.

I've been fiddling around with a local DNS server, specifically DNSMasq, trying to create CNAME records etc, but I can't figure out the proper way to achieve this.

In short terms, I want to create a local alias that points to guest.local.

share|improve this question
I've managed to solve my problem with a workaround. I've setup my guest to use two network interfaces, one bridged, and one host only. The host only will have e static IP and will only be able to communicate with the host, and the bridged will have access to the outside world. Using the static IP, I'm able to use DNSMasq to create an address that points to the guest. – Olof Johansson Jan 3 '13 at 12:19
If you would like, you can answer your own question without any problem. Cheers! – Karolinger Jan 8 '13 at 1:41
Yeah I know, but I don't consider my solution as the answer to my original question, as it's a simple workaround :) – Olof Johansson Jan 8 '13 at 10:06

I use vagrant to manage VirtualBox VM's. They're all setup with host-only networking, a static IP, and an entry in /etc/hosts. Make sure VirtualBox's host-only network is set to NAT (VirtualBox / Preferences / Network).

The guest is be able to access the outside (assuming it's networking is configured correctly), and the virtual interface is translated by NAT so you can choose your own IP.

This may not help, but here's a line from one of my Vagrantfile's: :hostonly, "", :auto_config => true

If the IP of a guest ever collides with another device on the network, update the IP address of the host-only adapter (VirtualBox / Preferences / Network) and the static IP in the VM.

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.