What Is A Subnet Mask?

Tuesday, 14. July 2009

So, what is a subnet mask and why do I need one?

This question is always coming up, so I thought it might be a good idea to try and at least give a quick overview.

IP addresses are used to identify your computer on the net. Subnet Masks are used to tell your computer what it should consider as local network traffic, and what it should send off to the gateway for delivery. Here are the basics of network addressing:


  Address: 192.168.0.10
  Netmask: 255.255.255.0
  Network: 192.168.0.0
Broadcast: 192.168.0.255

All these things are required, however, both the network and the broadcast addresses can be derived from the address and subnet mask. Here is how:

We need to show the address and netmask in binary for this to make sense:

11000000 10101000 00000000 00001010 is the ip address
11111111 11111111 11111111 00000000 is the network mask
11000000 10101000 00000000 00000000 is the network address
11000000 10101000 00000000 11111111 is the broadcast address

By doing a binary and we can get the actual network address:

11000000 10101000 00000000 00001010 is the ip address
11111111 11111111 11111111 00000000 is the network mask
11000000 10101000 00000000 00000000 is the network address

Now, by adding the inverse of the if the subnet mask to the network, we get the broadcast:

11000000 10101000 00000000 00000000 network address
00000000 00000000 00000000 11111111 + the inverse of the network mask
11000000 10101000 00000000 11111111 = the broadcast address

We can also divide the address into it’s network and host address parts by splitting the address at the most significant bit boundary of the subnet mask:

11000000 10101000 00000000   00001010 is the ip address
11111111 11111111 11111111   00000000 is the network mask

The red portion is the network portion and the green portion is the host portion. In order for a host to be on the same network, it must have the identical network portion of another host.

In order for a host to talk to another host on a different network, it must use the gateway to get there. But that’s another post!

— Stu

Share

Leave a Reply

You must be logged in to post a comment.