Virtualbox on Ubuntu Host: Access guests by hostname

I have several VirtualBox appliances (Windows, Linux) each of them configured with two network adapters:

  • NAT for accessing the internet
  • host-only for hosts <> hosts and hosts <> guest communication

Problem is, I can only communicate by IP address. I want to communicate by hostname, ie. I want to be able to reach any host from any other host (or guest) by using the hostname. Is this possible?

I already have a host-only adapter (vboxnet0) on the host machine, and networking is fine, but I would like to avoid assigning static IPs to each appliance.


I suggest you use Multicast DNS to fix this.

Ubuntu is using this by default via Avahi.

The Windows host needs an Avahi-client for it to discover other Avahi-services. If your host already uses some Apple software this is probably already there via a service called Bonjour. However, if this is not already installed then a small version of Bonjour is available for download here: Bonjour Print Services. After installation you should be able to access your guest via .local.

Note: The mDNS system seem to use the .local postfix by default. So, if your hostname is "dev.myapp.com", then the actual hostname will be "dev.myapp.com.local".

Copied from my own answer at superuser.com.


According to the manual (slightly on a different topic):

there is no DNS resolver for internal networking

Therefore you'll need to install one in either of your virtual hosts.

Related: VB Forum