This is the hardest bit to grasp - took me ages. It's helpful to think in
terms of binary numbers. An IP address is usually written as "dotted
decimal" but the "mask" operation only really works when you "translate" to
binary. IP addresses are (currently) always four groups of three digits, but
let's illustrate it with a very short IP address of only one group of three
decimal digits, say: 123.
Just as "Eight" would be written in binary as 1000, so,
"Two hundred and fifty-five" would be written as 11111111, and
"One hundred and twenty-three" would be written in binary as 01111011
Tip - you can use the XP calculator in "Scientific" view and toggle between
dec and bin views. Be sure to add missing leading 0's - there should always
be 8 binary digits.
So let's say you have an IP address in decimal of 123. If you have a subnet
mask of 254, the binary version of that is 11111110. The bitwise masking
operation defines all the numbers which "match" - think of the 1's as holes
and the 0's as blocked. Where there are holes, you can see the number
underneath.
01111011 = 123 (base address)
11111110 = 254 (subnet mask)
-----------
yyyyyyyn Digits showing through the "holes" are significant.
Those not visible are "wildcards".
This gives you:
0111101* These are the leading digits of any address in the subnet we've
defined..
Remember you're dealing with 8 bit numbers. There are two 8-bit numbers
which start with
0111101*, and those are:
01111011 = 123
01111010 = 122
Job done.
Now if you use a shorter subnet mask of (say) 6 leading 1's instead of 7, so
the mask is
252 = 11111100
you get
01111011 = 123 (base address)
11111100 = 252 (new subnet mask)
-----------
yyyyyynn (digits showing through the "holes") Think of the 1's in the mask
as meaning "use the corresponding digit from the base address", and the 0's
in the mask as meaning "either 0 or 1",
and there are four 8-bit numbers which start with the same 6 digits as our
base address of 123
011110**
These are:
01111000 = 120
01111001 = 121
01111010 = 122
01111011 = 123
Now if you scale this back up to the real world so there are four groups of
three decimal digits, each representing an 8-bit binary number, the same
process applies. Note that subnet masks are often "contiguous", meaning
that they could be described as "the first x binary digits" but they don't
have to be - they can be any binary pattern (much harder to grasp without
thinking in binary.
As a final exercise, check my rusty binary arithmetic:
Your address of 172.022.033.079 corresponds to the binary number:
11111111111111110010000101001111
Your subnet mask of 255.255.224.000 corresponds to the binary number:
11111111111111111110000000000000
Now "mask" one with the other to get:
11111111111111110010000101001111
11111111111111111110000000000000, so all addresses in the subnet must begin:
1111111111111111001*************
(This should all line up in a fixed-width font like Courier)
There are 8192 addresses (which is 2 to the power 13 - count the stars!)
addresses in any subnet defined by the mask 255.255.224.000. The Base
Address defines which 8192 addresses they are.
Now don't you wish you'd never asked?