As mentioned above, the first few bits of an IP address classify the address as
- Class A,
- Class B, or
- Class C.
This information is sufficient to decide what portion of the address refers to the host and which to the network.
However, this division is a convention and is not programmed into the TCP/IP networking software.
The netmask is a number telling the TCP/IP software which portion of the address is host and which is network.
The netmask itself is a 32-bit number with a one bit set in each position of the network address and a zero bit set in each position of the host address.
It is usually written in dotted decimal form, like an IP address.
If an address is Class A, B, or C, the netmask is completely standard.
For example, a Class A address has eight bits of network address, so the first eight bits of the netmask are 1; it has 24 bits of host, so the next 24 bits are 0. Converted to dotted decimal, this yields 255.0.0.0. The other cases are illustrated in the table below.
More sophisticated netmasks are possible if subnetting is being used, but further discussion of the subject is beyond the scope of this course.