Most important concept and interesting part in Networking. Everything runs around THIS! There is numerous post written on it, that's why am gonna jump to some most fundamental basics. So that while exploring this topic one can relate what is happening and how... at the back Mind.

An IP address has a total of 32bits.
Something like this:


Divided into 4 bytes each, when written in binary-
Something like this:


We as normal human beings cant understand this language, hence we specify usually in understandable numbers.
Something like this: (a typical IP address)

OR (an IP with NetMask)

Before we begin, let me give you a little gist.
Let's say I want to create my private network, where I decide what range of IPs I want in my network. So I fixate on some specific IP number range.

Say I want to create a private network named Frozen with IP ranges

Which means first 24 bits of my IP address i.e. should be constant, which will leave me with available IP address ..i.e. to

Basically, /24 is part where I specify what all bits I want it to remain constant. We call it as NetMAsk Masking the networking part of IP. If I say /16: first 16 bits of IP will be constant.

Consider another example, let's take a little tricky example and understand the binary part working, with a much better understanding.

NetMask is: /20

Here I am saying keep the first 20 bit of my IP as constant. Pretty dope right? calculating in terms of bits itself was confusing. Take it to step by step.

Convert into binary (remember each 4byte is 8bits)


Our Netmask is 20 convert into binary (first 20 bits are constant)

11111111.11111111.11110000.00000000 (1 means constant/masking)

Here 11110000...highlighted bits are changeable. These 0000 can form all the combinations i.e. 1000 or 0011 or 1110...all possible number will be considered. Which will leave us numbers from 16 to 31 (in 3rd byte of IP)

Therefore we have an available range of address: to (so many IPs)

I can further divide this range to have more control, using the same way. This dividing part is called Subnetting. For above I can divide it further like below:


So in my network of ranges I have two different subnets of the range shown above.

Some quirks:

  • /16 = 65,536 IPs
  • /32 specify one IP
  • /16 > /24 > /32
  • network address
  • reserved by AWS for VPC router.
  • reserved by AWS IP address of the DNS server
  • reserved by AWS for future use
  • network broadcast address. Broadcast is not supported in VPC, therefore this address is reserved.
  • any IP

I would suggest going through this link for further understanding:
Understanding IP Addresses, Subnets, and CIDR Notation for Networking
And I strongly recommend to use this link for Calculations
Subnet calculator

Go and explore...Happy learning!