Initially in 1980 IP address was divided into two fixed parts NID=8 bit and HID=24 bit. NID (Network ID) represents the entire network for a specified host. HID (Host ID) represents a specified user IP address within the network. So there are only 28 i.e., 256 networks are available and there are 224 i.e., 16M hosts per network. If even a small organization wants to purchase a network then it should buy one network in which there are 16M hosts that can be connected this is the drawback of this fixed representation of IP address.
IP addresses are divided into 5 classes:
- Class A is used for big networks such as ISP networks.
- Class B is used by big organizations.
- Class C is used by small organizations.
- Class D no NID and HID all 28 bits are used to define the multicast address.
- Class E is reserved for research and future purchases.
Range of All Classes
Class A: 1.0.0.0 to 127.255.255.255
Class B: 128.0.0.0 to 191.255.255.255
Class C: 192.0.0.0 to 223.255.255.255
Class D: 224.0.0.0 to 239.255.255.255
Class E: 240.0.0.0 to 255.255.255.255
What is Network ID?
A network ID also known as NetID is a fixed bit in the IP address that represents the entire network of any host It is connected to the network. i.e., it tells the network of the host by which the host is connected.
The total size of the IP address is 32 bits and the IP address is divided into four octets each of size is 8 bits. And further, divide into NID and HID. Let’s discuss each class in detail.
Class A: The first octet represents NID so there are 8 bits for NID and 24 bits for HID. And the first bit of the first octet is always 0.
Class B: The first two octets represent NID so there are 16 bits for NID and 16 bits for HID. And the first two bits of the first octet are fixed i.e., 10.
Class C: The first three octets represent NID so there are 24 bits for NID and 8 bits for HID. The first three bits of the first octet are fixed i.e., 110.
Class D: All bits are fixed for NID.
Class E: All bits are fixed for NID.
The network ID uses a prefix based on its class. Classes A, B, C, D, and E use prefixes ‘0’, ’10’, ‘110’, ‘1110’, and ‘1111 0’, respectively. Additionally, as seen in the graphic below, each class has a different number of octets reserved for the host ID. Class A reserves 3 octets, class B reserves 2, class C reserves 1, and class D/E have no reserved octets for the host ID.
Combining these two facts, we see that Classes A, B, C, D, and E use 7, 14, 21, 28, and 27 bits, respectively, for the actual network ID.
What is Host ID?
It is the fragment of an IP address that uniquely identifies a host within a network. The network ID can be found by ANDing the IP (in binary) and subnet mask (in binary). The host ID is found in the same way, except one must first invert the subnet mask (not an official term, but could that binary value the ‘host mask’).
Host ID and Network ID
For Example, In the above Image, the IP address of host C is 198.162.30.4 which means it belongs to class C, so its default subnet mask will be 255.255.255.0; Now applying AND on both, it will give the host ID 0.0.0.4 and network ID 198.162.30.0.
Question 1: What is the network address if the destination address is 200.45.34.56 and the subnet mask is 255.255.255.240?
Solution: We know the range of class C is from 192 to 223 so the given IP address belongs to class C. As given subnet mask 255.255.255.240
To find the network address we perform ANDing operation between the IP address and subnet mask.
200.45.34.00111000 AND 255.255.255.11110000
we get 200.45.34.48 as a network address.
Question 2: A company is granted the site address 181.56.0.0. The company needs 1000 subnets. Find the subnet mask
Solution: As we know the range of class B IP addresses in the first octet is from 128 to 191 so the given address belongs to class B.
and the default subnet mask of class B is, 255.255.0.0
to get 1000 subnets we perform a log operation
log 1000=10
So, we require extra 10 bits from 255.255.00000000.00000000 to get the subnet mask i.e.; 255.255.00000000.000000000
So, the required subnet mask is 255.255.11111111.11000000 or 255.255.255.192
Conclusion
ID address is divided into two parts that is Network ID and Host ID. Network ID indicates the specific network to which the address belongs. Host ID Identifies the specific device within that network. Together, these components enable efficient routing of data packets across the networks, ensuring proper delivery to the correct device.
Frequently Asked Questions on Network ID And Host ID In IP Addresses – FAQs
How I find my network IP address?
Search “cmd” to open command prompt. Write “ipconfig” command in cmd If you connect to the internet wirelessly you’ll find the router IP address in the section “Wireless LAN Adapter Wi-Fi.
What is class D network ID and Host ID?
Class D is reserved for multicast address so there is no concept of NID and HID in class D.
How to find the network ID of any IP address?
To find the network ID of any subnet, perform ANDing operation of that IP address with subnet mask.
Why we can’t assign a 24.0.0.0 IP address to any host?
When ever we have all zeros in HID part of any IP address, that IP address represent the NID of entire network this is the reason we can’t assign this IP address to any host.
Next Article
What is a Network Address?