...
The class of an IP address is used to determine the number of bits used for the Network ID, and the Host ID, which ultimately determines the number of hosts on a network. It is the job of the network administrator to assign host IP addresses within a network. Network IP address ranges are assigned through IANA (Internet Assigned Numbers Authority).
Network classes binary encoding
The first octet of the entire 32-bit value is used to determine the class of network
...
You can use binary masking to determine the network class
This piece of code would show the conversion taking place
Code Block |
---|
int ipAddress = 0xC0A80502; // 192.168.5.2
int subClass = ipAddress & 0xF0000000;
System.out.println( Integer.toBinaryString(subClass)); |
The classification systems allow us to partition networks into domains
...
Combining these two models together we get
...
So using the table able Class B network would provide 214 networks (16384), with 216-2 hosts (65534)