Configure the 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.


48 thoughts on “Configure the VirtualBox Network

  1. Thank you for this post, it is very useful. I followed your instructions and for the most part it works great. I am having a wierd issue that maybe you can help with. The IP address assigned to the Virtual Box network adapter in Windows changes every time I reboot my PC. It seems to bounce back and forth between a 169.254.xx.xx address and a 192.168.xx.xx address. When this happens I have to change the configuration on the 2nd ethernet adapter on all my guest vm’s. Is there something I have configured incorrectly in my VirtualBox installation, or is this normal behavior? It’s not hard to change the network config in the guest OS but it’s kind of a nuisance.

    Thanks again for your blog, keep up the good work!

    • Mark,
      This changing IP seems to be a bit of an “issue” with VBox. I don’t see it at all on my personal laptop, but it has been a real issue on my desktop machine at the office. Was fighting it just last week. Rather than constantly changing the IP address of your vm’s, you can reset the address of the adapter on the host.

      On the Virtual Box Manager go to “File”, “Preferences”, “Network”. There you can reassign the IP address and net mask for the hostonly adapter. This normally resets the adapter immediately, but last week I had some other issues and ended up twice deleting and redefining the adapter. You can see those options at the same screen where you configure it.

      You can google this and see where others have had the issue. Also check out

      • Apparently this seems to be a bug, although it was fixed few versions back, but looks like lot of users r facing this . I too encountered this for the first time when i switched to totally diff. wireless or perhaps after upgrading to new version of VB. Anyways the workaround is to have at the place what Ed mentioned above. Refer to this url for more info

      • Neeraj – If you are referring to the issue with the changing address of the VBox net adapter, I really think there is some sort of bug there. I’ve been running Vbox 4.2.16 but last week finally caved to the constant pop-up about a newer version being available. As soon as 4.2.18 was in I started having the problem, and even completely deleting and re-createing the hostonly adapter did not fix it. I finally punted, un-installed VBox alltogether and re-installed 4.2.16. When that installed it complained about not being able to ‘rename’ a network adapter. Checking with ‘ipconfig’ I had “Ethernet adapter Local Area Connection 3:” running on the ip address I had assigned. Normally it would be identified as “Ethernet adapter VirtualBox Host-Only Network”. It’s all working and stable again. I raised the issue on the VBox support forum but never got a satisfactory response.

    • Ed,

      Thank you for your excellent post on how to configure VirtualBox. I’m building VM test boxes for Ubuntu Server and various versions of Windows for application testing. I was able to apply your example above to configure Windows 7 Professional with the first network adapter being DHCP and the second being a dedicated IP within the range of my Host Machines VirtualBox Host-Only Network.

      One question just to confirm, the VirtualBox Host-Only Network adapter on my host machine should be configured to DHCP to automatically obtain an IP Address? That was the default setup by the VirtualBox software install?

      Lastly, when I do an ipconfig on my Windows 7 Professional VM, the DHCP network adapter has an IP Address in the 10.0.x.x.x range. I expected it to be in the range 192.168.x.x. Is the 10.0.x.x.x a fake range for home networks?

      Thanks again for your help.


      • Brandon, I’m glad you found the posting helpful.

        As for your first question, about configuring the host-only adapter. No, it should not be configured for DHCP. Yes, that is the default that VBox wants to impose on ANY adapter, but that is not what we want for our purposes. A server (and that’s what we’re building here) must have a fixed IP address, so that clients (your host OS and any other VM’s you build) will know where to find it. Giving a server a DHCP assigned address would be like you changing your email address every day, and expecting people to still be able to send you mail. The only reason I configure a second adapter with DHCP is that the way VBox implements its neworking models, it requires DHCP for the NAT adapter, and the NAT adapter is what is needed to get to the internet (for package download).

        Let’s quickly review the network adapter types implemented by VBox
        1) NAT (Network Address Translation). With this implementation, the VM has access to the host’s actual network adapter and thus can communicate with the network on which the host sits. However, the VM’s ip address is translated to the host’s IP address, so no one outside of the host OS knows the VM even exists. Perfect for the VM to be able to access the internet without having a presence on the host’s corporate or ISP network. The VBox implementation REQUIRES a NAT adapter to have a DHCP-assigned address, and the VBox software acts as the DHCP server to assign that address. Since this requires a DHCP address, it is unsuitable for server operations, like hosting a database.

        2) host-only. This implementation allows communication only across the VBox network – between the host and guest, and between guests. It allows a fixed IP address within the subnet of the “Ethernet adapter VirtualBox Host-Only Network” process running on the host. That allows me to have the fixed address needed for server operations, but still keep all communications isolated to the physical box. Communications never hit the OS’s NIC, and so your VM remains invisible to network admins.

        3) Bridged. This implementation allows access to the host’s NIC, but unlike NAT, those communications go with the IP address of the guest VM. That is, the guest will occupy space on the corporate or ISP network. For this reason I do not use it.

        4) Internal network. I’ve never used this, but my understanding of the docs is that this only allows communication between VBox guest machines. Similar to host-only, except that it doesn’t even allow communication between the host and guest.

        As for the address of the DHCP adapter, what you see is correct. It will be assigned an address on the 10.x range. You can see the same thing on any *nix server you build with two NICs. The DHCP configuration will be assigned an address in the 10.x range. It is not a “fake” range for “home networks”. As far as tcp/ip goes, there is no such thing as a “home” network. However, there IS the concept of “private” (non-routable) networks, and the 10.x addresses are in the range reserved for this. See, particularly the section on “private networks”.

      • Ed,

        Thank you for your quick and EXCELLENT response! If you ever write a technical book, I want to be the first one to buy a copy.

        To clarify, I was asking about the VirtualBox Host-Only Adapter on the HOST Computer which is not accessed through the VirtualBox software. I noticed this was configured as NAT (DHCP) and must have been installed by the VirtualBox software setup.

        I welcome any other of your comments!

        Thanks again,


      • I’m not sure I know what you mean “VirtualBox Host-Only Adapter on the HOST Computer …is not accessed through the VirtualBox software”. It is created by the installation of VBox, and acts somewhat as an internal router for host-only communications within the VBox landscape. If you are talking about configuring it specifically, yes it is accessed via the VBox Manager. Look under “File -> Preferences –> Network, under the ‘host-only’ tab. There you set the ip address for adapter. You say you noticed it was configured as “NAT (DHCP)”. Exactly what were you looking at to make that determination?

      • When I look at the adapter setting on my host laptop for the VirtualBox Host-Only Network, the properties for the TCP/IPv4 is configured to obtain an IP Address automatically. I assume VirtualBox obtained this IP Address from my Router?

        As far as my last question, I’m trying to understand how VirtualBox can maintain the same IP Address we assigned to the Host-only Adapter when we setup the VM. I entered an IP Address within the subnet range of the IP Address VirtualBox assigned to the Host-Only Network on my host computer. If the router gets power cycled and the MAC Address/IP Address for the VM isn’t reserved in the Router setup, how does VirtualBox guarantee you’ll get the same IP Address you originally assigned?



      • Brandon –

        I really don’t understand what you are looking at that you think the VirtualBox Host-Only Network adapter running on your host is getting its address from your router. If I look at that adapter in my host system’s Windows Control Panel (drilling down to the appropriate location) I see the following:

        Windows Nework Config of VBox hostonly adapter

        The fact is, that adapter process, by definition, cannot access the host’s NIC and so is invisible to your router. You can run your entire VBox network without the host even being attached to any outside network at all. I do it all the time. The adapter process on the host gets its ip address from the VBox manager. Open the VBox Manager, and from the menu select “File -> Preferences -> Network”.

        Vbox Manager Preferences Menu

        Select the “host-only networks” tab, then the “configure” icon.

        configure hostonly adapter

        And you will see where the ip address is set.

        hostonly adapter detail

      • Ed,

        First thank you for your detailed screenshots and especially your patience as I’m learning my VirtualBox configuration. I went through the same screens as you demonstrated and my TCP/IPv4 settings for my Host-Only Network is set to automatically obtain an IP Address. This is the adapter next to my Wireless Network Connection on my laptop running VirtualBox. I would attach a screenshot if I could.

        I guess the question is should I change the config to be the IP Address assigned? When I view the Host-only Network Details under File/Preferences, I get the IP Address which I thought it got from my router. This is the IP Address my Win7Pro Guest VM is using as a default gateway, but my Ubuntu Server install wouldn’t resolve when I used the same default gateway. I got it to work by deleting the gateway reference and just entered the Static IP Address and Netmask.

        I’m able to access Win7Pro and Ubuntu 14.04.1 Server via FTP and through the network. The question I ultimately have is this wrong even though it works?

        I’d be happy to send you my install screenshots if that would help answer questions.



      • Ed,

        One last question. Is it necessary to reserve the IP Address and MAC Address of the subnet range that you assign to your VM in the Router? Does the Router need to reserve the IP Address so it remains associated with the VM if you have to reboot the Router?



      • As for MAC address, you don’t “reserve” that at all. A MAC address is a hard, fixed address unique to each device on the network. It is like the fingerprint of the device itself. In physical devices, it is actually burned into a chip on the device. Obviously, for a virtual device, there are no chips, so it is assigned as a property of the software that is serving as the virtual implementation of the Network Interface Card (NIC). It is ultimately how the device identifies itself to the network and how the network differentiates one device from another. The MAC address is fixed and unvariable for a given device. When you get down to that level, the IP address is not really assigned to a computer, per se but rather it is assigned to a MAC address. For DHCP, what’s going on is the device goes live and says “hey, Mr. DHCP Server, here’s my MAC address, please assign me an IP address. In the case of fixed IP addresses, the OS is configured to assign the IP address to the MAC address, and broadcast it (the IP address) so the rest of the network knows. When installing Oracle Linux, when you get to the part about configuring your network adapters, it actually shows you the MAC address of the adapter you are configuring.

        Also, I don’t know what you mean by assigning anything to the “VM in the Router”. You assign a fixed IP address to either a host-only or an internal adapter (virtual NIC) and by definition neither of these are visible at all to your router. Your router never knows they are there, because they never even access the physical NIC on the host system.

  2. I think this is one of the best blog that i came across. Concept very nicely explained.Job well done. Just curious, would this whole network thing change due to the fact if RAC or ADG comes into picture ? I am assuming nothing would change , all we would need to do is assign diff. ip addresses on each node.. right ??

    • I don’t have any experience with RAC, but from what I understand you’d need to set up a 3d NIC, configured for host only. The basic principle is that you configure the first NIC as explained in the post so that your vm can get to the internet using your host OS as a proxy. But because that NIC has to be bound to a DHCP address, you need a hostonly adapter for your vm to have a fixed address required of a server. Any additional NICs required for RAC or anything else would also be configured hostonly.

    • I’m sorry, I don’t understand your question. There is no reference in my article to a “network configuration menu”, and every step is accompanied by a screenshot. The only confusion should be that you are installing RHL6, and my demo was with Oracle Linux 5. I’ve just been starting to play with OL 6 this week, and the dialogs during setup look a bit different from OL 5 but the principles are the same. I’ve never worked with any Linux other than Oracle. I know it is based on Red Hat, so I’m assuming the actual setup sequence and dialogs are the same.

  3. Hi Eddy,

    Hope you ‘ll be in the best of Health.
    I am really stuck up for the last week trying to sovle the network connectivity issue between Host And VIrtualBox which you ‘ve Identified & Resolved earlier.

    Desparately seeking you Invaluable inputs on the same Issue. Please help

    I am struggling with the VirtualBox connectivity with Host machine as last time when i resolved this Issue by disabling xen interface used by Virtualization guest and host OS’s(RHEL6)
    for network communication was enabled on both HOST & GUEST VM so once it was disbaled i.e
    virsh # net-list
    Name State Autostart
    default active yes

    virsh # net-destroy default
    Network default destroyed

    The network connection between the Host and VirtualBox was establised. and It worked perfectly fine.

    But for some reasone i ‘d to delete that VirtualBox machine in order to get some free space as that machine size was 400GB.
    Now when I recreate that virtualBox with similar configuration except its size which is now 200GB. Installed the same OS that was installed earlier
    I am not able to established connectivity between Host And VirtualBox. VirtualBox configured with Host-only-Adapter.

    The Host IP configuration:
    root@ebs Desktop]# ifconfig
    eth0 Link encap:Ethernet HWaddr 00:1E:67:22:2D:6E
    inet addr: Bcast: Mask:
    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:1000
    RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

    eth1 Link encap:Ethernet HWaddr 00:1E:67:22:2D:6F
    inet addr: Bcast: Mask:
    inet6 addr: fe80::21e:67ff:fe22:2d6f/64 Scope:Link
    RX packets:12343 errors:0 dropped:0 overruns:0 frame:0
    TX packets:12451 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:10079134 (9.6 MiB) TX bytes:2473157 (2.3 MiB)

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

    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:146 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 b) TX bytes:20710 (20.2 KiB)

    THE VIRTUALBOX IP Configuration:

    [root@idmebs Desktop]# ifconfig
    eth0 Link encap:Ethernet HWaddr 08:00:27:47:43:66
    inet addr: Bcast: Mask:
    inet6 addr: fe80::a00:27ff:fe47:4366/64 Scope:Link
    RX packets:3 errors:0 dropped:0 overruns:0 frame:0
    TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:246 (246.0 b) TX bytes:5297 (5.1 KiB)

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

    I tried with AND Without disabling the xen enterface i .e
    virsh # net-destroy default

    on both Host machine and VIrtualBox. but when it didn’t work
    Than i remove yum groupremove “Virtualization” as well without any success.
    Also i tried this too rpm -ev libvirt* on both Host & VirtualBox and removed that libvirt* rpm as well.

    Followed this link
    which you suggested earlier. ANd it was actually helped But NOT this time.

    Kindly suggest what i am missing here. as your suggestions are really of great Help.

    Thanks & Regards

    • Well, first off, my name is “Ed”, not “Eddy”.

      You’ve shown me a lot of configuration information, but you haven’t given a real definition of the problem.

      Something like this is probably better solved on an open forum, like There you will get a lot more eyeballs looking at it. When you post there, you need to specify (1) exactly what OS your Vbox guest is running, and (2) exactly what your problem is. From you posts here all I can tell is you seem to be running some form of Linux, and you are having some sort of difficulty with the network specification.

  4. Hi Ed Stevens,

    Extreemly Sorry for pronouncing your name incorrectly, as i somehow assumed its Eddy as saw it on Top of one of the Comments. so the wrong inferenced!

    I did mention the OS on both the host machine & VirtualBox is RHEL 6 in the post.

    Also i ‘ve posted query on earlier and was directed to VIrtualBox forum of VMbox related Issues. and failed to get any
    response from there as well. that might sound unusual to you. but that’s case’e with me for the last week Beside if you remember i ‘ve posted the same Issue on your blog 6-7 week back
    and you ‘ve hinted of xen Interface being enabled and suggested this link
    which ultimately solved the network connectivity Issue between Host & VirtualBox machine.

    The Issue is that after deleting the VirtualBox machine when i ‘ve recreated it. It is unable to esbtablished network connection to Host machine from VirtualBox even though the network
    configuration which was there in earlier VirtualBox remain the same. iptables & firewall on both the machine is disbaled and stoped as well. also the entires in /etc/hosts & /etc/resolv.conf
    of both machines is in sync and on same network subnet i.e & as well.

    I ‘ve posted the network configuration in the earlier post of both the machines.

    Can you suggest anything . Really appreciate.


  5. Hi Ed, A great article, I have noticed that your wifi adapter has a default gateway of, this is the same for my home wifi and everything works. However when I use the wifi at work which has a 10.x.x.x network I cannot ssh to my vm’s obviously because of the change to the network. What changes do you think I need to make and where? help much appreciated pulling my hair out trying to get this to work.

    • Do you get an error message?
      What IP addresses does your vm run on? What IP address are you specifying when you try to ssh to the vm?

      For my setup, the configuration (or lack of) for the wifi adapter on the host OS is totally irrelevant. If there is some connection between that and the DHCP address that is assigned to the NAT adapter on the vm, I’ve never really noticed, because I never address that adapter. I use the fixed IP that I assigned to the vm, over the hostonly adapter.

      One thing I’ve changed recently in my standard setup is that I don’t even run a NAT adapter on the vm once I have completed installing the packages for VBox Guest Additions and the Oracle validated. I need to post an update on that. If I’m building a vm for Windows, I only create one NIC and make it hostonly. If I’m creating a vm for Linux, I create the *first* NIC as hostonly (its default is NAT), and create the *second* NIC as NAT. Then, once I’ve installed the packages I need for Oracle, I remove the second NIC.

      • Hi Ed,

        This was an error on my part, re-configured from scratch and all is working well.

        I now have a 11gr2 2 node cluster running on virtualbox on my laptop, my plan is to conifgure another 2 nodes and setup dataguard.

        Thanks for the article!!!! it’s refreshing logging onto the server using putty!

  6. Hi Ed,

    I followed instructions on your blog and pretty much everything is working fine, except for 2 small things.

    1) I am not sure when this problem started appearing, but i get a feeling that it started happening either after upgrading to 2nd last update of Virtual box or may be due to some O/s patches. Currently when i put my laptop screen off which obviously puts my laptop to hyberante mode and when i start it back , if i take a new putty , it takes almost 15-20 seconds to bring prompt to enter user id. If i go inside virtual box and restart both eth0 n eth1 via network manager , and then again try to take connection via putty it works fine. Are you aware of this sort of a issue … i can get the connection , it’s those wait for 15-20 sec eveytime is painful.

    Somehow after hybernate it screws up everything.

    2) If i have a running putty connection and i put my laptop in hybernate by putting down laptop screen off , any existing active putty session becomes inactive if i start my laptop after few hours.. is this a know behavior in VM ?

    Here’s my O/S version & i am doing ssh

    Linux pr.localhosts.localdomain 2.6.32-400.29.1.el5uek #1 SMP Tue Jun 11 15:17:29 PDT 2013 i686 i686 i386 GNU/Linux

    Let me know if you need any additional information.


  7. Hi Ed,

    I had tried the suggestion you gave in but couldnt succeed to complete the steps.

    i dont know if you got any mail when i commented on it few days back as the moderator close the discussion and removed my comments .

    Anyways the issue is –I dont know how to do this “bypassing the details of the full installation and focusing only on the network configuration done during the installation process.” which you posted in this bloc. ” How to do the installation as this is a vm virtualbox manager. I downloaded it from this link

  8. Ed – thanks for the awesome blog. I could follow most part of it as my VM was on CentOS 6.5. My question is .. as long as I have just eth0 configured – guest VM to internet works fine but as soon as eth1 is configured… other connectivity from host to guest and guest to guest works but guest loses internet connectivity. ? Any idea ?

    Configured as below
    eth0 – NAT – DHCP
    eth1 – Host only Adapter – Static IP address with DNS

    • Offhand I’d guess there is some sort of collision between your configuration of eth0 and eth1.
      What do you see from ‘ifconfig’? Anything there look amiss?
      How about your config file? In /etc/sysconfig/network-scripts, look at ifcfg-eth0 and ifcfg-eth1. I realize you may not understand the full import of anything in those files, but sometimes a fishing expedition can turn up things that just don’t look ‘right’ … and lead to a solution.

      I’ve started configuring my sandboxes with eth0 assigned the hostonly, fixed address adapter and eth1 the NAT, DHCP. Here’s what my config files look like, if you want to compare. The ip address of my hostonly eth0 is

      [root@vblnxsrv01 network-scripts]# cat ifcfg-eth0
      [root@vblnxsrv01 network-scripts]# cat ifcfg-eth1

  9. Pingback: A short guide to networking in Virtual Box with Oracle Linux inside. | Jobacle

  10. Your post is probably more awesome than I could possibly appreciate – I lost you very early in the piece but you solved an issue for me that for years of fooling around and reading all kinds of net, official instructiions and watching youtube videos. I have never been able to simply share folders, or have networking working (between host and guests) – the solution came by your suggestion to configure multiple network adaptors – this never occured to me before reading your post. Thank you – I doubt I will ever fully understand the big picture – I am really happy I have something that works – thank you for that.


  11. Pingback: A short guide to networking in Virtual Box with Oracle Linux inside. | 懒得折腾

  12. Hi,

    Thanks, this is very informative. I have an issue with my VirtualBox, it is to do with the network (internet) settings. Everyday when i go back from work i have to go Device -> Network -> Network Settings, and disable then enable the Cable Connected option to allow all my VM’s to connect to the internet and the same applies when i get back to work the next day. what am i missing here. Is there a way so that i dont have to do this every single time i disconnect from a network and connect to another one or the same network.


    • Where are you seeing this “cable Connected” option? Is this something on your guest OS? What is the guest OS? I don’t find anything like a “Devices” menu option anywhere in the VBox manager or the VBox console of any of my vm’s.

  13. No its not on guest OS, Device options is available at the top of a running VM. Otherwise in the virtual box manager window you can go via Settings -> Network and in there you will find Cable Connected (tick box) under Adapter 1 tab (for me),

    • Ok, I see it now. Don’t know how I missed that page. Now that I see it I realize I’ve never really had reason to look at that particular option – the ‘cable connected’ box. Googling around I’ve not been able to come up with anything that looks like your problem at all.

      I did have a problem some time back with the ip address of the VBox adapter on the host changing whenever the host rebooted. It seems that was related to the version of VBox I was running at the time, and I haven’t seen that problem in quite some time. I don’t know if that could be related but I’d think not as I’ve upgraded VBox since, and you are a couple of point releases ahead of me at the moment.

      I’d suggest you sign up for an Oracle Technology Network account (free) and then post your question at either or One bit of information you’ll want to add when you post there is how the adapter is configured — NAT, hostonly, etc. If you find out anything, please let me know. I’m sorry I couldn’t be more help.

  14. No thats fine Ed, thanks for replying…. I have got another question just see if you know anything about it. Is it possible to connect my VM to another network to that of host. Eg: If host is connected to my work network X, could i somehow connect my guest VM to say a wifi network at my work?

  15. Hi,

    I am facing issue while configuring host-only adapter.
    I have installed Virtualbox and imported linux image.

    I have configured static IP address –

    ifconfig on virtual box shows following

    enp0s17: flags=4163 mtu 1500
    inet netmask broadcast
    inet6 fe80::a00:27ff:fe90:18f3 prefixlen 64 scopeid 0x20
    ether 08:00:27:90:18:f3 txqueuelen 1000 (Ethernet)
    RX packets 77 bytes 9169 (8.9 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 54 bytes 7511 (7.3 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    lo: flags=73 mtu 65536
    inet netmask
    inet6 ::1 prefixlen 128 scopeid 0x10
    loop txqueuelen 0 (Local Loopback)
    RX packets 4 bytes 340 (340.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 4 bytes 340 (340.0 B)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    But I am not able to SSH to this virtual box from my local Macbook laptop.

    Could you please tell me what is wrong ?


    Advait Deo

    • I’m sorry, but the phrase “I am not able to SSH to this virtual box from my local Macbook laptop.” doesn’t provide any useful information about the problem. Do you get any error messages at all? A timeout? From your host system, what do you get when you ping

      BTW, please note that I am in the process of moving to a self-hosted site, at simply Since this particular topic hasn’t yet been moved, we can discuss it here, but please also go to and sign up to follow me there.

  16. Sorry. I was not specific.
    I am able to ping which is the IP address configured for my linux virtual host. But I am not able to SSH.

    When I try to SSH, it just hangs. It does not return prompt for 5 mins and after that when it displays the password prompt and I enter password, I get timeout error as shown below

    advaitd$ ssh oracle@
    oracle@‘s password:
    Connection closed by

    Another thing that I found out was that if I turn off my wifi network and if my laptop is not connected to any network, I am able to SSH fine without any issues.

    This could be because when I am offline my /etc/resolv.conf is deleted automatically and when I enable wifi network, /etc/resolv.conf exists and has following entry

    # Mac OS X Notice
    # This file is not used by the host name and address resolution
    # or the DNS query routing mechanisms used by most processes on
    # this Mac OS X system.
    # This file is automatically generated.

    Could you please suggest if anything wrong with my /etc/resolv.conf or any other setting ?

    • If ping works, but ssh doesn’t, then it could be a firewall issue. I believe ping uses a different protocol, and it almost certainly uses a different, which is probably left open by default on the vm’s firewall.

      Also, your description of the result when you try to ssh sounds a lot like what I first experienced when I started working with OL6 (as opposed to OL5). The fix was to not configure a default gateway for the guest interface. See the discussion I had about that on OTN for more detail, here.

      As for your host config, I’ve barely ever had my hands on a Mac. It is my understanding that the mac OS is really a variant of Linux. That said, I can’t imagine why disconnecting from or connecting to any external network would cause your resolve.conf file to be dropped/created. And the address shown is not the one that is used by default for the hostonly adapter.

      1 ) show me the result of ‘ifconfig’ command (or the mac equivalent) run on the host OS. I’m looking for the vbox host only adapter and its details.
      2) I’d suggest you take the question to the VirtuaBox forum space on Oracle Tecnology Network. There you’ll get more eyes on the problem and some guys there are better networking people than I. Just be sure to put on your ‘big boy pants’, as the best people there can also be pretty brusque. You’ll need to sign up for an OTN account, but it’s free, and that’s where you’ll find the best help with these types of questions.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s