Configuring the Oracle VirtualBox Network

In “Create a private Oracle test lab” I made the case that there is no excuse for someone who considers themselves to be a professional DBA to not have their own personal database for testing and learning. I pointed out that by using Oracle’s VirtualBox product, Oracle Linux, and Oracle database under the terms of the developer license agreement, one could create their own private test system legally and at no cost. In this article I will detail how to configure the virtual machine network components so that you can deal with them in exactly the same manner as a live server in your organization’s data center.

When I first started working with VirtuaBox the first problem I ran into was dealing with the network configuration and the differences between VirtualBox and VMware, which I had been using previously.

I am not a networking expert and it is not my intent to give a detailed comparison between the way it is handled in VMware vs. VirtualBox. Rather, I simply want to lay out what I discovered I needed to do to get my virtual servers running under VirtualBox to network according to my requirements.

My requirements for the virtual machine network

When I create a vm on my desktop, have four fundamental, non-negotiable requirements:

  1. I must be able to work with, access, and manage the VM exactly as I would any real server in my data center. That means it has to be accessible from my desktop OS using exactly the same tools I use with my live database servers: putty for my ssh client, sqlplus, and any GUI database access tool like Toad, SQL-Navigator, SQL Developer, etc.
  2. The VM must be able to access the internet to download OS packages from Oracle’s public yum server.
  3. The VM must have a fixed IP address. You really can’t run a server (and that’s what this vm is) without a known, fixed IP address.
  4. The VM must be invisible to my network administrators. It cannot occupy an IP address on my company’s or ISP’s network. The “network nazis” must never know it’s there.  It’s not that I’m hiding what I’m doing, but rather that I want that level of isolation to protect the wider network from anything I might do.


Before continuing, let me define some of the acronyms and abbreviations I will be using.

VM – when I use the term “VM” (or “vm”) I am simply using it as an abbreviation for the term “virtual machine”. I do not use it to refer to any product from VMware or the VMware corporation itself. Also, I use the term “VMs” as the plural of “VM”. This is not to be confused with Digital Equipment Corporation’s ‘vms’ operating system. A lot of people would avoid this ambiguity by using “vm’s” as the plural of “vm”, but I was too well schooled in English grammar to use a possessive as a plural.

VBox – I use the term “VBox” as common shorthand for “VirtualBox”. It is quite common on Vbox message boards to refer to it as simply “VB”. That is fine within the context of those forums, but in a broader sense I fear it may be confused with Microsoft’s Visual Basic, which is also widely referred to as “VB”.

Network Modes

Before detailing my virtual machine network configuration I need to explain the different network modes in use with a virtualization product.  These are specified as a property of the virtual NIC on the vm, before any operating system is installed and configured.

NAT (Network Address Translation)

With NAT, the guest (virtual) OS has it’s own IP address, but communicates to the outside world thorough the host OS’s IP address. Requests are translated from the guest IP address to the host’s address before the host passes the request on. Messages received back are translated back to the guest OS’s IP address for the final leg of the trip. Honestly, I studied the details once, but have since forgotten them.


Using a bridged adapter, the VM has an IP address that actually occupies a space on the host’s network. As such it communicates with the network under its own credentials and is visible (and controllable) by the network administrators.

Host Only

With a host only adapter, the vm can communicate only with the host OS or other vm’s running on the same hostonly adapter.  This provides complete isolation of that NIC from anything outside of the host machine.

Setup the Virtual Machine

With VMware, meeting my four requirements for configuring the virtual machine network was so simple I really just took it for granted and never gave it a thought. When you install VMware on your desktop two network adapters are created. VMnet1 is configured for ‘hostonly’ connections. VMnet8 is configured for NAT. I knew that I wanted to hide behind NAT, so gave my first vm an IP address in the subnet controlled by VMNet8 and everything “just worked”.  I never gave it another though.

When I started to use VBox I immediately ran into problems.  After a lot of trial and error and, um, “animated” discussions on the VBox user’s forum, I found that VBox implemented it’s networking entirely differently than VMware, and that impacted how the different configurations like NAT behaved.

So, without further ado, let’s get into how I set up my virtual machines running under VBox. I am running VirtualBox on a Windows 7 Home Premium laptop, 64-bit.

Install VirtualBox

The installation of Vbox itself will create a network adapter on the host OS. This can be seen by opening a command prompt and executing the ‘ipconfig’ command:


Windows IP Configuration

Wireless LAN adapter Wireless Network Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter Bluetooth Network Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : ****::****:****:****:1232%12
   IPv4 Address. . . . . . . . . . . : ***.***.1.3
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . : ***.***.1.1

Ethernet adapter Local Area Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::70a3:748a:95b4:917a%30
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :

Fig. 1

Reading this from the top down, we see the following

Line 16 , “Wireless LAN Adapter Wireless Network Connection” lists the information assigned to the host OS (Windows 7) by the network to which it is currently connected. This is a DHCP assigned address and at the time of this snapshot, my primary connection was to my ISP (key details are masked with asterisks).

Line 29. “Ethernet adapter VirtualBox Host-Only Network:”. This is the adapter created by the installation of Vbox. Please note the IPv4 address of at line 33. This will be important later on.

I will leave the details of exactly how this adapter functions to people who are more qualified than I. As explained to me, I simply think of it as being the routers to which my vms are connected. The adapter also acts as a DHCP server, assigning IP addresses to any NIC that is so configured.

Creating the virtual machine

At this point, we have simply installed the Vbox product. Doing so has also created the network environment in which our VMs will operate. They will all exist on the same subnet as our Ethernet adapter VirtualBox Host-Only Network – that is 192.168.56.

Now comes the ‘tricky’ part. As mentioned above, with VMware I simply configured my vm with a fixed IP in the same subnet as the VMware NAT adapter – the Vmnet8 adapter, which was at What I found with Vbox was that the NAT configuration requires a DHCP address and will not accept a fixed, manually assigned address. The solution to my four fundamental requirements was to create my vm with two virtual Network Interface Cards (NIC). The first would be configured for DHCP for NAT connections, the second with a fixed IP for hostonly connections. Here’s how I did it.

In this example, I have just created a new virtual machine, named ‘vblnxsrv99’. I have not yet installed an operating system. We can think of ‘vblnxsrv99’ as a physical server that we have just unpacked and set on the workbench in the data center.


Fig. 2

Now let’s open the network configuration for this machine. Click on the “Network” link in the configuration area:


Fig. 3

By default, Adapter 1 will already be enabled and configured for NAT. We can leave that one alone.

Configuring virtual machine network adapter 1

Fig. 4

Now we need to add a second Network Interface Card (NIC) to this virtual machine. This is the virtual equivalent of opening the server and plugging in another network card.

Click on the “Adapter 2” tab to bring up the configuration for this second NIC:

Selecting virtual machine network adapter 2

Fig. 5

Check the “Enable Network Adapter” box, and select “Host-only adapter” from the drop-down list. The “Name” will automatically be filled.

Configure virtual machine network adapter 2

Fig. 7

Click “OK” and your machine is ready to have an operating system installed.

Configuring the Guest Operating System

Now that we have a virtual machine prepared with the NICs, we will need to properly configure the OS we are going to install. We can now treat this virtual server just as if it were a physical server in our data center, mounted in its rack and connected to the router.

I will show the OS configuration for Oracle Linux 6,  bypassing the details of the full installation and focusing only on the network configuration done during the installation process. Please understand that this is just a convenience during the OS installation. Just as on a physical machine you can add, remove, and reconfigure NIC’s and other networking configurations after the OS is installed and initially configured, these same operations could also be done after the fact on this vm.

During the installation of Oracle Linux you will arrive at the “Network Configuration” dialog. At this point supply your host name (replacing the default of ‘localhost’) and select “Configure Network”.

Preparing to configure the virtual machine network

Fig. 8

Select eth0 and “edit”.

Prepare to configure virtual machine network adapter eth0

Fig. 9

Under the IPv4 Settings, select “Connect automatically” and for “Method” select “Automatic (DHCP), which is the default.

Configure virtual machine network adapter eth0

Fig. 10

Back at Network Configuration, select adapter eth1 and “Edit”

Prepare to configure virtual machine network adapter eth1

Fig. 11

Under the IPv4 Settings tab, select “Connect Automatically”.  For the “method”, select “manual”.  Click to “add” an address and supply the IP address you wish this server to have.  Supply a netmask of ‘’ and you’re done.

configure virtual machine network adapter eth1

Fig. 12

IMPORTANT: please note that the IP address assigned must be in the same subnet as the VirtualBox Host-Only ethernet adapter that we noted on the host OS. In this example that adapter is at  I have given this server an IP address of

With both NICs configured to the OS, we can accept the settings and continue with the rest of the operating system installation.

Once the installation of the OS is complete, we can check the network configuration of the vm’s OS. At this point I can already start using my standard desktop tools to connect to the vm. I use putty as my ssh client to establish a connection, using the fixed IP we assigned the server. In this case that is

Once connected, let’s check the configuration with the ‘ifconfig’ command:

[root@vblnxsrv99 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:D0:4B:2F
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fed0:4b2f/64 Scope:Link
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2834 (2.7 KiB)  TX bytes:2626 (2.5 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:27:77:8C
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe27:778c/64 Scope:Link
          RX packets:4264 errors:0 dropped:0 overruns:0 frame:0
          TX packets:148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:416226 (406.4 KiB)  TX bytes:20768 (20.2 KiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@vblnxsrv99 ~]#

Fig. 13

Remember that we configured eth0 to the NAT adapter and using DHCP. The IP address you see at line 3 is the DHCP assigned address of While it is true that in this limited environment that will probably always be the address assigned, as a matter of practice you can never count on what address will be assigned by DHCP, so this is not the address we use to connect to the server. We have it only to support the NAT adapter so that we can reach the internet to download packages.

The NIC we are interested in is eth1, which we see at line 11, with the IP address we assigned to it ( shown at line 12.

We have one bit housekeeping left. For reasons I don’t understand, when Oracle Linux installation (5.x versions) creates the local hosts file /etc/hosts, it assigns the host name to the local loopback address. We can see this here:

[root@vblnxsrv99 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.  vblnxsrv99.vbdomain vblnxsrv99 localhost.localdomain localhost
::1  localhost6.localdomain6 localhost6
[root@vblnxsrv99 ~]#

Fig. 14

And in Oracle Linux 6, it doesn’t include an entry for the server name at all:

[root@vblnxsrv99 ~]# cat /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@vblnxsrv99 ~]#

Fig. 15

We want to associate the server name with the fixed IP address we assigned, so modify the hosts file by adding a line for the fixed IP address, and reassigning the host name to that address (this from Oracle Linux 6):

[root@vblnxsrv99 ~]# cat /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4  vblnxsrv99.localdomain vblnxsrv99
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@vblnxsrv99 ~]#

Fig. 16

Please understand that the hosts file is used by client processes to resolve a name to an IP address.  Therefore, as far as fundamental server operations are concerned, it is not necessary to have this entry in the file.  However, there are other services that will need it, most notably (for us) is the Oracle software to be installed later.  Both the database listener and the dbcontrol get default configuration information from this entry.


And there you have it. A Linux machine running under VirtualBox with it’s networking configured to our specification. It can reach the internet for downloading of packages, which will be needed when you start to install the Oracle database. It is completely hidden from our corporate and public networks. And we can reach it from our desktop operating system using the very same tools as any server in our data center. If you get to this point, there is no reason you should not be able to treat this server just like any other server in terms of installing and configuring Oracle databases – or anything else for that matter.

Please like us:


  1. // Reply

    hi, thank you for this tutorial. I’ve scoured the internet to find a solution on this issue. So like it or not we have to make 2 adapter?
    rather than making one adapter as we can do at VMware, using NAT choice?

    1. // Reply

      Doni, thank you for your question.
      There are certainly other options available, but this is the only solution I’ve found that meets my “Four Prime Directives”. Interestingly, after I had worked out that solution, I ran across exactly the same setup described on the old VirtualBox user forum at You can see that here.

      It sounds like you think have two adapters is “A Bad Thing”. If so, would you mind detailing your concerns? Perhaps I can address them. Or perhaps you can show me something I hadn’t considered.

      1. // Reply

        thanks for your quick reply

        i still learning how to configure a router(mikrotik if you know it), what i need is a fix ip address for public and gateway. Before i use VBox, i can easily create it using NAT on VMWare like you said “so gave my first vm an IP address in the subnet controlled by VMNet8 and everything “just worked” “..

        sorry my english is bad

        1. // Reply

          Doni – your English is better than my whatever-your-native-language-is. 🙂

          If you are trying to configure an actual router to be used with your vm, then your use case is different than mine. I’ve never explored that because, like I said in my “Four Principles”, I specifically do not want my vm to have any visibility from the network outside of the host OS. Perhaps if you explained a bit more about why you are doing this I could either relate it back to my work or suggest another source of assistance.

          1. //

            not an actual router, but an OS router in VBox.
            moroe or less like this pic

            it’s a virutal OS router that i want to configure…
            i want to say something, but i still confused how to say it in english T.T

          2. //

            I’m still not clear on what it is you are really trying to accomplish. Even configuring a ‘virtual OS router’ would be some technical solution to a problem. Like I said previously, if I understood why you think you want to configure it this way I might be able to offer better advice. The picture was pretty vague.

  2. // Reply

    “A lot of people would avoid this ambiguity by using “vm’s” as the plural of “vm”, but I was too well schooled in English grammar to use a possessive as a plural.”

    Thank you!

    Ed Stevens, you win today.

  3. // Reply

    im trying to upload e-buisness on Vm and it work first time. but whem im working away or using a different wireless connection it does not work i.e. cant access the login via

    do i need to assigne static IP address? if yes how do i know DNS Server and Gateway detail…? initial installation is with DHCP. but looks like it doesnot work as ip adress change.

    what is the solution or workaround?

    1. // Reply

      It’s not clear exactly from where you are trying to connect to the e-business suite you’ve installed on the vm. As I describe in the article, I want my vm to be totally isolated from the broader network, only allowing connections to it to come from either the host on which the vm is running or from other vms also running on that host. To that end I configure a host-only adapter with a fixed IP address. With that configuration, I do not specify any DNS or gateway details. If you wish to allow some computer other than what I have outlined you will need to configure a bridged adapter on the vm and give it a fixed IP address.

  4. // Reply

    Hi Ed , this is himmy here from OTN , i have been stuck with this issue since past few months unable to get a solution. I followed these steps and it worked in a single run. Thanks a lot Ed , i am so glad you wrote this article.

    1. // Reply

      I’m glad you found it useful. Please feel free to explore the other articles and share with friends.

Leave a Reply

Your email address will not be published. Required fields are marked *