Network Classes
The company in charge of overseeing the Internet, InterNIC, assigns IP addresses. There are classes for these IP addresses. Classes A, B, and C are the most prevalent ones among them. Although they exist, end users do not use classes D or E. The default subnet mask varies for each address class. An IP address’s first octet can be used to determine its class. The ranges of Class A, B, and C Internet addresses are listed below, along with a sample address for each:
- Class A networks have 0-127 as their first octet and utilise 255.0.0.0 as their default subnet mask. 10.52.36.11 is classified as a class A address. 10, its initial octet, falls between 1 and 126, inclusive.
- Class B networks have 128–191 as their first octet and 255.255.0.0 as their default subnet mask. Address 172.16.52.63 belongs to the class B address set. Its initial octet is 172, spanning from 128 to 191, inclusive.
- Class C networks have 192-223 as their first octet and utilise 255.255.255.0 as their default subnet mask.
A packet is received which has destination address -200.1.2.20 . Then how the router will identify that which subnet it belongs to . It’ll be done using Subnet Mask
A subnet mask is a 32-bit number which is used to identify the subnet of an IP address. The subnet mask is combination of 1’s and 0’s. 1’s represents network and subnet ID while 0’s represents the host ID. For this case, subnet mask is,
11111111.11111111.11111111.11000000
or
255.255.255.192
So in order to get the network which the destination address belongs to we have to bitwise & with subnet mask.
11111111.11111111.11111111.11000000
&& 11001000.00000001.00000010.00010100
-----------------------------------------------------
11001000.00000001.00000010.00000000
The address belongs to,
11001000.00000001.00000010.00000000
or
200.1.2.0
The internal router will forward the packet to the network through an interface . The interface will be identified by the routing table residing in the router.
If the network id doesn’t matches with any then the packet will be sent to default entry.
Default entry has network id as 0.0.0.0.
In some cases the network id may match with two entries in the routing table, so here the interface having the longest subnet mask (more 1’s) is selected.
Role of Subnet Mask
The host or client address and the network or server address are the two parts of the IP address that are present on every computer device. Either a DHCP server or a human, using a static IP address, configures the IP addresses.