Subnet mask and Subnetting

Every IPv4 address has three components: network, host and subnet mask.

The subnet mask marks the boundary between the network and the host bits in an IP address. It also helps in differentiating the network address (the first address) and the directed broadcast address (the last address) in the IP network number.

The subnet mask is a 32-bit address which has the following properties:

1. The binary-0 represents the host and the binary-1 represents the network. For example has a subnet mask 11111111.11111111.11111111.00000000 (in binary) or (in decimal). And hence the first three octets (1s) represent the network and the last octet (0s) represents the host. In other words all the nodes in the network segment will have the same network part (192.168.1.*) and the host part of their address varies only in the last octet (

2. The 0s and 1s in the subnet mask must be contiguous both within the octet and across all the four octets. Study the following examples:

10000000.11111111.11111111.11111111 ( — invalid

11111111.11111111.11111111.10000000 ( — valid

11111111.11111111.00101000.00000000 ( — invalid

11111111.11111111.00000000.00000000 ( — valid

Subnet masks can be represented in 4 ways. Here a list of those ways demonstrating a Class C address.

Subnet mask representations

The dotted-decimal notation and the number of network bits are the most common representations of the subnet mask.

Subnet mask values : Given the fact that values must have all 1s contiguous and 0s contiguous, following are the valid decimal numbers for subnet masks within an octet.

Subnet mask values


Below is the default subnet masks for Class A, B and C along with the number of network and hosts they encompass.

Default subnet mask

The disadvantage of Classful addressing with default subnet masks is poor address efficiency. With Class A addressing for example a network segment can have up to 16,777,214 hosts; Class B 65,534. A typical IP network segment starts to experience the broadcast problem when the number of nodes hits 200 to 500. Assigning a Class B address to a network segment of 500 nodes would waste around 65,000 addresses. You can assign two class C addresses, but you end up with two networks. To solve this problem subnetting was introduced (RFC 950).

With subnetting the higher-order host bits can be borrowed and used along with network bits. As a consequence the network gets segmented into multiple subnets within the network defined by the default subnet mask. One problem with subnetting is as more subnets are created you’ll loose two addresses per subnet (network and directed broadcast address). However, the improvement in address efficiency outweighs the number of IP addresses that need to be reserved for network and directed broadcast addresses.

Before and After Subnetting


Subnet mask itself means nothing without the context of the IP address associated with it. For example, most people would assume that when you see a subnet mask of, you are dealing with a Class C network. However, remember that you can perform subnetting on any class address: A, B and C. So a subnet mask of can also be used for Class A and B networks. Therefore, the IP address and subnet mask have a symbiotic relationship.

symbiosis between IP address and Subnet mask

Below is the table of valid subnet mask values. Note that the Class A subnetting starts from /9 to /30; Class B from /17 to /30 and Class C from /25 to /30.


A tutor named Dan explains nicely the concept of subnetting.



About Deepak Devanand

Seeker of knowledge
This entry was posted in IP Addressing and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s