How do subnet masks work?

How do subnet masks work?

What do subnet masks mean and how do they work?

Subnetworks help improve performance, reduce congestion, enhance securityand allow us to isolate networks. On a wide area network, typically eachlocal area network is a subnet. Sometimes, a LAN can be configured to betwo or more subnets.

On an IP internetwork, an address takes the form of a 32-bit number,for instance:

An IP address can be viewed as follows:

If we were referring to a Class B address in the above example, the networkportion of the address would have read: 135.200.

On the other hand, if a Class C was the case, 135.200.45 would haveconstituted the network portion.

A subnetwork mask is also a 32-bit number that indicates the composition ofa IP internetwork; i.e. it reveals how many bits form the network portionand how many bits form the host portion.

Consider the following subnet mask:

FF.FF.FF.0 in hexadecimal, or in decimal.
In binary, thisnumber would read:
Note that the first 24 bits are all 1s (such a subnet is sometimes referredto as a 24-bit mask). This indicates that the first 24 bits of the IPaddress refer to the network portion, and the trailing eight bits refer to thehost portion. Therefore we can have a maximum number of 254 hosts persubnet; in the above example it would be through

In order to decipher network and host portions of an IP address (we assume aClass B address and subnet mask in this example), the following procedure isused:

A logical AND operation is performed between the IP address and subnet mask.For instance: and

In binary, this would be:

10000111.11001000.00101101.11111110AND11111111.11111111.11111111.00000000resulting in:10000111.11001000.00101101.00000000which is:
Therefore the subnet number is 45 and the network is 135.200.

See also  Monetize TikTok For Your Business

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist