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 xxx.xxx.xxx.xxx.
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.
Eg: 192.168.5.129 11000000.10101000.00000101.10000001
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[table “1” not found /]
RFC 1918 specifies the Private IP address Ranges as follows[table “2” not found /]
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 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 188.8.131.52/22 is 255.255.252.0
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 184.108.40.206 and Broadcast ID is 220.127.116.11.
The usable IP’s are 18.104.22.168 to 22.214.171.124.
So we have learned that, the given CIDR block 126.96.36.199/22 represents
– A netmask of 255.255.252.0
– A usable IP address range of 188.8.131.52 to 184.108.40.206
– 1024 Usable IP’s in the subnet.
You can use the webpage https://www.ipaddressguide.com/cidr, 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).