Monday, 26 September 2016

Method of Subnetting

There are several method of subnetting. Different author different approach to calculate the subnets. You should choose the method you can understand and perform subnetting easily. Whatever approach you choose need conversion of decimal to binary. Cram up this chart
27
26
25
24
23
22
21
20
128
64
32
16
8
4
2
1
To convert a decimal number into binary, you must turn on the bits (make them a 1) that would add up to that number, as follows:
187 = 10111011 = 128+32+16+8+2+1
224 = 11100000 = 128+64+32
To convert a binary number into decimal, you must add the bits that have been turned on (the 1s), as follows:
10101010 = 128+32+8+2 = 170
11110000 = 128+64+32+16 = 240
The IP address 138.101.114.250 is represented in binary as
 10001010.01100101.01110010.11111010 
The subnet mask of 255.255.255.224 is represented in binary as
 11111111.11111111.11111111.11100000 

Practical approach of subnetting

When faced with a subnetting question, the first thing to do is decide what class the address belongs to. for examples:
192.168.1.1
The first octet is between 192 and 223 so it is a Class C address
Default mask for Class C: is 255.255.255.0
In exam default subnet mask is not subnetted. Now write down the given ip address as shown here. Write down the default side of IP as it is and reset of part where actual subnetting will perform in binary
192.168. 1 .00000001
255.255.255.00000000
(defaul maks)
Step 1:- calculate the CIDR value
CIDR are the on bit in subnet mask. As you can see in our example we have on bit only in default side.
255.255.255.00000000
So our CIDR value is 24 + 0 = 24
Step 2:- calculate the Subnet mask
To calculate the subnet mask use the binary to decimal chart given above. Add the decimal place value of on network bit.
              <==H bit
 255.255.255.00000000
 N bit==>
In our example we are using on default mask so our subnet mask will be 255.255.255.0
Step 3:- calculate the Total Host
To calculate the total host count the H bit and use this formula
Total host = 2H
             <==H bit
 255.255.255.00000000
 Total host = 28 = 256
Step 4:- calculate the Valid Host
Subtract 2 from Total host Every network or subnet has two reserved addresses that cannot be assigned to a host. These addresses are called the Network ID and the Broadcast ID, respectively. They are the first and last IPs in any network or subnet. We lose those two IP addresses from the group of values that could be assigned to hosts.
Total host - 2
256 -2 = 254
Step 5:- calculate the Network
To calculate the Network count the N bit and use this formula
Network = 2N
255.255.255.00000000
            N bit==>
Network = 20 = 1 
Step 6:- Find out the block Size 
Finding block size is very easy just subtract the subnet mask from 256
256 – Subnet mask
(only the last octal, don't include the default subnet mask)
256 - 0 = 256
Step 7:- Write down the subnet chart
Network 1
CIDR Value /24
IP
Sunetmask
Net ID
192.168.1.0
255.255.255.0
First Valid Host
192.168.1.1
255.255.255.0
Last Valid Host
192.168.1.254
255.255.255.0
Broadcast ID
192.168.1.255
255.255.255.0

 

Subnetting of CIDR /25

Now do the subnetting of CIDR /25 using same method
Step 1:- calculate the CIDR value CIDR = sum of all on bit in subnet mask
255.255.255.10000000
So our CIDR value is 24 + 1 = 25
Step 2:- calculate the Subnet mask
Add the decimal place value of on network bit.
              <==H bit
 255.255.255.10000000
    N bit==>
In our example we have one on bit and as you can see in decimal chart the place value of 1000000 is 128 so our subnet mask will be 255.255.255.128
Step 3:- calculate the Total Host
Total host = 2H <==H bit 255.255.255.10000000 Total host = 27 = 128
Step 4:- calculate the Valid Host
Subtract 2 from Total host
Total host - 2
128 -2 = 126
Step 5:- calculate the Network
To calculate the Network count the N bit and use this formula
Network = 21 255.255.255.10000000 N bit==> Network = 21 = 2
Step 6:- Find out the block Size
256 – Subnet mask (only the last octal, don't include the default subnet mask) 256 - 128 = 128
With help of block size you can easy find out the network ID and broadcast ID of all possible networks as we have 8 bits in one octal those can give maximum of 28 = 256 decimal number
We start from 0 so it will end up on 255 (Do not get confuse because we are counting from 0 not from 1 so the last digit will be 255 not 256. It will 256 only when you count from 1 ). All subnetting will perform between these two numbers.
Create a table of x Columns where x is the number of your network
First ip of first network will always be 0 and last ip of last network will be 255 fill its in chart
Now you have network ID of first network and broadcast ID of last network.
Now add block size in the first ip of first network to get the network ID of second network and so on till we get the network id of last network
 First network ID 0 Second Network ID 0 +128 = 128
Fill this in Chart.
As you can see from 128 next network is started so the last IP of first network will be 127 fill it in chart. With this method you can fill the last ip of all networks.
Now you have first ip ( network ID ) of all networks and the last ip (Broadcast ID) of all networks. At this point you can easily fill the valid ip in each network. As valid hosts are all ip address those fall between network ip and host ip.
Step 7:- Write down the subnet chart
CIDR /25
Network 1
Network 2
Net ID
192.168.1.0
192.168.1.128
First Valid Host
192.168.1.1
192.168.1.129
Last Valid Host
192.168.1.126
192.168.1.254
Broadcast ID
192.168.1.127
192.168.1.255

Binary ANDing:-
Binary ANDing is the process of performing multiplication to two binary numbers. In the decimal numbering system, ANDing is addition: 2 and 3 equals 5. In decimal, there are an countless number of answers when ANDing two numbers together. However, in the binary numbering system, the AND function give up only two possible outcomes, based on four different combinations. These answers, can be displayed as a truth table:
 0 and 0 = 0 1 and 0 = 0 0 and 1 = 0 1 and 1 = 1
You use ANDing most often when comparing an IP address to its subnet mask. The end result of ANDing these two numbers together is to give up the network number of that address.

Example Question

What is the network number of the IP address 192.168.100.115 if it has a subnet mask of 255.255.255.240?
Answer
Step 1 Convert both the IP address and the subnet mask to binary:
192.168.100.115 = 11000000.10101000.01100100.01110011
255.255.255.240 = 11111111.11111111.11111111.11110000
Step 2 Perform the AND operation to each pair of bits—1 bit from the address ANDed to the corresponding bit in the subnet mask. Refer to the truth table for the possible outcomes:
192.168.100.115 = 11000000.10101000.01100100.01110011
255.255.255.240 = 11111111.11111111.11111111.11110000
  ANDed result = 11000000.10101000.01100100.01110000
Step 3 Convert the answer back into decimal:
11000000.10101000.01100100.01110000 = 192.168.100.112
The IP address 192.168.100.115 belongs to the 192.168.100.112 network when a mask of 255.255.255.240 is used.

My easy method

Conversion of decimal to binary and vice versa to get network ID is too time consuming process in exam. So I found this easy method.
Step 1:- Decide from which class this IP belongs and what's its default subnet mask
As given IP have 192 in its first octal so it's a class C IP. And default subnet mask of class C is 255.255.255.0
Step2:- Find out the block size. ( As we describe above)
 256 -240 = 16
Step3:- Write down all possible network using block size till we do not get our host partition in middle of two network
 0,16,32,48,64,80,96,112,128,
As our host number is 115 which fall in the network of 112 so our network ID is
 192.168.1.112

And our host's broad cast ID is 192.168.1.127 as from 128 onward next network will start. Easy as I promise

No comments: