Class A, B and C IPv4 addresses are defined as having a portion of the address reserved for the network number and the remainder for the host.
A network mask (netmask) is defined for each of the three classes of IPv4 addresses so that the system may compute the network number froma ny given IPv4 address. The definitions of the netmask for each of the three classes of addresses follows :
The purpose of netmask is to preserve the network portion number of the IPv4 address and mask out or remove the host portion number of the IPv4 address. This is done by the system using the binary operation called logical AND. When viewing a netmask in binary, the 1 bits preserve and the 0 bits mask out.
Computing Network Numbers
The network number is computed by using a logical AND operator on the IPv4 address a,d its associated netmask. The logical AND operator is a binary function, which may be defined as shown in the following table :
Given this definition of the logical AND operator, consider the IPv4 address of 184.108.40.206, a Class B address whose netmask is therefore, 255.255.0.0. The network number may be computed as follows :
IPv4 address in decimal : 220.127.116.11
IPv4 address in binary : 10101011 00111111 00001110 00000011
Class B netmask in decimal : 255.255.0.0
Class B netmask in binary : 11111111 11111111 00000000 00000000