Subnetting can be a daunting subject for anyone getting intobasic networking. When taking the CCNA (Cisco Certified Network Associate) test,time is of the essence. Many people fail because they take too long trying tocalculate binary. While it is important to understand how the binary part of asubnet mask works, frequently you can determine if two addresses are on thesame network without thinking too much about binary. The first thing to do isto memorize a few translations from slash notation to the subnet mask equivalent.For example:
255.255.255.0 = /24
255.255.255.128 = /25
255.255.255.192 = /26
255.255.255.224 = /27
255.255.255.240 = /28
255.255.255.248 = /29
255.255.255.252 = /30
255.255.255.254 = /31
An IP address has 4 sections (Octets) of 8 bits that adds upto 32 bits total. The slash notation simply specifies from left to right howmany network bits there are in the network address. In order to easilydetermine the network you are on without getting into binary, you can memorizethe incremental value of each of the 8 bits in an octet. Incremental value issimply the total number of combinations you can get with 1s and 0s from thespecified bit combined with the bits to the right of it. With 1 bit you get twocombinations. 0 and 1. With 2 bits you get 4 combinations, etc…
Bit number: 8 7 6 5 4 3 2 1
Total combinations: 256 128 64 32 16 8 4 2
A /30 network includes the first 30 bits from the left. 32bits in the entire address minus the 30 network bits leaves 2 bits on the rightside. If you’ve memorized the incremental values above then you know that theincremental value using 2 bits is 4 since there are 4 combinations possiblewith 2 bits. Let’s take a /28 network. 32-28= 4. 4 bits has 16 combinations, sothe incremental value is 16.
Here is how the incremental value helps to quickly determinethe network you are on. If we are given two IP addresses. 192.168.0.33 and 192.168.0.63with a subnet mask of 255.255.255.240, we can quickly determine from the subnetmask that this is a /28 network. The 4 bits (32-28) gives us an incrementalvalue of 16. Everything in the last octet between 0 and 15 (16 totalcombinations) are on the same network. Everything between 16 and 31 are on thesame network. Everything between 32 and 63 are on the same network. Just add ormultiply 16 to get to the range of addresses that you are looking for and seeif they fall into the same range. In this case they are both on the samenetwork because they are in the same range.
This method doesn’t get much harder if your subnet mask is alower slash notation. Just forget the 8, 16, or 24 bits further to the right. Forexample, with a 255.255.240.0 network, we focus on the 3rd octet. Youcan drop the last 8 bits (aka the 0) and think of the address as simply255.255.240. Just as in our previous example, 240 is 4 bits from the right.Since 4 bits gives us 16 combinations, our incremental value is 16. To keepthings simple, I’ll use a similar example of values on the same network. If weare given two IP addresses. 192.168.33.4 and 192.168.63.22 with a subnet maskof 255.255.240.0, we know that the incremental value is 16. The only differenceis that the 16 now applies to the 3rd octet. So everything between192.168.0.0 and 192.168.15.255 are now on the same network. Everything between192.168.16.0 and 192.168.31.255 are on the same network. And finally everythingbetween 192.168.32.0 and 192.168.63.255 are on the same network. This lastrange fits both of the IP addresses given.
Keep in mind that the network most people are used to seeing(255.255.255.0 or /24) has an incremental value of 1 in the 3rdoctet. It may be easier to understand why this is if you consider a /32 network.A /32 network is 255.255.255.255. This leaves no host bits on the right side. Withno bits, there is only one combination possible and therefore an Incrementalvalue of 1. Each address would be on its own network. With the /24 networkthere are 8 host bits all in the 4th octet. That would be 256combinations. The range would be 192.168.0.0 to 192.168.0.255. The next networkrange would be 192.168.1.0 to 192.168.1.255. You can see that the 3rdoctet increments by 1.
With some practice, you can figure out if two addresses areon the same network very quickly without writing down all the binary.