IP address is a unique address which is given to each device that is present in any network.

But before going to IP Addresses we need to understand what an address is and then I think we should be able to understand clearly.

We can divide addresses (Not IP Address) in two parts: –

  1. Physical address
  2. Logical address
Types of IP Address

Physical address

Physical address is MAC address or Media Access Control address is the address given to any network card. If a machine have multiple network cards, it will have multiple MAC addresses.

You can check MAC address by typing below commands.

Windows machine: ipconfig /all

Linux machine: ifconfig -a

But we are more interested in IP Addresses so will bypass this topic here and go to Logical addresses.

Logical address

Logical address is an IP Address. Logical address can be divided into two parts IPv4 and IPv6.

IPv4 is Internet Protocol version 4. And this is the most used Internet Protocol over the internet.

IPv6 internet protocol version 6 and would be used mostly in future.

IPv4 or IP Address

So going further in this article we will refer IPv4 as Internet Protocol or IP.

Whenever we say its internet protocol or IP, it means we are talking about IPv4.

We can understand this by using below example.

I have a friend living in New York and I want to send a letter from London to him, where I am living. To do this communication we must know the address of our friend who is living in New York. Without knowing the complete address of my friend I cannot send him the letter. This address includes his house number, society, City, country and pin-code.

Similarly I want to send email to my friend I must know his address over internet. And this address would be his IP Address.

There are some things about IP which we should know:

  1. IP Address is a 32 bit logical address
  2. It is divided into 4 octets
  3. Each octet is made up of 8 bits
  4. Each octet can have values between 0 255
  5. Each IP can be divided into two parts Network ID and Host ID

Now suppose we have an IP:


Octets in IP Address

We can see in the above diagram that this have 4 octets of 8 bits each.

And if calculate 8*4 we get 32 which becomes the total size of an IPv4 Address.

Here we are going to see some valid and invalid IP Address examples.

IP AddressValidityComments IP is Incorrect as it have value 256 in 4th octet which is greater than 255
156.2.560.3IncorrectThis IP Address is Incorrect as it have value 560 in 3rd  octet which is greater than 255


IPV4 Classes or Classes in IP Address

There are 5 classes of IP or IPv4 Address

Class TypeDetails
Class AThis ranges from to
Class A IP Addresses are used for large networks
Class BThis ranges from to
Class CThis ranges from to
Class C IP Addresses are used for small networks
Class DThis ranges from to
Class D IP Addresses are used for multicast
Class EThis ranges from to
Class D IP Addresses are used for multicast


For designing our networks we use class A, class B or Class C IP addresses. We generally don’t use class D and class E IP addresses for designing on networks. So in further discussion we will focus only on Class A, B and C networks.

Examples of IPs

Here are some examples of IP Addresses. You can verify the classes of these IPs from above section.


ClassIP Address
Class A10.9.0.1
Class B128.2.1.34
Class C192.1.3.123
Example of IP addresses of all classes


Missing IP range OR Localhost

If you look carefully, when we are going from class A class B there is an IP range 127.x.x.x which is missing. Where the range has gone?

One of the things that is not so good is that a decision was made long ago about the size of an IP address – 32 bits. At the time it was a number much larger than anyone could imagine ever having that many computers but it turned out to be to small.

Jon Postel

The story behind it: When the IPv4 was being designed, the people who were designing it assumed that they have designed a very large number of IP Addresses and they would not need more than that in future. So they dedicated a complete IP Address range which is 127.x.x.x as a loopback range, though only a single IP which is is used as a localhost from this range. So that seems to be a mistake now as we know that there is a shortage of IPv4 addresses and to overcome this IPv6 has to be designed.

Network and Host in an IP Address

An IP of any class is divided into two parts

  1. Network part
  2. Host part.

Network part determine how many bits or octets of that particular IPv4 has been dedicated to network.

Host part determine how many bits or octets of that particular Address are dedicated to hosts or we can say that how many hosts or machines can be created in that particular network.

For each class this Network and host part varies.

To understand this we will see some diagrams.

Class A: In class A IPs, first octet is reserved for Network and the remaining octets are for Host.

IP Address

Class B: In class BAddress, first two octets are reserved for Network and the remaining octets are for Host.

Class C: In class C IPv4, first three octets are reserved for Network and the remaining octets are for Host.

Network ID of an IP Address

Network part of an IP is called its Network ID.

How to find network IDs in IP Addresses

Suppose we have an IP which is of Class A .

We can see that in class A IP Address the first octet is reserved for Network part, and we need to find the Network ID so we will replace Host part by 0. What we get now is the Network ID of this IP Address.

Network ID of

If we take a Class B IP Address:

The Network ID of this IP Address will be:

This is because in Class B we denote first two octets of IP Address as Network bits and remaining as Host bits.

Public and Private IP Address

Now we are going to discuss a little bit about public and private IP Addresses

Public IP Address

A public IP Address is an IP Address that can be accessed over the internet. It is assigned to a machine or a computer which is connected to internet and it is globally unique. There are no two devices present on internet can have same IP Address. It means if you have a public IP Address and it is associated with your laptop then no one in this world can have the same IP Address.

Public IP Address has to be purchased from vendors. One such vendor is GoDaddy.

Private IP Address

The IPs which are used inside LAN are called Private IP Addresses. We don’t need to purchase these from anywhere.

Each class has a range of private IP Addresses.

ClassIP Address range
Class A10.0.0.0 to
Class B172.16.0.0 to
Class C192.168.0.0 to


Why we need Private IP Addresses

There is a limited number of Public IP Addresses. So in a network we need to be cheeky in usage of Public IPs. So we can purchase a single Public IP Address, assign it to a router and use Private IPs inside the network. To send the traffic from Private IP to the outside of network or internet, we would need a NAT device so that the receiver will think that the traffic is coming from Public IP Address. In case the traffic comes from outside the network for that Private IP , NAT will translate that Public IP to Private IP Address.

Broadcast IP Address

The biggest IP Address which can happen in a network is the broadcast IP of that network. If we send any data or traffic to that IP Address, this will be delivered to all the machines connected to that network.

If we have an IP, the Broadcast IP of this network is

Good reads

  1. Convert IP Address from Decimal to Binary
  2. What is VPC