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.

| improve this answer | |

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

| improve this answer | |
  • This isn't going to work because the VBox host acts as DHCP server so the virtual DNS server won't be able to resolve the names either. I think static IPs is the only way to do this. – StarNamer Sep 25 '12 at 22:50
  • I know I can disable VBox's dhcp server, so maybe it's possible. – Miguel Ping Sep 26 '12 at 8:23
  • @StarNamer You're absolutely right, the DNS server will not resolve the problems caused by the DHCP server in VB. However, although not practical, the DNS server can be configured to use the currently assigned addresses, but that would not make things any better than editing /etc/hosts files. What @Miguel can do is to disable the VB DHCP server and install one in a virtual machine. I suggest you to consult the Ubuntu Server Guide under Networking and Domain Name Service (DNS). – lgarzo Sep 26 '12 at 9:16
  • @Igarzo That might work. I'd actually suggest something like dnsmasq which is a combined DNS & DHCP server. The question is where to put it; if it's on one of the guest VMs then thast one becomes special and I'm not sure its easy to put a DHCP server on the host and get it to serve the guests. I've never tried it. – StarNamer Sep 27 '12 at 14:00
  • @StarNamer I don't think that a host DHCP server could serve the internal network hosts. VB internal network hosts do not communicate with the outside world, other than hosts connected to the same internal network. Dnsmasq however looks like a good choice. I only tend to suggest Ubuntu Server Guide solutions, to be on the safe side. – lgarzo Sep 27 '12 at 15:21

You need a DNS server to convert the ip to a hostname and vice versa and this unfortunetly this is not supported in Vbox

| improve this answer | |


  • Install / configure / start nmbd service, provided by samba.

    nmbd - NetBIOS name server to provide NetBIOS over IP naming services to clients


  • Edit /etc/nsswitch.conf

Change the line

hosts: files dns


hosts: files dns wins
  • install winbind

    apt-get install winbind

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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