What is Host ID?
It is the fragment of an IP address that uniquely identifies a host within a network. A host ID can be found simply by ANDing the IP address in binary form with its respective default subnet mask (in binary form). The other fragment of an IP address is the network ID, which identifies the network to which the host belongs.
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
What is “network ID” and “host ID” in IP Addresses?
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.