Subnetting made easy

What is “subnetting”?

“Subnetting” means we borrow some bits from the Host part to add to the Network part. This allows us to have more networks than using the default subnet mask. For example, we can borrow some bits in the next octet to make the address 11.1.0.1 belong to a different network from 11.0.0.1.

What's the benefit of subnetting? 
Reduce the size of the routing tables.
Reduce network traffic. Broadcast traffic can be isolated within a single logical network.
Provide a way to secure network traffic by isolating it from the rest of the network.

3 main classes of IP address are :
Class A Range 0 - 127 in the first octet
Class B Range 128 - 191 in the first octet
Class C Range 192 - 223 in the first octet


NOTE : 0 and 127 which belongs to Class A are reserved for other purpose.


We can split IP address as mentioned below. IP address consist of 32 bits and we can write it as 4 parts having 8 bits in each


NNNNNNNN . HHHHHHHH . HHHHHHHH . HHHHHHHH
Class A [One network portion and 3 host portion]

NNNNNNNN . NNNNNNNN . HHHHHHHH . HHHHHHHH
Class B [2 network portion and 2 host portion]

NNNNNNNN . NNNNNNNN . NNNNNNNN .
HHHHHHHH
Class C [3 network portion and one host portion]

At each dot imagine that there is a boundary, ie there are boundaries after bits 8, 16, 24, and 32. This is an important concept to remember.

While subnetting bits will always move to your right side.No change will occur in Octets having 255

For eg:
255.255.255.0 – here changes will takes place in fourth octect
255.255.128.0 – here changes will takes in third octect
255.255.255.128 – here changes will takes place in fourth octet
 
First Octet
 Second Octet
 third octet
 Fourth Octet
          255     
     255               
   255    
    0

Default subnet mask of Class A : 255.0.0.0 [CIDR /8 ]
Default subnet mask of Class B : 255.255.0.0  [CIDR /16]
Default subnet mask of Class C : 255.255.255.0 [CIDR /24 ]

Now have a look at the block sizes .If you can memorize Block Size subnetting will be so easy

Subnet Mask
CIDR
Block Size
ON bits on last octet
OFF bits
255.255.255.128
/25
128
1
7
255.255.255.192
/26
64
2
6
255.255.255.224
/27
32
3
5
255.255.255.240
/28
16
4
4
255.255.255.248
/29
8
5
3
255.255.255.252
/30
4
6
2
255.255.255.254
/31
2
7
1

Important : We can find block size by reducing our CIDR value from next Boundary.

Lets have few examples

Q : What subnet does  192.168.10.25/29 belongs to ?

Our mask is  /29. The next boundary is 32. So 32 - 29 = 3. Now 2^3 = 8 which gives us our block size i.e. 2 to the power of 3 equals 8. Subnet mask for /29 is 255.255.255.248

First network address : 192.168.10.0
Second network address : 192.168.10.8
Third network address : 192.168.10.16
Fourth network address :192.168.10.24
Fifth network address : 192.168.10.32

Our IP address comes in 192.168.10.24 range

Q :What is the broadcast address of the network 172.27.216.80/28

Our mask is /28.Next Boundary is 32. So 32-28 = 4 Now 2^4 =16 which gives our block size

Given network is 172.27.216.80/28 .We get block size is 16.So next network will be 172.27.216.96.Broadcast address will be the last ip address of 172.27.216.80 network.So it will be 172.27.216.95

Q : What valid host range is the IP address 172.20.232.102 255.255.255.0 a part of?

Here subnet mask is given as 255.255.255.0
Valid host = 2^[Off bits ] -2 means 2^8 -2 =254.we know 2^8 is 256.

Note :Off bits means number of 0’s . 11111111.11111111.1111111.00000000

Q: What is the first valid host on the subnetwork that the node 172.30.119.235 255.255.255.128 belongs to?

Here subnet mask is 255.255.255.128 .So from above table CIDR is /25.next boundary is 32.So 32-25 = 7 .So block size is 2^7 = 128

Network address of 172.30.119.235 is 172.30.119.128 and first valid host is 172.30.119.129
Q : What subnet does  172.16.16.25/20 belongs to ?

Our mask is  /20. The next boundary is 24. So 24 - 20 = 4. Now 2^4 = 16 which gives us our block size i.e. 2 to the power of 4 equals 16. Subnet mask for /20 is 255.255.240.0

First network address : 172.16.0.0
Second network address : 172.16.16.0
Third network address : 172.16.32.0
... etc


So our IP address comes in 172.16.16.0 range

Full list

CIDR
Subnet Mask
Addresses
Wildcard




/32
255.255.255.255
1
0.0.0.0
/31
255.255.255.254
2
0.0.0.1
/30
255.255.255.252
4
0.0.0.3
/29
255.255.255.248
8
0.0.0.7
/28
255.255.255.240
16
0.0.0.15
/27
255.255.255.224
32
0.0.0.31
/26
255.255.255.192
64
0.0.0.63
/25
255.255.255.128
128
0.0.0.127
/24
255.255.255.0
256
0.0.0.255
/23
255.255.254.0
512
0.0.1.255
/22
255.255.252.0
1,024
0.0.3.255
/21
255.255.248.0
2,048
0.0.7.255
/20
255.255.240.0
4,096
0.0.15.255
/19
255.255.224.0
8,192
0.0.31.255
/18
255.255.192.0
16,384
0.0.63.255
/17
255.255.128.0
32,768
0.0.127.255
/16
255.255.0.0
65,536
0.0.255.255
/15
255.254.0.0
131,072
0.1.255.255
/14
255.252.0.0
262,144
0.3.255.255
/13
255.248.0.0
524,288
0.7.255.255
/12
255.240.0.0
1,048,576
0.15.255.255
/11
255.224.0.0
2,097,152
0.31.255.255
/10
255.192.0.0
4,194,304
0.63.255.255
/9
255.128.0.0
8,388,608
0.127.255.255
/8
255.0.0.0
16,777,216
0.255.255.255
/7
254.0.0.0
33,554,432
1.255.255.255
/6
252.0.0.0
67,108,864
3.255.255.255
/5
248.0.0.0
134,217,728
7.255.255.255
/4
240.0.0.0
268,435,456
15.255.255.255
/3
224.0.0.0
536,870,912
31.255.255.255
/2
192.0.0.0
1,073,741,824
63.255.255.255
/1
128.0.0.0
2,147,483,648
127.255.255.255
/0
0.0.0.0
4,294,967,296
255.255.255.255


Hope you feel subnetting is easy now..You can practice more questions at http://www.subnettingquestions.com/

Happy Subnetting.....

If you have any doubts regarding subnetting feel free to ask in comment section :)

9 comments:

  1. very well . gr8 work man keep it up :))

    ReplyDelete
  2. That table is quite nice, similar to the one I used for my exam but I didn't need the column for the wildcard mask (just work it out as needed).

    ReplyDelete
  3. very good thanks. is answer for the last question correct ?

    ReplyDelete
    Replies
    1. That was a typo.I corrected it.Thanks for pointing it out

      Delete
  4. i think class A IP range is from 0-126 and 127 reserved for loop back . am i right ?

    ReplyDelete
  5. class A range is correct it is 0-127 but in which 0 and 127 is not because it is reserved...

    ReplyDelete