One part of working with public cloud is that a developer needs to understand far more than he or she is used to. These are same parameters which are facets of distributed computing. Following is a fun animation to explain different parts of it.

In essence there are 4 parts to the equation.
1. Network
2. Storage
3. RAM
4. CPU Cores

In this blog, let us focus on networking aspect. We will take a deep dive into others aspects later.

IP Address

Every node in the network needs an identifier. Traditionally this identifier has been IPv4 address. Some point in the future IPv4 will be eclipsed by IPv6 which has far wider range but our focus here will be IPv4 only.

A typical IP Address looks like this

It has four parts to it, separated by a period. each part can have value ranging from 0 to 255, though not all combination available for general consumption. In reality each of these 4 parts (which now onwards we’ll call octets) are binary values each having 8 bits. So there are total 32 bits in IPv4 address space.

Now comes the question of how to divide this address space for use. First comes the distinction between public and private IPs. To make it easier two ranges starting from 192 and 10 have been dedicated for the private networks. As you can see if I fix first of 4 octets, we can only assign values to the rest 3.

Classful Networks

Initially first octet was used to define a network. It means only 254 large networks could exist (excluding 0 and 255).
These networks were divided into 5 classes. Class A,B,C,D & E. Class A, B and C represented networks of different sizes and in turn different number of hosts allowed. D & E were reserved for multicast and experimental purposes respectively.

Think of these 254 networks as separate high-rise buildings. Now why we need separate classes of buildings. The reason is in tenancy needs. Some large companies need the whole building but a much large number of companies need a floor or may be even less. So let’s start with large tenants.

Class A

All the networks starting from 0 as network bit to 127 belong to this class. There are only 128 networks possible but each network has 224 addresses. So coming back to our high-rise metaphor, first 128 buildings are single tenant only. Curious who are the tenants? Another way to differentiate between network bit and host bits is subnet mask. Default subnet mask for class A networks is

Class B

Class B addresses have network bit ranging from 128 to 191. Here rather than just one, first two octets are fixed. It makes number of networks to 16k+, 214 to be exact. Each network has a smaller number of addresses i.e. 216. In our high-rise metaphor from building number 128 to 191, each floor is rentable separately. Default subnet mask for class B networks is

Class C

Class C addresses have network bit ranging from 192 to 223. Here first 3 octets are fixed, making total number of networks to 221. Each network can only have 256 addresses. So now in this class you can rent an individual suite (each one having 256 rooms in it). First address which has last octet 0 is not assigned to any node but is kept for the network, this of it as reception area. Default subnet mask for class C networks is

Class D

Network bit 224 to 239 has been reserved for multicast. Think of these buildings as general areas like town hall.

Class E

Class E has network bits from 240 to 255.

Classless Inter-Domain Routing

Now the scheme described so far seems very flexible but in fact it is not. In the classful networking, the division is only done at the octet level which is not granular enough. What if we do separation at the bit level. There are total 32 bits. This is essentially CIDR.

Now if we include all the bits, that would be stretching the logic too much so let’s meet at the middle point i.e. at the 16 bit level.