Category Archives: Cloud

Cloud Networking Basics for the Non CCNA certified – IP Address

As more and more enterprises are migrating their IT deployments to the Public Cloud, several IT personnel who are not classically trained on networking theory and practice, are routinely having to architect, setup, deploy, manage and support these Cloud based implementations. This blog post is aimed at someone who is a DBA or Developer in an organization who has to support such an implementation (Let us say a migration of on-premises assets to the public cloud), to give them a basic understanding, of networking terminology involved, in a Public Cloud implementation.

The following discussion focuses on IPv4 IP addresses.

What is an Octet ?

Octet is a unit of digital information, that consists of 8 bits.

Eg: 10110001, 11111111

Ip address Basics.

An IP address is a numerical label assigned to each device connected to a computer network. An IPv4 IP address is usually of the form


Ip address in Octal.

An IP address is made up of 4 Octets.

Each Bit in the octet represents a power of 2


So If you had an octet 11111111, in order to convert it to decimal, you would add up each of the bits place values as shown below.

128+64+32+16+8+4+2+1 = 255

Let us convert an IP address, into its Binary Octets representation.


Let us take a look at the First and second Octet’s
192 = 11000000 = 27 + 26 = 128 + 64

168 = 10101000 = 27 + 0 + 25 + 0 + 2^3 = 128+32+8

You can continue the process with the third and fourth octet.

Private and Public IP Address Ranges

A Public IP address is one that is Routable on the Public Internet, and a Private IP address is one that is not routable on the internet.

RFC 3330 specifies the Public IP address Ranges as follows -
11.x.x.x - - - - - - - -

RFC 1918 specifies the Private IP address Ranges as follows - - -

IP SubNetworks

Ip networks may be subdivided into subnetworks (aka subnets). For this purpose, an IP address is logically recognized as consisting of two parts: the network prefix and the host identifier. The subnet mask or the CIDR prefix, determines how the IP address is divided, into network and host parts.

A detailed explanation of IPv4 subnets can be found here

CIDR Block

CIDR stands for classless Inter Domain Routing. CIDR notation is a way to represent a block of IP addresses. It is represented as a dotted decimal address followed by a slash.

For the folks who just want to understand, what it means to them in the cloud, at the very basic level, a CIDR Block is just a list of IP addresses that represent a subnet. For the curious, who need to know how exactly the IP addresses are derived from a CIDR Block, read the explanation below.

If you prefer a Video Tutorial, you can find an Excellent YouTube video on this Topic by Joshua Butcher here.


If we are given a CIDR block as shown above, we can derive the following.
1) The network ID of the IP address
2) The broadcast/host ID of the IP address
3) The netmask
4) The usable IP addresses in this CIDR block

The calculations are shown below.

Here is the decimal value of each bit in the octet as we showed in the previous section


/22 tells us that, there are 22 bits in the network portion all turned on

Let us write the /22 in its Octal representation


The Decimal version of which is

So The netmask for is

The Magic number is determined as follows
– Find the location of the the last bit in the network portion.
– In our case this is the 6th bit in the 3rd octet.
– The value of the 6th bit in the octet is 4, which is he magic number.

So the initial network ID is 172.10.X.0 , where X has to be determined.

The initial broadcast ID is 172.10.Y.255, where Y has to be determined.

Take the 3rd Octet from the IP address (85) and convert it to binary.

01010101 and AND it with the 3rd octet of the netmask

01010100 = 84. This is the value of X

Add the magic number to this 84+4 = 88 (4 would be the next network Id, so 4-1 would be the last ID usable)

Subtract 88-1 = 87, This is the value Y

So network ID is and Broadcast ID is

The usable IP’s are to

So we have learned that, the given CIDR block represents
– A netmask of
– A usable IP address range of to
– 1024 Usable IP’s in the subnet.

You can use the webpage, to translate your CIDR blocks into IP-Address ranges.

The reason we use subnets in the public cloud is that, we can create separate segments of our cloud network, which house different types of hosts (Based on Security and Availability requirements). With different subnets, we have the ability to granularly control, the type of network traffic that is allowed in and out of specific type of hosts (For eg: Databases can be placed in a isolated subnet that allows only TCP/IP traffic on port 1521 or a port of your choice).

Oracle 12c on Docker – Part 2 – Usage Notes

In my previous post, Oracle 12c on Docker, you have seen how to install a docker image for the Oracle 12c database and how to run a container.

In this post, I will  review some useful Docker commands, that you can use.

The command docker images shows all the docker images that are present on your host.


The command docker exec -it <containername|containerid> bash can be used to login to a specific container.


The command docker stats can be used to see the cpu and memory usage statistics of the containers.


The command docker stop <containername|containerid> can be used to stop a container


You can start a second container on the same host using the same image. (Please refer to the previous post for the command we used to start the first container). When we are starting a second container, we are just changing the host ports that the listener and EM-Express ports are Exposed to.

The command to use is docker run -p 1522:1521 -p 5501:5500 oracle/database:


Then you can login using a oracle database client tool, to the database in this second container.


One important point to note is that any changes you make to the databases in the containers (As we have set it up) are lost once you shutdown the container. If you want to persist the changes made to the database, you can use the docker commit command to create a new image that has the changes in it.

Oracle 12c on Docker

Docker is an open platform, that gives customers the ability to deploy, multiple o/s containers on any give host. This allows for the deployment of multiple environments without having to incur the overhead of having a virtual machine per environment. Docker uses linux o/s facilities like namespaces, cgroups and union capable file systems to deploy lightweight containers.

A good explanation of Docker Architecture and concepts can be found here.

At the time of writing of this post, oracle does not support running oracle databases in docker containers. However it is conceivable that, in the future customers might want to deploy the oracle database in a docker container’s on the cloud. It could be an effective mechanism to create and maintain a large number of database copies in order to support development environments that follow agile development methadologies.

Update Jan 03 2017 : Oracle now supports running oracle databases in docker containers. Please see Mos note 2216342.1  for details.

Oracle has published docker images for Oracle Linux 6 and Oracle Linux 7. Recently Oracle has also published a DockerFile and a build script that builds a docker image that uses Oracle Linux 7, installs and creates a oracle database (11gr2 or 12cr1) on it, and creates a new image that includes the oracle database. This is an easy way to get an oracle database up and running for development purposes.

In this blog post, I will detail the steps i followed to build an Oracle 12c database, Docker image, that runs inside of a VirtualBox virtual machine.

The high level steps are as follows.

  • Download the oracle 12cr1 installation Files.
  • Download and setup a VirtualBox Ubuntu 16.04 image from osboxes.
  • Install docker on Ubuntu 16.04
  • Download the Oracle Docker files from github
  • Stage the 12cr1 binaries Execute the build script to build the Oracle database docker image.

Download the oracle 12cr1 installation files.

  • Login to


  • Choose Oracle Database Enterprise Edition, and Linux x86-64


  • Choose the 2 files, and download them.
  • Rename (Because the Docker build script expects files to be with these names) the files as shown below
    • to
    • to

Download and setup a VirtualBox Ubuntu 16.04 image from osboxes

From, download the .vdi file, for “VirtualBox (VDI) 64Bit”.


The downloaded file name will be Ubuntu-16.04-Xenial-VB-64bit.7z. Unzip the contents of this file, to any directory. This will give you a file named “Ubuntu 16.04 64bit.vdi”

From your VirtualBox console create a new VirtualMachine.

  • Use the expert mode
  • Name “Ubuntu1604”
  • Type “Linux”
  • Version – “Ubuntu (64-bit)”
  • Choose 3Gb of memory for the virtualmachine.
  • Choose “Do not add a virtualdisk”
  • Click Create
  • Copy the file you downloaded from, “Ubuntu 16.04 64bit.vdi” into the newly created directory, named “Ubuntu1604”
  • This brings you back to the home page.
  • Choose the newly created image “Ubuntu1604”, click on Storage, and Click on “Controller SATA”.
  • Here choose to add a new disk, and choose the file “Ubuntu 16.04 64bit.vdi”.
  • Click OK.
  • This brings you back to the home page.
  • Click on Network.
  • The Network Adapter 1, is configured to use NAT, change this to use “Bridged Adapter”, Click Ok.

Now you have a virtualmachine, which runs the latest version of Ubuntu. The / directory has 99GB of space allocated to it, and hence is sufficient to create the oracle docker image.

Start the virtualmachine and login. (The default user it creates is osboxes, and the password is

Install docker on Ubuntu 16.04

Follow the instructions at, to install docker.

  • login as the user osboxes into Ubuntu
  • Invoke a linux terminal.
  • sudo su –
  • apt-get update
  • apt-get install apt-transport-https ca-certificates
  • apt-key adv –keyserver hkp:// –recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  • vi /etc/apt/sources.list.d/docker.list
    • Add the following line
    • deb ubuntu-xenial main
    • save and quit
  • apt-get update
  • apt-cache policy docker-engine
  • apt-get install linux-image-extra-$(uname -r)
  • apt-get install docker-engine
  • sudo service docker start
  • sudo groupadd docker

Create a new o/s user for running docker images.I will be performing all the docker operations going forward, from this OS User.

  • I created a new o/s user named rramdas (Regular user, not admin) (Feel free to create a user with any name you want to use)
  • I added this user to the sudoers file, so I can sudo to root from this user.
  • Add the new user rramdas to the docker group
    • sudo usermod -aG docker rramdas

Login as rramdas and ping to ensure that you are able to communicate with machines on the internet.

Next I installed opensshd-server so that I can ssh to this virtual host from my laptop. (Not required)

Download the oracle Docker files from github

  • Login as rramdas
  • Create a directory /u01 in which we will place all the docker files
    • sudo su –
    • mkdir /u01
    • chown rramdas:rramdas /u01
    • exit
  • cd /u01
  • git clone
  • cd /u01/docker-images
  • remove all the directories other than OracleDatabase.

Stage the 12cr1 binaries

From the directory where the oracle installation binaries were downloaded in step 1.

  • Copy the oracle installation binaries to the virtual host. ( is the Ip address of my virtual host)
    • scp linuxamd64_12102_database_* rramdas@

We are staging the oracle installation files in this directory because the Docker build script expects the files in this directory.

Build the Docker Image with Oracle 12c

  • login as rramdas to the ubuntu virtualhost.
  • cd /u01/docker-images/OracleDatabase/dockerfiles
  • ./ -v -e -p manager -i



It Took 43 minutes to build the image.

If we take a deeper look into the, we can see that the following actions have been executed.

  • Download the latest docker image for Oracle Linux
  • Create the necessary O/S users and groups.
  • Install the oracle-rdbms-server-12cR1-preinstall rpm, which checks and installs all the pre-requesite rpm’s for an oracle install and sets up the required kernel parameters.
  • Runs the Universal Installer (Using a response file) to install the oracle binaries and create an oracle database.
  • Creates the oracle listener and tnsnames entries.

After the script completes execution, we have a new docker image database:


Start the Docker database container.

You can start the Docker container using the command docker run -p 1521:1521 -p 5500:5500 oracle/database:


Now we have a 12c CDB, with 1 PDB running, in the Docker Container.

You can list the running docker containers using the “docker ps” command


This database can be accessed from any oracle database client (like sqlcl or sqlplus, or any application via jdbc , odbc etc).


This should get you started with using an Oracle 12c database in a Docker container.