Create a private Oracle test lab – for free

I often see people afraid to try even the simplest of tasks on their Oracle databases, asking “Can I <fill in the blank>?” When it is suggested they try for themselves and see what happens, the common excuse is “I don’t have a test system.”

Every oracle professional (or student) should have their own private computer lab. I’m assuming in this day and age anyone in this category already has their own computer, and that is all the financial investment you need. Starting from there, you should do the following:

  1. Download and install Oracle VM Virtual Box on your personal computer. This is a virtualization product that allows you create complete virtual machines on your desktop/laptop computer. Total cost: $0.00.
  2. Download Oracle Linux. Oracle freely distributes this, only charging if you want a support contract. Total cost: $0.00.
  3. Using your downloaded linux, create a virtual linux machine.
  4. Go to oracle.com and download whatever database or related product you want. The terms of the oracle license agreement allow you the full use of any product for personal study. Total cost: $0.00

By doing the above I have a full computer lab running on my Windows laptop, for a total cost of … (drum roll, please) …. zero dollars, US.

By building such a private lab I am able to create multiple virtual systems that communicate over a private virtual network and so are totally isolated from my corporate network and/or my ISP. This is how I worked out the details for my first Data Guard configuration before committing to my organization’s live databases. People have also used this type of private lab to get their first hands-on with RAC.

Each vm is a task to the host operating system, running in its own window with represents the machine’s console. However, I treat that console like I do the consoles of my physical servers that live behind a locked door in a lights-out data center. With my various virtual machines up and running, I access them with tools on the host desktop, exactly the same as the servers in my data center. I use PuTTY for command line ssh connections and sqlplus and SQL Developer for database access. If I have a virtual machine running Windows, I access it with Windows Remote Desktop.

The number of virtual machines you can have created will be limited by your available disk space, and the number you can have up and running at one time will be limited by the amount of memory available on the host system. Most consumer class systems these days seem to come with a minimum of 500gb of disk, which is more than sufficient for three or more virtual servers. You will want a minimum of 4gb of RAM for a single VM, and 8gb of RAM to have 2 or 3 vm’s running at once.

Don’t expect blazing performance but that is not the purpose. What is the purpose is to have your own test system available at any time to test whatever you want to test, with zero risk of damaging a production system. (And don’t forget that for your developers, the “test” system is production!)

I have deliberately not provided any details on locating, downloading, installing, etc. I leave that as a valuable learning exercise. Oracle does provide some completely configured “appliance” virtual machines, but I strongly feel that using them cuts out a valuable learning experience for the aspiring DBA. My understanding of networks and operating system administration benefited greatly by working through all the detail myself, with the assistance of various subject-matter user forums and other assets on the internet.

So quit complaining about not having a test system and go build your own! No excuses!

Advertisement

VirtualBox Computer Lab Framework

In my article, Create a Private Oracle Test Lab I expressed my opinion that every serious student of Oracle databases should have their own private computer lab. In Configuring the Oracle Virtual Box Network, I detailed the specifics of configuring the network adapters in virtual machines running under VirtualBox. In the time since I wrote those articles I have observed many people on the Oracle Technology Network forums attempt to create a test setup, but with no real thought going into creating a coherent framework in which to build a useful and flexible laboratory.

Now I would like to “connect the dots” and detail the framework within which I have created scores of virtual machines on either my personal laptop or my company-issued desktop. Within this framework, I have had a full suite of virtual machines running Oracle Linux, Suse, Ubuntu, Solaris and Windows, with as many as three different machines running simultaneously. All of these virtual machines communicate with each other using standard network protocols, exactly as if they were physical servers in my company’s data center.

In this article, I will detail exactly what goes into creating that framework. In reality, the actual framework is little more than a few standard directories and the installation and configuration of the virtualization software, which will be detailed at the end of the article. Before getting there, I will explain the thought process that went into the creation of my virtual test labs and the standards I set for myself. It is my hope that the reader will be able to use that to develop a framework that works for him.

I will not be discussing the actual creation of a VM or the installation of any software on that VM. Once you have a consistent framework, there are is any number of resources on the web to help with the creation of specific VMs. And who knows? I may add my own contributions to that body of work, in later articles.
Rational

Before getting into the details, I would like to recap and expand my original rational for building a private virtual computer lab, and add some additional points based on my observations since publishing the original article.

For the working professional, even systems designated as ‘test’ or ‘development’ have certain up-time and stability requirements. Loss of a “test” system can have a severe impact on the developers. For the student, access to a live system may be non-existent. For these reasons, it is imperative that every professional or student leverage the power of their personal computers and the availability of virtualization products to create a private (or “sandbox”) computer laboratory consisting of one or more virtual computers. Such an environment allows testing of almost any aspect of the system without concern for damaging a system that others rely on. There is simply no excuse for anyone to say, “I don’t have a system to test that on.”

Another advantage of the private virtual laboratory is that it allows the operation of a test system on an operating system other than that of the host system. The vast majority of personal computers are a “Home” edition of Windows, with a lesser number of Macs. A virtual machine can run any operating system supported by the virtualization software. The database software is concerned only with the operating system on which it is installed, not the host operating system behind the virtual machine. So even if the only computer you actually have administrative access to is your personal Windows 7 Home Edition you can still have a Unix or Windows Server test machine.

A third advantage of the virtual laboratory is that it allows the test system run with its own network identity. This allows it to be dealt with exactly as if it were a live system in the corporate data center instead of something grafted into the desktop system. I often help people on OTN who are installing Oracle database software directly on their desktop OS. Quite often, their problems stem from being blissfully unaware of the networking implications of true client-server architecture. They are then flummoxed when faced with a real system and the network considerations that entails.
Preliminaries

Before getting into the configuration of your PC, let’s consider a few items.
Terminology

Before anything else, we need to clarify some terms

Host. Within the context of this article, the term “host” refers to the physical computer and its own operating system.

Server. Within the IT industry, the term “server” is used in two ways. First and foremost, it refers to a process that provides services to one or more other processes running on the same or other computers. Second, it may to refer to a computer whose primary purpose is to run server processes.

Client. In general, a “client” is any process that requests services from a server process. However, in the context of creating virtual machines that run as a task under a host operating system, it is common to refer to those virtual machines as “client machines”. This can be rather confusing since we also commonly refer to them as “servers”. However, in the context of the relationship of the VM to the host it is technically correct. The virtual machine itself is requesting hardware services from the host OS. As far as the host is concerned, the VM itself is a client. On the other hand, the purpose of these virtual machines is to act as a server – usually a database server. Within the framework of our lab, the client process requesting services from the virtual machine server will often be running on the host OS.

The better you understand “client” and “server” in terms of processes instead of machines, the better you will understand this article. In fact, the better you understand “client” and “server” in terms of processes instead of machines, the better you will understand many other things about computer technology.

Unix. While I make frequent reference to the Unix operating system, it should be understood that what is said can apply equally to any Unix-based system, such FreeBSD, AIX, Solaris, Linux, etc.
Hardware Selection

You probably already own your own personal computer. If it is relatively new, it will most likely meet your needs for at least one VM. However, if you are considering buying a new one, or are a bit unsure of the suitability of your current PC, here are some things to consider.
Processor

You will want a machine with a 64-bit processor. As of this writing, it appears that all available consumer-class desktop/laptop computers are built with 64-bit Intel or AMD processors. 32-bit processors are a thing of the past, so this may no longer be a point of real concern.
Memory

RAM (Random Access Memory) will be the limiting factor on how many VMs you can have running simultaneously. If you are planning to run only one VM at a time, 4 GB may be sufficient. However, if you will need to run multiple VMs at one time (as in an Oracle RAC environment) you really should get 8 GB, which as of this writing seems to be the maximum available for most laptops. True desktop machines can easily accommodate up to 16 GB. While most desktop class machines are pre-configured with 2 GB to 4 GB, an upgrade to as much as 16 GB can be well worth the incremental additional expense.

When you create the virtual machine, the memory that you specify for it will be allocated out of the real memory of the host system. If you specify the VM has 2 GB of memory, when you start that VM it will require 2 GB of real memory from the host. One must keep in mind how much memory the host OS requires for its own operations. For example, on a minimally configured 4 GB host running Windows, the host Windows OS will require 2 GB for itself, leaving only 2 GB for any and all other processes, including any VMs.
Disk Space

Disk space will be the limiting factor for how many VMs you create, irrespective of how many are running simultaneously. As of this writing, most entry-level desktop class machines come standard with 500 GB hard drives, and one terabyte drives are becoming increasingly common. Plan on 30 GB to 50 GB per VM. The purpose of these VMs is not to have fully populated application databases, but to have a system on which to test features and techniques.
Host Operating System

The host OS can be any OS capable of running the selected virtualization product. Given the proper hardware support in the CPU, it is possible to run a 64-bit virtual machine on a 32-bit host. However, given that virtually all consumer-class computers are built on 64-bit hardware there is simply no reason to be running a 32-bit host OS.

NOTE: Since Windows is by far the most prevalent desktop OS, all procedures in this and related documents will assume the host OS is Windows. It should be very easy to adopt the principles to other desktop systems such as Apple or Linux.
Virtualization Software

When I started building my first VMs I used VMware’s VMplayer. It was a very capable product and was free. While it was fully capable of meeting my needs, it did lack some nice management features, so I soon shelled out $180 to purchase the full-featured VMworkstation. After a few years, I became aware of a product called VirtualBox. That product had all of the features of VMworkstation and was available at no cost. It was increasingly becoming the product of choice in the Oracle community so I made the switch. As I write this, it appears that VMware no longer has a free offering, and VMware Worksation Pro now costs $250.

Oracle VM VirtualBox was created by Innotek GmbH, purchased in 2008 by Sun Microsystems, and acquired by Oracle in 2010 as part of their purchase of Sun. VirtualBox (aka “VBox”) provides the same full feature set as VMworkstation, but is available as a free download from Oracle. There is no official support, but there are two user forums, one at the Oracle Technology Network forums and forums.virtualbox.org. It has come to be the de facto standard among the Oracle community for creating personal virtual environments. For that reason, it is the product that will be used in this and related documents.
Naming Standards

Before beginning to create the infrastructure, it is best to think through some standards. While the specific standards may be considered somewhat arbitrary, experience has shown that systems are much easier to manage when standards are well thought out and detailed. A good standard will provide names that are meaningful and a structure that is predictable and allows for future growth. It will be extensible and flexible, yet not overly complex – not too restrictive, yet not so broad as to be meaningless.

In the end, the existence and use of a well thought out standard is more important than the details of a specific standard. The naming standards really are at the heart of creating the virtual laboratory framework.

For my laboratory framework, I start with standards for naming the virtual machines and for a directory structure that will be created on the host system.
Server Names

The naming standard for VMs presented here is only an example. The reader is encouraged to develop their own, especially in light of any standard used in their corporate environment. If building a virtual server to mimic a live server in a corporate environment, one should adopt a naming convention that will both distinguish the virtual server from its live counterpart and at the same time make it clear which live system the virtual system is replicating. For instance, if the organization has a naming convention in the format

‘ITxxxxxx’, where:

IT – fixed literal

xxxxx – variable identifying information

One might replace the corporate fixed literal of “IT” with literal of “VB” for “Virtual Box”. For example, if the corporate machine were named ITORASRV, then the name of the VM running under VirtualBox would be VBORASERV.

In the infrastructure detailed in this series of documents, virtual machines are named as follows.

Sever name = aabbbcccnn where

aa – Virtualization Product

vb – the VM runs under VirtualBox

vm – the VM runs under VMware

bbb – Operating system

olx – Oracle Linux

ubn – Ubuntu Linux

sus – Suse Linux

sol – Solaris

win – Windows

ccc – user defined

Within the overall naming standard set forth here, this lends itself to whatever makes sense in the user’s own experience. One might use this to differentiate between database and application servers, or between server and desktop systems, or to designate the application associated with it. Just determine for yourself how it will be used, then stick with it.

nn – Sequence to create a unique name within the previous indicators. Number from 01 to 99. Always use two digits
Configuring the host system

Finally! Now that we’ve gotten all the preliminaries out of the way, let’s start configuring the host system.

Configuring the host system consists of the following steps

Create a common directory structure on the host
Install and configure VirtualBox
Install ssh client
Install x-windows server

Create a Common Directory Structure

While the virtualization products themselves can be installed into whatever default directory they normally use, it is helpful to keep all files and directories created to support the VMs under a common directory, with sub-directories for the various support files

Create the following directories.
C:\VMLab Parent directory for the entire VM infrastructure.
C:\VMLab\VBMachines

Parent directory of VMs created under VirtualBox. (If using VMware products, the directory would be C:\VMLab\VMMachines.

NOTE: The virtualization products have a default location in relation to their software installation location. In keeping with our objectives, we will modify this default to use the directories we create for this purpose.
C:\VMLab\VBMachines\backups Directory where you will keep backups of the virtual machines. More on that later.
C:\VMLab\VBShared Virtual disks that are shared across VMs under VirtualBox. Used when creating Oracle RAC setups.
C:\VMLab\hostshare Shared across all VMs; holds files that are shared across VMs or persisted across changes to a VM. Will be mounted to each VM through the VirtualBox “shared folders” facility.
C:\VMLab\hostshare\setup Shared across all VMs; holds the scripts that I use specifically for the initial setup of the VM once the OS is installed.
C:\VMLab\media Staging area for software installed on the VMs. You may find it useful to create product-specific sub-directories below this.
C:\VMLab\media\OracleDatabase_112010_linux_x64

Example of a product-specific subdirectory under the media directory. Under this directory, I would place the downloaded distribution files for Oracle Database, version 11.2.0.1.0, for 64-bit Linux. I have a further naming standard for these directories of

___
Install and Configure VirtualBox

VirtualBox is an open source product distributed by Oracle Corp. It is freely available in the “Downloads” section at http://www.oracle.com. Download and installation instructions are available at that point.

Once installed, start VirtualBox and set the default directory in accordance with our standards, as detailed in the following procedure.

1. Open the “File” menu

After starting the VirtualBox Manger, open the “File” menu

Select VirtualBox Manager File Menu
Select VBox Manager File Menu

2. Select “Preferences”

In the File sub-menu, select “Preferences

Setting VirtualBox preferences’
Select ‘Preferences’

3. Set the default machine folder

In the “VirtualBox – Settings” window, select the “General” tab in the options list, then set the “Default Machine Folder” to the host system folder created for this purpose.

Setting VirtualBox default machine folder
Enter then name of the default machine folder

NOTE: The drop-down for this field will lead to a dialog that will allow you to navigate and drill down to the selected folder, eliminating the need to type in the specification.

4. Save the settings

Click “OK” to save the settings, then exit VirtualBox

Confirming the VirtualBox preferences
Accept the changes

5. Note the address of the VirtualBox network adapter

Installing VirtualBox created a network adapter on the host system. You will need to know the IP address of this adapter when you create your virtual machines.

On the host desktop, open a command prompt and enter the “ipconfig” command

C:\>ipconfig
Windows IP Configuration Wireless LAN adapter Wireless
Network Connection 2:
Media State . . . . . . . . . . . :
Media disconnected Connection-specific DNS Suffix . :

Make a note of the IP address assigned to the VirtualBox host network adapter. In this example, the address is 192.168.56.1.

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::70fb:5067:d2c5:6586%29
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Install ssh client

The standard interface to Unix systems is a simple command-line ssh client. There are several products available, but my favorite is the simple, lightweight PuTTY. The official download page is at chiark.greenend.org.uk.

The architectures of Unix and Windows are vastly different. One place this becomes apparent is in their implementation of a graphical interface. With Unix you can install any number of different products to provide a graphical desktop. The most common are Gnome and KDE. I’ve played around with them a bit, but I still prefer the speed and simplicity of the simple command line shell. If you insist on using a graphical desktop with a Unix system, Google will be your friend.
Install X-server

Any time a *nix system executes a program with a graphical interface (such one of the aforementioned graphical desktops, or the Oracle Universal Installer) the program redirects it’s graphical interface to a specified network address and port, where it expects to find an x-server process capable of handling it. Therefore, we must install an x-server on our host desktop. I recommend a product known as ‘xming’. It is free, has a small footprint and simple installation. X-ming can be downloaded from the Sourceforge.net site.
Conclusion

If you have followed this article carefully, you should now have the following:

A clear directory structure for placing your virtual machines and installation software to be used on those machines
An installation of Oracle Virtual Box, configured to place any virtual machines within the custom directory structure.
The “client” programs necessary to interface with any Unix virtual machines you create.
A workable naming standard to bring some consistency and sanity to naming your virtual machines.

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.

Terminology

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.

Bridged

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:

C:\>ipconfig

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 . . . . . . . . . . . : 255.255.255.0
   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. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   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 192.168.56.1. 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 192.168.111.1. 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.

vboxnet01

Fig. 2

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

vboxnet02

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 ‘255.255.255.0’ 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 192.168.56.1. I have given this server an IP address of 192.168.56.99

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 192.168.56.99

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:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fed0:4b2f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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:192.168.56.99  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe27:778c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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:127.0.0.1  Mask:255.0.0.0
          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 10.0.2.15. 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 (192.168.56.99) 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.
127.0.0.1  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
127.0.0.1   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
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.56.99  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.

Conclusion

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.