[back]

[home]

[next]

IPv4 Netmasks

Definition of Network Masks

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 :

Class A Netmask

The netmask for Class A IPv4 addresses is :
decimal
hexadecimal
binary
255.0.0.0
ff:0:0:0
11111111 00000000 00000000 00000000

Class B Netmask

The netmask for Class B IPv4 addresses is :
decimal
hexadecimal
binary
255.255.0.0
ff:ff:0:0
11111111 11111111 00000000 00000000

Class C Netmask

The netmask for Class C IPv4 addresses is :
decimal
hexadecimal
binary
255.255.255.0
ff:0:0:0
11111111 11111111 11111111 00000000

Purpose of Netmasks

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 :
AND01
000
001

Example

Given this definition of the logical AND operator, consider the IPv4 address of 171.63.14.3, a Class B address whose netmask is therefore, 255.255.0.0. The network number may be computed as follows :
IPv4 address in decimal : 171.63.14.3
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

Apply the logical AND operator :

ADDRESS   :  10101011 00111111 00001110 00000011
NETMASK   :  11111111 11111111 00000000 00000000
   +        ------------------------------------
Network # :  10101011 00111111 00000000 00000000
Thus, the resulting network number is 171.63.0.0. Notice that the hostportion of the address is zero (masked out).

Definition of an IPv4 Network Number

The definition of a network number is the IPv4 address combined with the netmask via the logical AND operator.