Hi Lifehacker, For some reason whenever I look at a network “subnet” I just can’t figure it out. I understand that the subnet is broken into 8 bits (so 255.255.255.0 would give me 254 addresses). But why? How do I then convert something like 172.32.5.21/12 to get an idea of what the subnet mask would be and how many addresses I would get? Thanks, Net Getting It
Subnet picture from Shutterstock
Dear NGI,
There are really a couple of separate issues to address in your question. Let’s start with the first part – why does a subnet of 255.255.255.0 give you 254 addresses?
This is the way TCP/IP is designed. When devices on a network are in the same subnet, then they are deemed to be on the same segment of a larger network. Even if two devices have the valid network addresses, they won’t be able to communicate unless they’re in the same subnet.
Your second question is “How do I then convert something like 172.32.5.21/12 to get an idea of what the subnet mask would be and how many addresses I would get?”
There’s a useful article at TechRepublic that explains how subnetting works and how many addresses you get.
As far as we can tell, you can’t calculate the subnet from the address although we’re far from networking experts and would gladly be corrected by someone in the Lifehacker family.
Understanding TCP/IP addressing and subnetting basics [Microsoft]
Address Allocation for Private Internets [IANA]
Cheers
Lifehacker
Got your own question you want to put to Lifehacker? Send it using our [contact text=”contact form”].
Comments
8 responses to “Ask LH: How Do Subnets Work?”
Binary and masking. 255 in binary is 11111111. In a subnet mask, any area that has a 1 specifies a network bit, and anywhere that has a 0 specifies a host bit. 255.255.255.0 means the first 24 bits are network bits, and the last 8 bits are host bits. Host bits are assigned to hosts on a network, with 8 host bits you can have (2^8)-2 hosts, which is 254. The first and last address in the range, that is, the addresses where the host bits are all 0 and the host bits are all 1, are reserved. (All 0’s is simply referred to as the “network address” and I think all 1’s is the broadcast address. I’ve never used a broadcast address so I could be wrong on that one.)
The subnet mask will go straight 1’s and then once they’ve finished, the rest are 0’s. So 11111111.1111111.11111111.1111000 would be valid but 11111111.11110000.11111111.11100000 wouldn’t be. It is also why 255, 254, 252, 248, 240, 224, 192, 128 and 0 are the only decimal numbers that will appear in a subnet mask (they are 11111111, 11111110, 11111100 etc. respectively.) I’d recommend reading up on the binary number system in addition to the other articles linked to above (see http://www.mathsisfun.com/binary-number-system.html).
The shortened version, say /12, is the number of networking bits (the 1’s). So in binary that would look like 11111111.11110000.00000000.0000000, which converted to decimal is 255.240.0.0. There are plenty of conversion utilities online, which are useful even if you do know how it all works (but understanding how it works is really beneficial.) Just Google “subnet calculator” or something similar.
The Microsoft article goes into more detail and looks quite good from skimming over it, and in addition it covers classes (which are somewhat irrelevant since variable bit subnet masks, except their legacy still remains because it was the way of doing things originally.)
Thanks, I found that much more helpful than the incredibly brief article gives. Yours answered some of my questions!
An easy way in your head (this works for me and everyone is different:
I’ll work in class C to simplify things.
Say I have a subnet mask of 255.255.255.128 to find out how many users i minus the last octet of that subnet which is 128 from 256 = 128 and then of course – 2 for the network and broadcast addresses = 126 hosts.
As for the slash notation (/12) in your question. I work in octets the clossest one being the first or a /8 then work out how many more bits I need and simply count (i need another 4) 128, 192, 224, 240 = 255.240.0.0
It’s all to do with binary. There are HEAPS of videos on youtube and dozens of different ways of working it all out. But we haven’t barely scratched the surface here or really even mentioned VLSM. Needless to say unless you want to be a network engineer, all you probably need to know that your normal home network of something like 192.168.*.* will probably have a /24 or 255.255.255.0 subnet mask giving you 254 hosts.
thats a slash 12 subnet, too tired to do vlsm right now but easiest way to know whats going on is that that with slash 12 you can have 32766 (minusing network and broadcast) active connections talking to each other at layer2 (switches).
A /12 Subnet off my head is 255.255.0.0
Nope, 255.240.0.0, Class A Public Network. In Conclusion its a fuck tone of addresses
“The fuck tones” would be a great name for a band.
I can remember learning how subnets works when doing a CISCO course thingy when I was in highschool (was kind of boss we got to do that). It took me a while to figure it out, and at one point I ended up explaining it to the class. Ask me now though, and I certainly didn’t retain THAT knowledge 😛
5. You have Class-C network address 192.168.32.0/24. You need to subnet your network to have 14 subnets. Based on Classful network addressing, fill in the following table:
Subnet name Subnet address First host address Last host address Subnet mask CIDR
Can some one please help me. Thanks