A Bridge to the Cloud...

Oracle VM VirtualBox: Host-only Networking to run servers securely

Simon Coter
Director of Product Management, Oracle Linux and Virtualization

Continuing on the update process of updating old "Fat Bloke" articles wrote in the past, here you can find the updated one dedicated to Host-Only Networking for VirtualBox.

Since the initial blog about VirtualBox and Networking (Oracle VM VirtualBox: Networking options and how-to manage them), 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:

  • Oracle Linux server running MySQL database, Apache webserver, and other stuff;
  • Windows Server 2016 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 (example.com) 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 2016 (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 2016 giving it a static IP address of and name ad.example.com.

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 (7.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: - vdi1.example.com, and set DNS to point to the AD server ad.example.com. 

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 example.com 

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 example.com 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)


Further Stuff


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


Possible Nameserver Issue

One issue that had me scratching my head for some time was that after I added a second interface to my Linux 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 Linux 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:

  • Disable the Network Manager, so it will not restart at next boot.

chkconfig NetworkManager off


  • Use entries in /etc/hosts and ensure that /etc/nsswitch.conf has the line:

hosts: files dns



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


Join the discussion

Comments ( 3 )
  • Demitry Tuesday, July 25, 2017
    Hi Mr Simon,
    This is a very help full article on setting up a virtual test environment using VirtualBox 5.1 without spending money on buying expensive Physical servers. I have tried to setup my virtual environment following your articles. The environment is a test environment for Oracle 2 node RAC where communication between the Linux VMs created on the VirtualBox hosted on Windows7(physical machine) is failing. Is it possible to ask you on this matter?
  • Simon Tuesday, July 25, 2017
    Hi Demitry,

    If you used "Host-Only" network(s) your VMs should be able to talk each other. So, if this is not working I would suggest you to verify, for each VM and each vNIC:

    Settings -> Network -> Adapter (x) -> Advanced -> Promiscuous mode -> Allow All

    and then retry.
    Let me know if it works.

  • Jed Wednesday, December 26, 2018
    The image you reference after this line appears to be the wrong image.

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

    You should show the Adpater tab on the Host-only Network Details
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.