Ask Leo! by Leo A. Notenboom

What is a "subnet mask"?

Search First! Then browse: Categories | Full Archive | By Date | Newsletter

Home » Networking » Network IP Addressing

Summary: A subnet mask is a way of telling your computer or router what network addresses it can consider local and which are remote.

A subnet mask is a way of telling your computer or router what network addresses it can consider local and which are remote.

Well, to be blunt it's something you probably never need to know about. Sure, you may have to "get it right" when you enter one into a router configuration, but as to what it means or why it matters, why bother?

You want to know anyway, don't you? Fair enough.

A subnet mask is just a nifty way to define sub-networks. And that of course opens up a slightly larger can of worms.

I'm going to use phone numbers as an analogy here. Like any it's an imperfect analogy, but I think it'll help make the point.

In North America, phone numbers are 10 digits long and consist of three parts:

  • The area code of three digits. Originally an area code defined exactly that - a geographical area. Area code 206 for example was once all of western Washington state.

  • The exchange of three digits. The exchange identified the switching equipment that typically covered a sub-region with in the area code. For example, 788 represents the "Duvall" exchange - located near the city of Duvall in western Washington is a small utility building that houses the equipment that is the 788 exchange.

  • And finally, the four digit line number. It's this number that identifies each pair of wires the leave the exchange and arrive at a real telephone set.

So what we take for granted as a 10 digit "phone number" is really a construction of three distinct numbers, each with a specific meaning. (And for the record, many of those meanings have become blurred over the years, particularly with the advent of cellular phones.)

Now let's look at the internet. You already know that each computer connected to the internet has its own equivalent of a phone number, called its "address". Names, such as "www.microsoft.com" actually map to these numeric addresses, such as "207.46.156.220". As you might already be thinking each internet (or IP - for Internet Protocol) address breaks down into components not unlike the 10 digit phone number. The difference is that the components are not always the same size.

IP addresses broken down into what are called "classes". Classes are kind of like area codes; they define where, at the highest level, an address lives. To grossly over-simplify, classes are really just a contiguous block of internet addresses. Within each block though it's still desirable to "subdivide" that network into smaller logical groups. For example a class-A network can have 16 million addresses. It's not a good idea to have traffic for 16 million computers traveling across the entire network. That's where "subnetting" and the subnet mask comes in. The internet protocol's rough equivalent to the telephone's exchange number.

The "problem"with subnets is that each network administrator who's been assigned a range of IP addresses is free to create their own subnets and to define how large they are. It's the subnet mask that defines how big a part of the internet address is to be used as the subnet number.

Unfortunately this is also where we have to start thinking like computers in binary. We'll use these addresses:

  1) 164.109.28.3   [binary: 10100100 01101101 00011100 00000011]
  2) 164.109.27.233 [binary: 10100100 01101101 00011011 11101001]
  3) 164.109.139.4  [binary: 10100100 01101101 10001011 00000100]

And this subnet mask:

  255.255.128.0 [binary: 11111111 11111111 10000000 00000000]

The mask's binary digits are set to 1 to indicate the positions of an internet address that define the subnet. Conversely, it's set to zero for that portion of the address that defines the specific computer on that subnet.

If we do the masking and converting and other what-have-you, we find that of our example addresses #1 and #2 are on the same subnet: 164.109.0.0 while #3 is on a different subnet: 164.109.128.0.

Which after all this brings us to an even more important question: why should we care?

It's all about routing. When information flows across the internet, it flows through equipment called "routers". Routers look at the IP address the information is destined for and decide on the best way to get it there. A subnet is a quick way to know where the information belongs. For example, a packet from our example #1 to example #2 is on the same subnet so routers can take advantage of that information and not send the packet anywhere else. A packet from #1 to our example #3 however is destined for a computer on a different subnet and the routers handling that packet will know to send it along a different path to get there.

To use our telephone analogy again, if I'm in Duvall making a call on my 788-xxxx telephone to another 788-xxxx telephone then the phone equipment knows that it doesn't have to try anywhere else - it all happens within the Duvall exchange. On the other hand, if I try to call a 483-xxxx number then the 788 exchange needs to route my call to other equipment within my area code that knows how to find the 483 exchange.

As you can imagine, I've only scratched the surface here. IP addresses, subnets and supernets, routing, special purpose addresses, network address translation; the internet's a complicated world. If you're interested in reading further here are some resources:

Article C1906 - March 13, 2004

Helpful? Get new articles weekly by email in my FREE newsletter!

Your Name:
Your Email:


Why Subscribe?

Recent Comments
52 Comments

how do i get to know what my subnet mask is and my gateway is

Posted by: jake aleck at June 11, 2007 2:30 PM

quit good info keep it up leo

Posted by: e.solomon at June 12, 2007 3:40 AM

Is the network mask the same as the subnet mask ?

Posted by: Alex at August 29, 2007 8:32 AM

Open a command prompt and type
ipconfig /all
this will tell you or IP settings, default gateway IP, etc...

Posted by: Robert Reeks at October 18, 2007 7:11 AM

where can i find the sub mask, gateway, the dns1 and dns2 at please help

Depends on the situation. It's normally provided by whomever provides the network you are attempting to connect to.
- Leo
11-Oct-2008

Posted by: Terry Rhodes at October 10, 2008 1:51 PM

im very confused with your explanation of subnet masks if i provide you my ip address could you please work out my subnet mask 78.145.35.16. thank you very much.

I can't. That's information that has to come from whomever provides your network connection.
- Leo
14-Oct-2008

Posted by: evan rees at October 13, 2008 1:01 PM

Thank you for this! I'm in CCNA, and I've known how to subnet, and how to do the number crunching, but I just couldn't figure out what the mask actually DID...Pretty bad, I know. Awesome tutorial though, pretty sure I understand now

Posted by: Alabaster at January 16, 2009 9:00 PM

good info indeed..but im pretty much confuzd on the binary numbers how do u convert into those?

Posted by: tsepang at May 29, 2009 5:04 AM

how do i find my subnet mask number. i'm trying to log onto my router and i need my subnet mask number, gateway, dns 1 and dns 2 numbers
PLEASE HELP!!!
[email address removed]

Posted by: anathea at May 29, 2009 10:57 AM

"The day you stop learning is the day you start becoming obsolete."

Thank you Leo for taking the time to shed some Light on these,[Quote]...translation; the internet's a complicated world. [/Quote]
So true.
And I also thank you for the links U provided 4 further reading on,,,

A+
Luc from Montreal, Qc, Canada

Posted by: Luc at August 13, 2009 7:11 PM

Post a comment on "What is a "subnet mask"?":






(Email Address will not be published.)

Remember Me?

By popular demand...
my tip jar
Cuppa Joe
Buy Leo a Latte!

(you may use HTML tags for style)

RSS feed Subscribe to the RSS Feed specifically for comments on this article.

Before commenting, please...

  • Read the article at the top of this page. If your comment shows you didn't, it'll be deleted and ignored.

  • Comment only on this article. Use the Google search box at the top of the page if you have a question about something else.

  • Don't include personal information in the comment. No email addresses. No phone numbers. No physical addresses.

  • Don't spam. Excessive links to unrelated sites within a comment or across multiple comments will cause all such comments to be removed.

  • Don't ask me to recover lost passwords or hacked accounts. I can't, and those comments will be deleted.

  • I can't respond to every comment. And I can't vouch for the accuracy of others who do.

Please wait. Your comment is being processed ...


Question? Ask Leo!