Oracle Labs by Yuri Khazin, Oracle DBA

Oracle Enterprise Linux 4 on Virtual Box – Setup and Networking

Quick note: we are not dealing with Oracle RAC here, it is a networking exercise proof of concept.

In this particular project our goal will be to establish reliable network communication between two or more Linux virtual machines (guests). Why is this important? Network is usually configured in the very beginning and keeps affecting many components of the project later on. Mistakes in network configuration are difficult to detect and fix, since changes have to be propagated throughout all communication layers. So let’s do it once and do it right to save time and effort later.

As usual, when taking on a seemingly enormous undertaking we start with smaller tasks, breaking down the big ask into manageable pieces.

Here is list of what we’d like to achieve in details:

  • Lunix guests can communicate between themselves using static IP addresses

  • Guests have names that resolve to static IP

  • Guests can access internet that is available through the host

  • Host can establish SSH/FTP sessions with guests using either IP or names

Here are the building materials that we’ll have to our disposal:

  • Windows PX SP3 professional as a host

  • Virtual Box 3.0.8 (open source)

  • Oracle Enterprise Linux 4 update 5 as Linux Guest (no license needed)

My reasons for choosing particular software: Host O/S does not really matter, virtualization software can run on many different platforms. Virtual Box is selected because it is an open source software produced by Sun Microsystems (which belongs to Oracle now). Why Oracle’s Linux? This particular flavor of Linux is a modified Red Hat Enterprise Linux 4. Oracle has made a few adjustments that allow Oracle 10g R2 database (32 bit) to install with no issues on it (usually, no additional RPM’s required). Since I am aiming to install Oracle on the guest(s) thus the choice of this Linux flavor.

If you still have a licensing question about Oracle Enterprise Linux (OEL) I can answer it. You only need a license if you want Oracle’s support. For learning purposes you do not need a license. If you will need to download some rpm libraries and updates you can get those for free, the YUM configuration can be pointed to a free repository (not discussed here).

To achieve these goals there are following major tasks to perform:

  • Install Virtual Box

  • Configure Virtual Box’s networking

  • Install first Linux guest and configure its networking

  • Create second guest based on a clone of the first guest

  • Configure second guest (including networking)

  • Test accessibility of internet from the guests

  • Test accessibility of guests from the host

  • Test network connectivity between the guests

Below is a networking layout of our future “server farm”.

Here is the step by step setup process:

  • Download “Oracle Enterprise Linux 4 Update 5” from Oracle’s eDelivery site. The media comes in four ISO CD images. Later on we will be mounting those images one by one in our guest’s (virtual) CD/DVD drive. Yes, this is correct, no need to burn CD’s and place them into your physical CD drive. This whole setup can be performed remotely with no physical access to the PC (your server, that is).
  • Install Virtual Box (follow installation instructions, they are quite straightforward)
  • Run Virtual Box, access Virtual Box preferences

  • Make sure Host-Only network is installed (must be there by default) and it is the only network present. Create it, if it is not there. The notion of “network” in this particular part of Virtual Box can be likened to creating a router with static IP. This “router” will be accessible from host’s network but not from outside of it (not from other hosts on your network).

  • Configure Host-Only adapter as below (yes, it is placed on a totally separate network from your host’s LAN adapter):

  • Save your changes and enter “ipconfig” command from host command prompt. At this point the host networks look like this (192.168.2.* is host’s own IP)

As you can see, Host-Only network is here but not connected to your gateway (to your router).

From the network diagram you will notice that there is a “Bridged” network “router”, this one does not have to be created, it appears automatically when “Bridged” adapters are created in guests.

  • Create first guest

Select OS Type as “Linux” and Version as “Red Hat”.

If you are planning to run Oracle on this guest you will need to give this guest at least 1GB of memory. This can be done later, though (when you go and buy more memory). For now I am setting this parameter to 500MB.

Now we are going to create an image file that will contain the new guest (rather than giving an entire physical hard disk to Virtual Box to manage). This dialog is a bit misleading, the intention is to create a virtual hard disk.

We’ll get another “Next” screen, sort of redundant … (picture skipped)

Since I am planning to have some databases on this guest I set max disk size pretty large. The Linux itself won’t need more than 6GB.

Select “Dynamically expanding storage”, so disk (image) will be created initially small and then expanded as needed (up to the specified limit).

Set size of the hard drive to 30GB and location to wherever you want the image to be stored. I personally dislike default location in your document folder so in this example the image is placed on separate hard drive (optional, of course, – it can be anywhere).

Our first guest is created (it will be in “powered-off state).

  • Configuring the first Guest. Now bring up its Settings dialog:

Do following changes:

  • Arrange boot devices in this order (unselect floppy):

  • Mount installation media in the CD/DVD drive (first image):

  • Now, the most important part – network. Configure first adapter as “Attached to” Host-Only adapter. Make it active. If you are wondering when we assign it a static IP the answer is – later, when this adapter will be actually installed in your guest.

Now configure second adapter as “Attached to” bridged adapter. You probably ask – “hold on, where is this coming from? We have not created any bridged adapters or networks?” The answer to this – in Virtual Box you do not create bridged network or adapter (in the meaning of “router”). The engine has this kind of network present in the background by default and it needs no configuration in the Virtual Box itself. Once you “declare” this sort of adapter in your guest it will be enabled in the run time.

Again, as before, we will have more control over this adapter later on when we install the guest.

  • Start installation of our first guest (press Enter to boot from the installation media)

  • Disk partitioning in Guest – Select manual partitioning

Answer “Yes” to the following warning:

Have the disk partitioned in this fashion:

Optionally, edit the GRUB label:

Now we configure networking in the guest (two cards must be detected):

Click on “Edit” to configure “eth0” (this will be our Host Only connection) and enter following:

Configure “eth1” as following (it will become our “bridged” connection):

Finally, set the hostname:

On the next screen do these changes (Firewall and SELinux are disabled, the reason is explained later on when we install Oracle database on guests):

Proceed with other screens and questions, those are obvious.

Make sure you select “Customize Software” as below (these customizations have to do with Oracle rather than networking, if you limit your setup to networking you can skip customization):

Package Group Selection

Select only the package sets shown here and leave all others unselected.


  • X Window System
  • Gnome


  • Graphical Internet (optional)


  • Do not select anything in this group.


  • Development Tools


  • Administration Tools
  • System Tools ( Add the package ‘sysstat’ by clicking on the Details link and selecting “sysstat – The sar an iostat system monitoring commands.” from the Optional Packages list)


  • Do not select anything in this group.

When prompted to insert next CD do the following: Press RightCtrl to release cursor from within Virtual Box and right click on CD-ROM icon:

Select “CD/DVD-ROM Image”

Choose appropriate image:

Wait some 10-15 seconds for the image to be mounted and proceed with installation. You may get an error “Unable to access CD-ROM”, just ignore it and try again (image is not re-mounted yet).

Proceed with installation to the end, dismount the last image and follow installer’s direction to reboot the guest. Login as root (for initial setup only. You must establish other non-root user and log in with it later).

Add Network icon to the launcher panel as shown below, also add terminal icon (from system tools). Those you will need most.

Bring up the network configuration wizard:

Make sure both network adapters are active. Dismiss this screen. We will see detailed setup later.

Bring up terminal (within the guest) and run “ifconfig” command to show network interfaces:

So, what do we see here? First adapter eth0 is indeed connected to “Host Only” network, while second adapter eth1 has received an address on your host’s subnet – this is the one connected to “Bridged” network.

The router hands out the IP addresses (DHCP) and knows the guest by name as can be seen from the table below:

Let’s see if we have internet in the guest…

Yes, we do (and this is possible due to the “bridged” channel):

Side note: this Linux distribution comes with quite an outdated Firefox

Do not rush to install latest browser though. It appears that Firefox is the highest version you can relatively painfully install on this platform.

All right, now that we have achieved one of our goals and have a working internet access from within the guest we also would like to see if we can access the guest from the host. Bring up SSH terminal (Putty is your best friend) and enter the IP address of the guest on “bridged” network.

On first attempt you will get security alert (that you will accept):

And so, you will log in as “root” (since you have disabled “SELinux” this is actually possible, otherwise you would need to log in first as other user and su to root):

That was a proof that we have achieved another of our goals – we can access our guest from the host by IP address. This IP is dynamic as the guest gets it from DHCP of “bridged” network, i.e. from your physical router. We assume, that this IP address will also be accessible from outside of your host – we will test this later.

Since it is more convenient to access guests by static IP we will try to connect to our guest through their static IP on the “Host-Only” network:

And, as expected, we are able to SSH to the guest on the static IP address:

  • Creating a second guest by cloning our first guest

Run a command prompt in Windows and enter following commands (for newer versions the location will include “Oracle” instead of “Sun):

path=%path%;C:\Program Files\Sun\VirtualBox

vboxmanage clonevdi “G:\VMimages\oel4u5_base1\oel4u5_base1.vdi” “G:\VMimages\oel4u5_base2\oel4u5_base2.vdi”

Bring up Virtual media Manager and “Add” newly cloned file to the repository, thus effectively registering this vdi file and making it available to attach to new virtual machine. The result will look like this:

Now let’s create a second guest (empty for now)

Give it same memory size as for the first guest, make same changes to booting order as in first guest. Choose existing hard disk (media) in the next screen:

Set the networking same exact way as we did for the first guest (go back if you do not remember).

Start the second guest, after a while the “Kudzu” screen will be presented as your new guest recognizes some changes to “hardware”.

Confirm the removal of two network card and proceed to configure first new card (usually it will bring up eth1) as below:

Second card is configured like this (assuming this is eth0):

Let the machine boot, log in as root and proceed to verify network configuration just as we did for the first guest. First card (eth0) may fail to initialize during first boot. The reason may be that this guest still has the name of the first guest:

Let’s fix that (the value in DNS field is supplied by your router, ignore it):

After changes are saved, reboot the second guest.

Once started again, show the status of your network cards and test internet (just as before) and run “hostname” command to make sure your new guest is properly named.

Let’s also test if your new guest is accessible from the host by SSH. And it is:

Well, it’s the time for the ultimate test then. Let’s start up our first guest and use SSH to test inter-guest connectivity.

I am logged into SSH on the host and connecting to my first guest:

Now I am going to SSH from this machine to the second guest:

Bingo! I am happy now. My primary goals are all reached.

What’s left? Configure guest names and their IP addresses in /etc/hosts in both guests and also in XP (that one sits in C:\WINDOWS\system32\drivers\etc). Having done this we will be able to call up our SSH sessions by names of the virtual servers.

All Linux guests will have totally identical “hosts” files as shown below (preparing to have 3 guests):

On Linux, after changes to “hosts” file the network must be restarted:

#/etc/rc.d/init.d/network restart

On Windows the change is immediate. Notice, that “nslookup” command does not consult “hosts” file, “ping” does.

Windows’ “hosts” will look like this:

That’s all for now. Stay tuned for next learning experiments.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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 )

Google+ photo

You are commenting using your Google+ 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

Create a free website or blog at

%d bloggers like this: