Using VirtualBox Host-only Networking to run servers in your lap

Since the initial blog about VirtualBox and Networking, there have been lots of people asking how to run multiple server vm's on their laptops, allowing the host to also connect to these servers too. As it happens, I recently needed just such a configuration myself so thought I'd share how I did it...

On my Oracle Linux laptop, I wanted to set up a private network within my host on which I would run:

  • A Oracle Linux server running Oracle VDI which includes a MySQL database, Apache webserver, and other stuff;
  • A Windows Server 2012 providing DNS, DHCP and Active Directory;
  • I also wanted my Linux laptop to be able to reach these guest machines on the private network, too. 

Note that this had to be isolated to within my host machine because I was setting up a new Active Directory Domain ( and we didn't want the Windows Server dishing out DHCP addresses to everyone in the office. But we did want the Linux Server to be able to talk with the Windows Server for directory services and name services.

So logically this looked like:


Creating the Windows Server VM

I used the VirtualBox Manager to create a vm of OS type "Windows 2012 (64-bit)" but before running it for the first time, I modified the Network configuration of the guest to use the VirtualBox Host-only Ethernet Adaptor:

Host Only

I planned to use this Windows server to deliver DHCP addresses for the private host-only network, so I disabled the built-in DHCP server via the Preferences...Network dialog in the VirtualBox Manager (all this can be done form the command line too BTW). Like this:


And in the interests of full disclosure, here are my private adapter settings too:

I then installed Windows Server 2012 giving it a static IP address of and name

After initial install I added extra roles to make the server be an Active Directory Domain Controller, DNS Server and DHCP Server:

AD Services

Creating the Linux Server

The Linux server is an Oracle Linux (6.3) server. Again, I set the newly created vm to use a Host-only network (as above), and installed Oracle Linux, giving it  a static IP address: -, and set DNS to point to the AD server 

This all worked swimmingly, and both machines could see each other and use each other's services:

Ping and nslookup

N.B. the servers running in these vm's are full blown instances so watch out for security settings and the like which block connections between them and the host.

The Host as a member of 

The great thing about host-only networks is that the host itself sits on this network and so can partake in the fun.

The host sees this network just as another NIC:

$ ifconfig vboxnet0
vboxnet0  Link encap:Ethernet  HWaddr 0A:00:27:00:00:00  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2425 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:643528 (628.4 KiB)

Note that the IP address the host uses is configured when you set up the host-only network above.

Using Multiple NICs

I wanted to update the Windows and Linux guests using Software Update, but to do that I needed access to the Internet, which my host only adaptor did not provide for me. One way of doing this is to temporarily switch from Host-only to NAT networking, do the update, then switch back again. And VirtualBox lets you do this while the VM is running which is very cool.

But for my Linux VM I wanted something a bit more permanent. So I created a second Bridged virtual network adaptor so that my Linux VM had an address on my host's network as well as the host-only network. To do this you do have to shutdown the guest OS, and then reconfigure the VM like this:

The guest simply then sees this as another interface: 

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:31:23:9F  
          inet addr:hidden  Bcast:hidden  Mask:
          inet6 addr: hidden Scope:Link
          RX packets:563846 errors:0 dropped:0 overruns:0 frame:0
          TX packets:360395 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:347709416 (331.6 MiB)  TX bytes:260792184 (248.7 MiB)
eth1      Link encap:Ethernet  HWaddr 08:00:27:4D:34:8B  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe4d:348b/64 Scope:Link
          RX packets:468955 errors:0 dropped:0 overruns:0 frame:0
          TX packets:387661 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:354834569 (338.3 MiB)  TX bytes:104217032 (99.3 MiB)

Things to watch out for 


Server Operating Systems typically come as "secure by default" so watch out for firewalls blocking connections. As your host-only network is private anyway you could simply turn the firewall off, e.g. on Linux:

/etc/init.d/iptables stop 

Nameserver woes 

One issue that had me scratching my head for some time was that after I added a second interface to my VDI server, my name resolution stopped working. Eventually I figured it out: Linux has a feature called NetworkManager which detects new networks and reconfigures the system to use them. One of the results of this "reconfiguration" is an overwrite of the /etc/resolv.conf file which points to the nameservers. In my case this meant that the VDI server was no longer using the AD server for DNS. Linux experts could probably tell me how to elegantly fix this, but I found 2 solutions myself:

  1. Disable the Network Manager, so it will not restart at next boot. (sledgehammer)
  2. chkconfig NetworkManager off

  3. Use entries in /etc/hosts and ensure that /etc/nsswitch.conf has the line:
  4. hosts: files dns 


I now have a very cool setup on my laptop which enables to play around with Oracle VDI, MySQL, Apache, Active Directory, and all the other services that Linux and Windows Servers offer, all without disturbing anyone else on the network.


Hope this is useful to someone out there.

- FB


Hi there! Which version of VDI did you use? I thought Oracle Linux 6.3 is NOT compatible with VDI? Is there a new version out?

Posted by Drazenko Djuricic on January 25, 2013 at 09:02 PM GMT #

You can put your dns servers and lookup domain in the interface config itself.
this will then be used by the network manager to fill in the resolv.conf file.

Posted by freek on January 26, 2013 at 07:40 AM GMT #

Drazenko, you have sharp eyes! Be patient.

Posted by Fat bloke on January 26, 2013 at 12:18 PM GMT #

Thanks, I'll give it a go and report back,


Posted by Fat bloke on January 26, 2013 at 12:24 PM GMT #

very helpful!

Posted by Juha on January 26, 2013 at 12:41 PM GMT #

Hi again! Can you at least tell me when the new release can be expected?? Oracle's information policy could really use some improvement! It's next to impossible for us partners to get any information about future versions, release dates, road maps, etc. We're losing customers over this lack of information :( Please let me know the approx. release date of the new VDI version so I can stop checking e-delivery twice a day, OK? :) BTW: are you on Google+ too?

Thanks + best regards,


Posted by Drazenko Djuricic on January 28, 2013 at 12:42 AM GMT #

DJ ,

Yes, we're the VirtualBox team is on Google+ at (but you knew that ;-) )

For notification on VDI releases you could subscribe to the Blog or
follow @ORCL_Virtualize on twitter, or Facebook

- FB

Posted by Fat Bloke on January 28, 2013 at 09:41 AM GMT #

Post a Comment:
Comments are closed for this entry.

Fat Bloke


« July 2016