A short guide to networking in Virtual Box with Oracle Linux inside.

Job Oprel 30
0 0
Read Time:7 Minute, 27 Second

This post is intended to be a dummy guide, best practices, or whatever you call it…   about setting up a network while working with virtual boxes on a desk- or laptop. I was setting up a virtual box environment with several Virtual Boxes on my laptop, and as I’m not a network – specialist, I came across a few annoying things, challenges if you like.  And when I was googling around, it appeared to be I’m not the only one, so I felt the urge to share some experiences.

What I want is the following environment and some elements smells like a subset of the real life:

1. Connect from my laptop to my virtual box through ssh and sqlplus, with fixed ip-address.

2. Simulate a private network, a network between the virtual boxes, also with fixed ip-addresses.

3. Occasionally connect to the internet from within the virtual boxes. To performs a ‘yum update’ and that kind of stuff.

In a picture it looks like this:


My laptop is a Windows-7 machine, the two virtual boxes are equipped with Oracle Linux 6.5 with Oracle database 12c on it.

For general understanding, needed later on in this post, my network configuration on my laptop, performing an ‘ipconfig’ on o.s.-level:


My ip-address is apparently, and through a wireless connection. The default gateway of 192.168.1 is my internet router.

More important for configuring the first connection: there’s also a virtual, host-only network with a ip-address of


I’ll come back to this in the next chapter.

There will be an explanation per connection for the purpose of this post. In real life it’s much faster to configure the three networks all together at once.

1. Connection from the laptop to the Virtual Boxes.

To connect with the Virtual Boxes, I used the ‘Host-only’ network interface (Bridged is also possible, this will be explained later on).  When installing Virtual Box on a computer there’s already one default installed, and visible on your o.s., in this case the This can be compared as  a loop-back interface. The configuration can be found on the Virtual Box Manager (not on a virtual box itself !). Choose ‘file’, ‘preferences’, ‘network’. Then the tab ‘host-only interfaces’. In my cases it looks like this (unfortunately my virtual box has been installed in Dutch language, sorry for that):


Double-clicking the last one, the default one without a number:


This interface has also been configured as a DHCP-server, clicking on the other tab:


But what I want is a fixed ip-address in another range (not necessary, but for the purpose of this post to point things out), e.g. You can also use the default host-only interface.

For this post, we’ll add another one. Remember, my own ip-addres is

For the purpose of this post, you will create a new host-only interface. I created a second one in the virtual box manager:


No DHCP-server:


You will see that a virtual network has been made on the guest-system. It shows like this:


Now I’m going to create a Virtual Box, named ‘rac1-ol6-121’. In the network configuration, Adapter 1, choose ‘host-only adapter’, and then the VirtualBox Host-Only Ethernet Adapter #2, like this:


Virtual Box has been created, now it’s time to install Linux on it, what I will not cover in this post. After Linux has been installed you’ll have to configure the interface ‘eth0’ in the following way.

Through the gui: ‘System’, ‘Preferences’, ‘Network connections’, edit ‘system eth0’, tab ‘Ipv4 Settings’:


Alternatively, you can accomplish the same on Linux OS commandline:

# cd /etc/sysconfig/network-scripts

# vi ifcfg-eth0

# service network restart

Should look like this:


Be sure that ONBOOT has been set on yes.

This should do the trick. While I was configuring the network on commandline I noticed that the GUI was not catching up with the updates I made. Be aware of that. It will be synchronised by rebooting the server, not yet figured out how to synchronise the GUI – network configuration with the updates I made on the commandline without rebooting.  When updating through the GUI, the ifcfg-eth0 will be modified correctly.

So now it should be possible to connect to your Virtual Box from your laptop or desktop, in my case through the fixed ip-address This ip-address can be configured in my host-file on my windows machine to connect by a fixed name.

When you still got trouble connecting to your virtual box, be sure to look into iptables  and selinux.

For the purpose of this post, you could decide to stop iptables and disable selinux
service iptables stop
chkconfig iptables off
vi /etc/selinux/config : disabled (Needs a reboot)


2. Simulating a private network between Virtual Boxes.

To connect between virtual boxes and nothing more, is quite straight forward. Within the Virtual Box manager this is a separate adapter called ‘Internal Network’.

Before starting your Linux Virtual Box, configure your second adapter (the first was for host-only networking) like this:


The above picture has been taken while the VirtualBox was running, so that’s why the box ‘Switch on Network adapter’ has been greyed out.

I gave the network a name: ‘neta’ . The rest will be left default.

In Linux this adapter will be defined as ‘eth1’, and the ip-address I gave is ‘ Gateway is not necessary.

Now I’ve got 192.168.187.xxxx as physical addres, 192.168.188.xxx as host-only (public interface?) and 192.168.190.xx as internal network.


On o.s.-level:


And when you create another Virtual Box with also an internal adapter in it (e.g. with the name ‘neta’, they should see each other.

3. From Virtual Box to internet.

For the occasional connection to the internet, we’ll add another interface to the virtual boxes.

In Virtual Box there are two interfaces which can connect to the phyisical interface and thus are able to connect to the internet (and your desk- /laptop): NAT en Bridged.

Bridged: Uses an ip-address in the same range as your physical network, either fix or through dhcp. We’ll use fixed later on. This provides your virtual boxes with an interface as if they are directly connected to the internet, as your laptop/desktop.
NAT: Provides an ip-address in the 10.x.x.x range. This ip-address will be translated on your laptop.

See. https://www.virtualbox.org/manual/ch06.html for more information about VirtualBox networking

Bridged (using dhcp) and NAT has a quite annoying side-effect. I was working with DNS-resolving, and the NAT-interface had the habit to overwrite my settings in resolv.conf. I know there are ways to overcome this, but decided nevertheless to go for ‘bridged’….

Before starting your Linux Virtual Box, configure a Bridged adapter through your Virtual Box manager:


Important in this configuration: the name of the adapter is not just a name, but the physical interface: your –wired – network card, or your wifi. In this case my wifi (Centrino Advanced…).  Once I used my laptop on a wired network during the day, and tried to connect to internet through the Virtual Box  when I was at home, connected to my wifi. The name of this virtual adapter was changed to the wired adapter, so I had to close the virtual box, reconfigure it to the ‘Centrino Advanced’- wifi, and it worked again…. Bit annoying.

Within Linux the adapter is the equivalent of eth2 (the third adapter configured in Virtual Box):


Ip-address should be in the range of your LAN or home network (In my case 192.168.178.xxx). Gateway is my router at home.

For DNS I filled in the google DNS Server addresses. Should not be necessary I think, but I messed up my home DNS a bit, and now I am a bit more confident DNS works (at least for internet stuff).

On Linx commandline:


Doing a ping to google.nl:


A nslookup:


As DNS it’s using, so I messed up my DNS server (as well he was down at that moment Smile ) using DNS from the outside world. Working though now…

Note: It’s just as secure as your laptop connection to the internet, so be careful with a bridged connection. You can leave it default off (ONBOOT=no in ifcfg-eth2), and switch it on when needed.


Virtual box documentation: https://www.virtualbox.org/manual/ch06.html

Ed Stevens, configure the Virtual Box network: http://edstevensdba.wordpress.com/2012/12/15/configure-the-virtualbox-network-2/

About Post Author

Job Oprel

Until February 2019, Job worked as a solution architect at AMIS Services with a special interest in Oracle licensing, High Availability architectures and managing complex (Oracle) environments, which includes Cloud environments.With a background as Oracle developer, DBA, team-manager and license-consultant he is able to utilize the Oracle technologies to a cost-efficient architecture for his customers.He is regularly involved in consultancy regarding: - Unlimited License Agreements (ULA). - License compliancy-checks and advice regarding optimizing the environment. - Second opinions. - Education / presentations about licensing and managing your infrastructure in the most cost-efficient manner.Twitter: @jobaclenl
0 %
0 %
0 %
0 %
0 %
0 %

Average Rating

5 Star
4 Star
3 Star
2 Star
1 Star

30 thoughts on “A short guide to networking in Virtual Box with Oracle Linux inside.

  1. Thanks Job, it really help me a lot and saved my time. Since somany days i was literally searching for these topics however some where the connections are getting failed between Host to guest. Thanks for the clear picture.

  2. Hello, I have been struggling a lot for all of these setting in the google and I have never come to such a solution. I am really appreciate for the blog and I am happy that you have narated in a such a way that layman could also understand the network concept and configure on them itself. once again, I thank you a lot.

  3. Hi,

    I have a requirement. I have two servers(server1 and server2). Each server has three virtual servers in a virtual box(total of six virtual servers). I want to create separate network for these two servers(server1 and server2) and want all six virtual servers to talk to each other). Howe this can be done. I can connect server1 and server2 through a switch or if needed can connect them with cross over cable.

    1. Hi Vaishraj,
      If the two physical servers belongs to the same network-(sub)domain, it should be possible to use the ‘bridged adapter’ to connect to the other virtual servers. Practically the same config as used in the article.

  4. hi.
    my connection from host (windows7) to guest (oracle Linux 6.5) is happening. But when I ping from guest to host, is not happening. Is there any specific configuration pending on guest interface or host interface.
    Its quite urgent. Can you please suggest?

    1. I think you bumped into the Windows Firewall. In the control panel of Windows go to the firewall section, add an inbound rule with your ip-addresses, and allow all programs / protocols. For Windows the communication from the guest is an quite the same as an incoming request from a public network. Hope that this will do the trick for you.

  5. Thank you very much!! This is exactly what I was looking for. I like the way you have explained everything with screenshots.

  6. Hello i’ve configured oracle enterprise linux 7.0 on my laptop with windows10. Now i’m able to PING from my host (laptop) to guest (linux in VM) and i’m not able to ping windows from linux. And also i’m not able to connect to internet from my VM. Could you please help me?

  7. Thank you sir. This was driving me crazy and stopping my puppet server and client from working, but not anymore. Great work!!!

  8. Thank you so much for this post..I was trying to get the internet working on the VM, but could not. Now followed your postand it’s working fine.Thanks again

  9. hooraah! thank you for this. worked fine.. now, problem is, i need to apply this to solaris 10 and cant seem to figure out how 🙁

  10. ***************************************************************************************************************************
    Hi I would like to add here a problem I faced. I did all as suggested but it did not work. Then a friend of mine suggested to check for the network card installation it self on the virtual box machine. Then I re-imported the appliance with PCnet Fast 111 network card rather than the default one Intel PRO / 1000 MT Desktop if you are doing Oracle Virtual Box Linux as PCnet Fast 111 is for linux if Virtual Box machine is for windows then leave it as default. After that I applied the settings on this site and was able to get through smoothly.
    And a problem before I got was that my virtual adapter did not get installed. so when you are installing Virtual Box itself make sure you run as administrator the installation.

    Best Regards


  11. Hi Job,

    I have been struggling with setting up networks with VirtualBox for a long time. Basically I resorted to trying out all options and or trying to apply things I vaguely seem to remember from the past that worked at some point in time. Your article will put a stop to that: now I know what will work for which purposes and why!

    Thanks for taking the time to write it down. Very, very useful.

    kind regards,


  12. Hello from Austin, Texas in the US!

    Thank you for taking the time to explain this in such detail! This post has been very helpful in sorting out a process that usually involves a lot of trial and error + frustration.

    Nice Work


  13. Absolutely, wonderful, brilliant post – the 1st I’ve ever found in the last 4 years that clearly explains how to set up this type of networking, in a manner which is understandable to non-networking people.

    I’ve set up several Oracle GI clusters on vBox / VMWare over the last 4 years and have always just muddled through the networking pieces – this post finally explains to me what I’ve been doing and what I need to do going forwards.

    Thank you so much

  14. Hi
    I have configured IP’s as you suggested above
    one is Hostonly and second one is Bridged netowk with static IP but i can’t connect to the internet.
    route -n
    Destination Gateway Genmask Flags Metric Ref Use Iface 3.xx.xx.x UG 0 0 0 eth2
    3.xx.xx.x U 1 0 0 eth2 U 1 0 0 eth3
    ###ifconfig -a
    eth2 Link encap:Ethernet HWaddr 08:00:27:4C:03:60
    inet addr:3.2xx.1xx.x Bcast:3.2xx.1xx.255 Mask:
    inet6 addr: fe80::a00:27ff:fe4c:360/64 Scope:Link
    RX packets:11523 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:1102549 (1.0 MiB) TX bytes:17052 (16.6 KiB)

    eth3 Link encap:Ethernet HWaddr 08:00:27:9F:88:34
    inet addr: Bcast: Mask:
    inet6 addr: fe80::a00:27ff:fe9f:8834/64 Scope:Link
    RX packets:40 errors:0 dropped:0 overruns:0 frame:0
    TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:6218 (6.0 KiB) TX bytes:9870 (9.6 KiB)
    ##cat /etc/resolv.conf
    nameserver (Earlier i have provided DNS servers here.but it doesn’t work
    [root@oraclelinux6 network-scripts]# cat ifcfg-eth2
    NAME=”System eth2″

    i am able to connect virtual machine from PUTTY but unable to connect internet.Can you please assist

  15. Nice write up but you made it a bit more complicated than necessary.

    In 4.3 a new networking mode was added, NatNetwork. That is all you need. So your setup above would only need one adapter per VM. They would have a private network between them using a shared NatNetwork. The VM’s will all have access to whatever the host can reach. You can easily setup port mappings for inbound traffic to any VM.

    Much easier to manage.


    1. Great post!! I have not seen other posts providing such simple yet all-around instructions on virtualbox networking. It took me quite some time to make host-only network work on my virtualbox by myself. Had I seen this post earlier, I would spent so much time on that!

      Thank you!

Comments are closed.

Next Post

Custom Escalation in Oracle BPM Suite 11g (guest post by Vivek Acharya)

This article is contributed by our guest writer Vivek Acharya. Vivek is an Oracle Consultant working as a Professional Freelancer. He has been in the Design, Development, consulting and Architect world for approximately seven years working in Oracle Practice at IBM,HP,Zensar. He is an Oracle Certified Expert as Oracle Fusion-SOA […]
%d bloggers like this: