Tuesday, 31 July 2012

IP V4 SUBNETTING


Subnetting is a logical procedure of the deviding large no. of network into smaller segment.
The two types of subnetting are:
  1. Static length subnet mask(fixed-length subnet mask (FLSM))
  2. Variable length subnet mask (VLSM)
Static Length' subnetting
If all the subnetworks in a single network use the same subnet mask, it is called as 'Static Length' subnetting.
Ex: In FLSM If address starts with 195.3.2.1/26, then whole network will belong to same subnetmask and we can't assign as another subnet  like 197.22.75.96/28

Variable Lenght Subnet Mask (VLSM)
Variable Length Subnet Masking - VLSM - is a technique that allows network administrators to divide an IP address into different subnets sizes, unlike simple same-size Subnetting (FLSM).
The VLSM diagram below:


IP SUBNETTING:



Class c Subnetting: In subnetting we are borrowing host bits to network bit.
Class c have 24 network bits and 8 host bits so 
Total no of network in class C= 221=2097152
Total Host per Network in class C= 28-2 =254
If we want to make more network which contain less than 254 host per network so we will do subnetting and we will borrow bits in network from host.
Before starting we should understand subnet bits and there value:

Host Octect
1
1
1
1
1
1
1
1
   1               2             3         4          5         6         7         8
   128          64          32       16        8          4         2        1
   27 +         26 +       25 +     24 +    23 +     22 +    21 +    20  

128 for One bit borrow
27=128
64 for Two bit borrow
26=64
32 for Three bit borrow
25=32
16 for four bit borrow
24=16
8 for five bit borrow
23=8
4 for six bit borrow
22=4
2 for seven bit borrow
21=2
1 for eight bit borrow
20=1

Example:
192.168.10.0/27
Total no of network bit =24+3=27 (class c have 24 network bit and added borrowed three bits)
Here we have borrowed three bit from host to network so subnet will be
128+64+32=224
255.255.255.224
Maximum No of subnet= 23=8 (Borrow bit Three)
Total no of host bit=8 (Host bit) - 3 (Borrowed Bits) = 5 (class c have 8 host bit and three bit borrowed so we have minus)
Maximum no of host per subnet= 25-2=30
Block Size=256-224=32

Subnetting:
    Subnet          ,                    Valid Hosts                       ,      Broadcast      
1- 192.168.10.0    ,   192.168.10.1 to 192.168.10.30     ,     192.168.10.31  
2- 192.168.10.32   ,   192.168.10.33 to 192.168.10.62  ,     192.168.10.63  
3- 192.168.10.64   ,   192.168.10.65 to 192.168.10.94  ,     192.168.10.95  
4- 192.168.10.96   ,   192.168.10.97 to 192.168.10.126   ,  192.168.10.127 
5- 192.168.10.128  ,   192.168.10.129 to 192.168.10.158 , 192.168.10.159 
6- 192.168.10.160  ,   192.168.10.161 to 192.168.10.190  ,192.168.10.191 
7- 192.168.10.192  ,   192.168.10.193 to 192.168.10.222  ,192.168.10.223 
8- 192.168.10.224  ,   192.168.10.225 to 192.168.10.254  ,192.168.10.255

Class B Subnetting: In subnetting we are borrowing host bit to network bit.
Class B have 16 network bits and 16 host bits so 
Total no of network in class B= 214=16384
Total Host per Network in class B= 216-2 =65534
If we want to make more network which contain less than 254 host per network so we will do subnetting and we will borrow bits in network from host.
Before starting we should understand subnet bits and there value:

Host Octect
1
1
1
1
1
1
1
1
      1             2         3          4          5          6         7        8
    128        64        32       16         8          4          2        1
     27 +      26 +     25 +     24 +      23 +     22 +    21 +     20  


128 for One bit borrow
27=128
64 for Two bit borrow
26=64
32 for Three bit borrow
25=32
16 for four bit borrow
24=16
8 for five bit borrow
23=8
4 for six bit borrow
22=4
2 for seven bit borrow
21=2
1 for eight bit borrow
20=1

Example:
172.16.10.0/18
Total no of network bit =16+2=18 (class B have 16 network bit and added borrowed two bits)
Here we have borrowed three bit from host to network so subnet will be
128+64=192
255.255.192.0
Maximum No of subnet= 22=4 (Borrow bit Two)
Total no of host bit=16 (Host bit) - 2 (Borrowed Bits) = 14 (class B have 16 host bit and two bit borrowed so we have minus)
Maximum no of host per subnet= 214-2=16382
Block Size=256-192=64

Subnetting:                    
     Subnet          ,                 Valid Hosts                       ,       Broadcast      
1- 172.160.0.0     ,   172.160.0.1 to 172.160.63.254     ,    172.160.63.255 
2- 172.160.64.0    ,   172.160.64.1 to 172.160.127.254   , 172.160.127.255
3- 172.160.128.0   ,   172.160.128.1 to 172.160.191.254 ,172.160.191.255
4- 172.160.192.0   ,   172.160.192.1 to 172.160.255.254  ,172.160.255.255

Subnetting with more than 8 bits:
Example:
172.16.10.0/27
Total no of network bit =16+11=27 (class B have 16 network bit and added borrowed 11 bits)
Here we have borrowed 11 bit from host to network so subnet will be
128 +64+32+16+8+4+2+1= 255                          128+64+32=224
255.255.255.224
Maximum No of subnet= 211=2048 (Borrow bit Three)
Total no of host bit=16 (Host bit) - 11 (Borrowed Bits) = 5 (class B have 16 host bit and 11 bit borrowed so we have minus)
Maximum no of host per subnet= 25-2=30
Block Size=256-224=32
Subnetting:
Subnet          ,   Valid Hosts                       ,                   Broadcast      
172.16.0.0      ,   172.16.0.1 to 172.16.0.30             ,   172.16.0.31    
172.16.0.32     ,   172.16.0.33 to 172.16.0.62           ,   172.16.0.63    
172.16.0.64     ,   172.16.0.65 to 172.16.0.94           ,   172.16.0.95    
172.16.0.96     ,   172.16.0.97 to 172.16.0.126         ,   172.16.0.127   
172.16.0.128    ,   172.16.0.129 to 172.16.0.158      ,   172.16.0.159   
172.16.0.160    ,   172.16.0.161 to 172.16.0.190       ,   172.16.0.191   
172.16.0.192    ,   172.16.0.193 to 172.16.0.222       ,   172.16.0.223   
172.16.0.224    ,   172.16.0.225 to 172.16.0.254        ,   172.16.0.255   
172.16.1.0      ,   172.16.1.1 to 172.16.1.30                 ,   172.16.1.31    
172.16.1.32     ,   172.16.1.33 to 172.16.1.62             ,   172.16.1.63    
172.16.1.64     ,   172.16.1.65 to 172.16.1.94            ,   172.16.1.95    
172.16.1.96     ,   172.16.1.97 to 172.16.1.126          ,   172.16.1.127   
172.16.1.128    ,   172.16.1.129 to 172.16.1.158      ,   172.16.1.159   
172.16.1.160    ,   172.16.1.161 to 172.16.1.190      ,   172.16.1.191   
172.16.1.192    ,   172.16.1.193 to 172.16.1.222      ,   172.16.1.223   
172.16.1.224    ,   172.16.1.225 to 172.16.1.254      ,   172.16.1.255   
172.16.2.0      ,   172.16.2.1 to 172.16.2.30               ,   172.16.2.31    
172.16.2.32     ,   172.16.2.33 to 172.16.2.62          ,   172.16.2.63    
172.16.2.64     ,   172.16.2.65 to 172.16.2.94          ,   172.16.2.95    
172.16.2.96     ,   172.16.2.97 to 172.16.2.126        ,   172.16.2.127   
-----                             --------------                                          ------------
172.16.255.224  , 172.16.255.225 to 172.16.255.254 , 172.16.255.255   

Class A Subnetting: In subnetting we are borrowing host bit to network bit.
Class A have 8 network bits and 24 host bits so 
Total no of network in class B= 27 =128
Total Host per Network in class B= 224-2 =16777214
If we want to make more network which contain less than 254 host per network so we will do subnetting and we will borrow bits in network from host.
Before starting we should understand subnet bits and there value:

Host Octect
1
1
1
1
1
1
1
1
      1          2           3          4         5          6           7          8
     128       64        32       16        8         4           2          1
    27 +       26 +     25 +     24 +    23 +     22 +     21 +     20  

128 for One bit borrow
27=128
64 for Two bit borrow
26=64
32 for Three bit borrow
25=32
16 for four bit borrow
24=16
8 for five bit borrow
23=8
4 for six bit borrow
22=4
2 for seven bit borrow
21=2
1 for eight bit borrow
20=1

Example:
112.0.0.0/12
Total no of network bit =8+4=12 (class A have 8 network bit and added borrowed 4 bits)
Here we have borrowed 4 bit from host to network so subnet will be
128+64+32+16=240
255.240.0.0
Maximum No of subnet= 24=16 (Borrow bit Three)
Total no of host bit=24 (Host bit) - 4 (Borrowed Bits) = 20 (class A have 24 host bit and 4 bit borrowed so we have minus)
Maximum no of host per subnet= 220-2=1048574
Block Size=256-240=16

Subnetting:
Subnet          ,   Valid Hosts                       ,                  Broadcast      
112.0.0.0       ,   112.0.0.1 to 112.15.255.254       ,   112.15.255.255 
112.16.0.0      ,   112.16.0.1 to 112.31.255.254      ,   112.31.255.255 
112.32.0.0      ,   112.32.0.1 to 112.47.255.254      ,   112.47.255.255 
112.48.0.0      ,   112.48.0.1 to 112.63.255.254      ,   112.63.255.255 
112.64.0.0      ,   112.64.0.1 to 112.79.255.254      ,   112.79.255.255 
112.80.0.0      ,   112.80.0.1 to 112.95.255.254      ,   112.95.255.255 
112.96.0.0      ,   112.96.0.1 to 112.111.255.254     ,   112.111.255.255
112.112.0.0     ,   112.112.0.1 to 112.127.255.254    ,   112.127.255.255
112.128.0.0     ,   112.128.0.1 to 112.143.255.254    ,   112.143.255.255
112.144.0.0     ,   112.144.0.1 to 112.159.255.254    ,   112.159.255.255
112.160.0.0     ,   112.160.0.1 to 112.175.255.254    ,   112.175.255.255
112.176.0.0     ,   112.176.0.1 to 112.191.255.254    ,   112.191.255.255
112.192.0.0     ,   112.192.0.1 to 112.207.255.254    ,   112.207.255.255
112.208.0.0     ,   112.208.0.1 to 112.223.255.254    ,   112.223.255.255
112.224.0.0     ,   112.224.0.1 to 112.239.255.254    ,   112.239.255.255
112.240.0.0     ,   112.240.0.1 to 112.255.255.254    ,   112.255.255.255

Subnetting More than 8 bit:
Example:
112.0.0.0/26
Total no of network bit =8+18=26 (class A have 8 network bit and added borrowed 18 bits)
Here we have borrowed 18 bit from host to network so subnet will be
128 +64+32+16+8+4+2+1= 255         128 +64+32+16+8+4+2+1= 255                         
128 +64 =192
                
255.255.255.192
Maximum No of subnet= 218=262144(Borrow bit Three)
Total no of host bit=24 (Host bit) - 18 (Borrowed Bits) = 6 (class A have 24 host bit and 18 bit borrowed so we have minus)
Maximum no of host per subnet= 26-2=62
Block Size=256-192=64

Subnetting:
Subnet          ,   Valid Hosts                                 ,   Broadcast      
112.0.0.0       ,   112.0.0.1 to 112.0.0.62              ,   112.0.0.63     
112.0.0.64      ,   112.0.0.65 to 112.0.0.126         ,   112.0.0.127    
112.0.0.128     ,   112.0.0.129 to 112.0.0.190     ,   112.0.0.191    
112.0.0.192     ,   112.0.0.193 to 112.0.0.254     ,   112.0.0.255    
112.0.1.0       ,   112.0.1.1 to 112.0.1.62              ,   112.0.1.63     
112.0.1.64      ,   112.0.1.65 to 112.0.1.126         ,   112.0.1.127    
112.0.1.128     ,   112.0.1.129 to 112.0.1.190      ,   112.0.1.191    
112.0.1.192     ,   112.0.1.193 to 112.0.1.254     ,   112.0.1.255    
112.0.2.0       ,   112.0.2.1 to 112.0.2.62               ,   112.0.2.63     
112.0.2.64      ,   112.0.2.65 to 112.0.2.126         ,   112.0.2.127    
112.0.2.128     ,   112.0.2.129 to 112.0.2.190      ,   112.0.2.191    
112.0.2.192     ,   112.0.2.193 to 112.0.2.254      ,   112.0.2.255    
112.0.3.0       ,   112.0.3.1 to 112.0.3.62               ,   112.0.3.63     
112.0.3.64      ,   112.0.3.65 to 112.0.3.126         ,   112.0.3.127    
112.0.3.128     ,   112.0.3.129 to 112.0.3.190      ,   112.0.3.191    
112.0.3.192     ,   112.0.3.193 to 112.0.3.254      ,   112.0.3.255    
112.0.4.0       ,   112.0.4.1 to 112.0.4.62               ,   112.0.4.63     
112.0.4.64      ,   112.0.4.65 to 112.0.4.126         ,   112.0.4.127    
112.0.4.128     ,   112.0.4.129 to 112.0.4.190      ,   112.0.4.191    
112.0.4.192     ,   112.0.4.193 to 112.0.4.254      ,   112.0.4.255  
--------------             -----------------------                               ------------
112.255.255.192 112.255.255.193 to 112.255.255.254 112.255.255.255

Subnet zero: If a network address is subnetted, the first subnet obtained after subnetting the network address is called subnet zero.
Consider a Class B address, 172.16.0.0. By default the Class B address 172.16.0.0 has 16 bits reserved for representing the host portion, thus allowing 65534 (216−2) valid host addresses. If network 172.16.0.0/16 is subnetted by borrowing three bits from the host portion, eight (23) subnets are obtained. The table below is an example showing the subnets obtained by subnetting the address 172.16.0.0, the resulting subnet mask, the corresponding broadcast addresses, and the range of valid host addresses. 

In the example above, the first subnet (subnet 172.16.0.0/19) is called subnet zero.
The class of the network subnetted and the number of subnets obtained after subnetting have no role in
determining subnet zero. It is the first subnet obtained when subnetting the network address. Also, when you
write the binary equivalent of the subnet zero address, all the subnet bits (bits 17, 18, and 19 in this case) are
zeros. Subnet zero is also known as the all−zeros subnet.

The All−Ones Subnet
When a network address is subnetted, the last subnet obtained is called the all−ones subnet.
With reference to the example above, the last subnet obtained when subnetting network 172.16.0.0 (subnet
172.16.224.0/19) is called the all−ones subnet.
The class of the network subnetted and the number of subnets obtained after subnetting have no role in
determining the all−ones subnet. Also, when you write the binary equivalent of the subnet zero address, all the subnet bits (bits 17, 18, and 19 in this case) are ones, hence the name

Problems with Subnet Zero and the All−Ones Subnet
Traditionally, it was strongly recommended that subnet zero and the all−ones subnet not be used for
addressing. According to RFC 950 , "It is useful to preserve and extend the interpretation of these special
(network and broadcast) addresses in subnetted networks. This means the values of all zeros and all ones in
the subnet field should not be assigned to actual (physical) subnets." This is the reason why network engineers required to calculate the number of subnets obtained by borrowing three bits would calculate 23−2 (6) and not 23 (8). The −2 takes into account that subnet zero and the all−ones subnet are not used traditionally.

Subnet−Zero
Using subnet zero for addressing was discouraged because of the confusion inherent in having a network and
a subnet with indistinguishable addresses. With reference to our example above, consider the IP address 172.16.1.10. If you calculate the subnet address corresponding to this IP address, the answer you arrive at is subnet 172.16.0.0 (subnet zero). Note that this subnet address is identical to network address 172.16.0.0, which was subnetted in the first place, so whenever you perform subnetting, you get a network and a subnet (subnet zero) with indistinguishable addresses. This was formerly a source of great confusion.

The All−Ones Subnet
Use of the all−ones subnet for addressing has been discouraged in the past because of the confusion inherent
in having a network and a subnet with identical broadcast addresses.
With reference to the example above, the broadcast address for the last subnet (subnet 172.16.224.0/19) is
172.16.255.255, which is identical to the broadcast address of the network 172.16.0.0, which was subnetted in the first place, so whenever you perform subnetting you get a network and a subnet (all−ones subnet) with identical broadcast addresses. In other words, a network engineer could configure the address 172.16.230.1/19 on a router, but if that is done, he can no longer differentiate between a local subnet broadcast (172.16.255.255 (/19)) and the complete Class B broadcast (172.16.255.255(/16)).

Using Subnet Zero and the All−Ones Subnet
It should be noted that even though it was discouraged, the entire address space including subnet zero and the all−ones subnet have always been usable. The use of the all−ones subnet was explicitly allowed and the use of subnet zero is explicitly allowed since Cisco IOS Software Release 12.0. Even prior to Cisco IOS Software Release 12.0, subnet zero could be used by entering the ip subnet−zero global configuration command. On the issue of using subnet zero and the all−ones subnet, RFC 1878 states, "This practice (of excluding all−zeros and all−ones subnets) is obsolete. Modern software will be able to utilize all definable networks." Today, the use of subnet zero and the all−ones subnet is generally accepted and most vendors support their use. However, on certain networks, particularly the ones using legacy software, the use of subnet zero and the all−ones subnet can lead to problems.

What is Broadcast Address: A broadcast address is a logical address at which all devices connected to a multiple-access communications network are enabled to receive datagrams. A message sent to a broadcast address is typically received by all network-attached hosts, rather than by a specific host.