2014/12/22 06:08
Forget the bitwise operations. Here’s how I do subnets. In my head! Any subnet, any mask in 30 seconds or less.
Here’s the deal:
Look at the “interesting” number in the subnet mask. That is, the number that is NOT 0 or 255. In your case:
138.43.39.15
255.255.255.240
Your “interesting” octet is octet 4 ie 240.
Subtract this number from 256 – you’ll get 16 (256-240=16) in this case.
Back to 138.43.39.15 255.255.255.240
256-240=16. Odom calls this the “magic number”. I’ll stick with his definition.
The key to understanding subnet is this “magic number”. Read the following carefully:
If the “magic number” is 16, then
Now read that last section again until it sticks.
In your case, where the magic number is 16, the subnet MUST be one of the following:
0
16
32
48
64
80
96
112
128
144
160
176
192
208
224
240
(256)
There you go – that’s your 16x tables up to 256. Told you to learn this didn’t I? By the way, your 32x tables is just every 2nd number from the above., 64x tables every 4th number and 128x tables every 8th number.
Note that the last entry before 256 is the same as the subnet mask’s “interesting octet”. This is ALWAYS the case.
Back to 138.43.39.15 255.255.255.240 again.
Now your “interesting octet” is the 4th octet, which for your IP address is 15.
So the address you started with is the broacast address for its subnet = 138.43.39.15
Here’s another example:
134.27.183.219 255.255.255.248
Magic number=256-248=8
The “interesting octet” is the last octet, so I focus on 219
Recalling my 8x tables around 219
0
8
..
208
216
224
etc
Or expressed fully:
This one is a bit harder – the interesting octet is the 3rd octet
22.19.178.234 255.255.224.0
Magic number=256-224=32
The interesting octet is the 3rd octet, so I focus on 178.
Recalling my 32x tables around 178
0
32
..
160
192
224
Remember there are only 7 possible magic numbers (8 if you count 256-255=1), so they are not hard to learn. Here they are
Mask Magic number
255 1 (just for completeness)
254 2
252 4 (this is a common one)
248 8
240 16
224 32
192 64
128 128
One more tricky one to finish:
12.34.56.78 255.255.252.0
Magic number=256-252=4
The interesting octet is the 3rd octet, so I focus on 56.
Recalling my 4x tables around 56
0
4
..
48
52
56
60
Finally, if you want to learn this stuff (like for CCNA exam) spend half an hour a night onhttp://www.subnettingquestions.com
Posted by RedNectar Chris Welsh
Categories: GNS3 WorkBench
Tags:
Mobile Site | Full Site
Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.
That is a great way to subnet.You have a typo though. In your last example you say “Magic number=256-248=8” I think that should be “Magic number=256-252=4” Thanks for all your work!
By Sean on 2015/01/18 at 10:57
Sean. Thanks, that’s a very old typo that one! Fixed now
Chris
By RedNectar Chris Welsh on 2015/01/18 at 11:49