Network Kings, India’s Leading IT Career Training Academy
In this lesson, we will learn IP address concept in detail.
An IP address stands for internet protocol address. IP address is a unique identity of a device. It means it uniquely identifies a device on the internet. Every device requires an IP address to connect to internet. Without an IP address a device can’t access internet. So, this way you can understand the importance of IP address in computer networking.
IP address is a string of binary numbers in the form of 1 and 0.
Ex- 10101110 11110011 11111000 00101010
This is an example of 32 bit IPv4 address. Similar way in IPv6, we have 128 bits.
In above example we divided 32 bits into 4 pairs. Each pair consist 8 bits. (8bits = 1 octet).
So, in IPv4 we have 4 octets.
Decimal dotted representation of above IP – 174.243.248.42
Note: In binary number system we have only two bits 1 and 0. So, whenever you read data in binary format or something like that it means it is in the form of 1’s and 0’s.
IPv4 address (32 bits address)
IPv6 Address (128 bits address)
Note: Here v stands for version. So, we can expand like that IP version 4 and IP version 6.
1st method
2nd method
IPv4 Addresses are divided into 5 Classes, These are divided by IANA :- Internet Assigned Number authority.
Class A, Class B and Class C IP address are used to assign IP to hosts (a host can be a router, switch, PC, mobile)
Class D IP address are used for multicasting purpose.
Class E IP address reserved for future use, but these address are not compatible with any device, so now they are wasted.
Now we will discuss some important parameters that are very important:
IPv4 address has 32 bits.
Ex- 10101110 11110011 11111000 00101010
For Class A-
For Class B-
For Class C-
|
Class |
Leading bits |
Network bits |
Host bits |
No. of Networks |
Addresses per Network |
|
A |
0 |
8 |
24 |
128 |
16,777,216 |
|
B |
10 |
16 |
16 |
16384 |
65,536 |
|
C |
110 |
24 |
8 |
2,097,152 |
256 |
It is a very easy process, once you will learn the method then you will calculate for any prefix length.
Replace all the network bits by 1 and all the host bits by 0.
Now we will do 1 problem to understand this in more clear way-
192 . 168 . 1 . 0
11000000.10100000.00000001.00000000
11111111.11111111.11111111.00000000
255.255.255.0
By looking at the first octet, you can recognize the class of an IP address.
For Class A: first binary octet is 0xxxxxxx. Here, you can see for Class A first bit of first octet is 0. Here x means it could be either 0 or 1.
In decimal notation, first octet always will be lies in the range of 1 – 126. And rest lie in the range of 0-255. First octet decimal range is 1 -126.
For Class B: first binary octet is 10xxxxxx. So, you can see for Class B first 2 bits of first octet always will be 10.
Decimal Octet range: 128-191
For Class C: First binary octet always will be 110xxxxx.
Decimal Octet range is 192-223.
For Class D: First binary octet always will be 1110xxxx.
For Class E: First binary octet always will be 1111xxxx.
Although, Class D and Class E address will not used in configuration.
Public IP is provided by Internet service provider (ISP). Public IP is globally unique. A host with private IP can’t go to the internet. So, whenever a host sitting in our LAN network, want to go on internet, first router performs NAT to convert private into public IP then it forwards the request to the internet.
Private IP is used in LAN network only. Sometimes, private IP also called LAN addresses. Private IP is uniquely defined in a LAN network. It means inside a LAN network, you can’t assign same IP address to 2 different hosts. Although, you can assign same IP address in 2 different LAN networks.
There are certain addresses in each class of IP address that are reserved for Private Networks.
Class A 10.0.0.0 to 10.255.255.255
Class B 172.16.0.0 to 172.31.255.255
Class C 192.168.0.0 to 192.168.255.255
Static IP is not a type of IP, it’s kind of terminology. When an IP address is manually configured in a host then it is called as static IP. And the reason is manually configured IP will not change until you change it manually. We mostly configure IP address manually in routers and switches.
When an IP address is configured through DHCP then it is called as dynamic IP. Mainly for LAN network we configure DHCP server. DHCP server automatically assigns the IP to the hosts.
APIPA stands for Automatically Private IP Address Assignment. When DHCP server fails, automatically an IP address is generated and this address is called as APIPA address. APIPA assigns a class B address, range from 169.254.0.0 to 169.254.255.255.
Expected Interview questions from IP addressing concept are- (for freshers)
So, I answered bit is the smallest unit of data. In binary we have 2 bits that are 1 and 0.