subnet mask in networking


Trying to understand what a subnet mask is in a networking crash course for work training. Please help 🙏🏼


Are you talking about CIDR (e.g or an actual subnet mask ( ?

An IP address describes 2 things: a network, and a specific host on that network. You can think of it like a first and last name, which describes a family and a specific person in that family. The subnet mask is like the space between the first and last name. It specifies which part belongs to the family, and which part belongs to the individual. John Doe is a specific individual John in the family Doe. If we move the space all the way to the left so that the name is “J Ohndoe” you’ll notice that now there are only 26 unique names available for members of the Ohndoe family. If we move the space all the way to the right so the name is “Johndo E”, we can come up with a lot of individual names but only 26 possible families. The subnet mask is used like the space so that we can adapt to situations where we either need a lot of unique individuals and only a few families, or else a lot of families and each family only has a few individuals.

You’re trying to split a NET(work) into many SUB-networks. The computers are all connected with wires, you can’t re-wire them, so the only thing you can do is separate them apart with rules. Like, even numbers on one subnet, odds on another. If your address is in this range, you’re on subnet A, otherwise you’re in subnet B.

So that’s what the subnet mask does. 255 in decimal = 11111111 in binary. 254 in decimal = 11111110 in binary, and that tells the router to “mask” (ignore) the last bit. 0 means “ignore”. So a computer that has the address 10111001 will be paired with a computer that has 10111000, because the first portion 1011100x is the same for both computers (they have that in common), and the only difference they have (xxxxxxx1 vs xxxxxxx0) is “masked” (ignored). So they’re paired together into a subnet, by this rule.

252 is 11111100, can pair up 4 computers. 248 is 11111000, can pair 8 computers per subnet. And so on. 0 is 00000000, can pair up 256 computers based on the last number of their address. and .3 and .55 and .122 all on the same subnet.

If you wanted to do “odds vs. evens” you’d have a subnet mask of 00000001 (binary) = 1 (decimal). With this (non-standard) subnet mask, the address is masked, but the last bit (which determines “odd” vs “even”) is NOT, so all of the odd-numbered computers will be on one subnet, and all the even-numbered computers on another subnet.