Upload
muhammad-asghar-khan
View
237
Download
1
Embed Size (px)
Citation preview
7/30/2019 12 - IP Subnetting
1/20
12 - IP Subnetting
By Muhammad Asghar Khan
Reference: CCENT/CCNA ICND1 Official Exam Certification Guide By Wendell Odom
7/30/2019 12 - IP Subnetting
2/20
Agenda
www.asghars.blogspot.com2
Intro to Binary Numbers Subnet Mask
Subnetting
Subnetting Based on Networks Subnetting Based on Hosts
IP Address Reverse Engineering
Rule of Exception Resident Subnet of an IP / How Router Find
the Subnet No
1/1
7/30/2019 12 - IP Subnetting
3/20
Intro to Binary Numbers
www.asghars.blogspot.com3
They only contain 0s and 1s The binary system is also called a 2-based
numbering system, or simply base 2
The binary number 10101 can be converted todecimal number as:
1*24 + 0*23 + 1*22 + 0*2 1+ 1*20 = 21
Or
1*16 + 0*8 + 1*4 + 0*2 + 1*1 = 21
1/2
7/30/2019 12 - IP Subnetting
4/20
Intro to Binary Numbers
www.asghars.blogspot.com4
The decimal number 21 can be converted to binaryas:
LSB
MSB
(21)10 = 10101
2 21 - 1
10 - 0
5 - 1
2 - 0
1
2
2
2LSB
MSB
2/2
7/30/2019 12 - IP Subnetting
5/20
Subnet Mask
www.asghars.blogspot.com5
Subnet mask is a 32-bit value that allows the IP host to learn the
size of network and host part of an IP address
In binary form subnet mask have all 1s in the network and sub-network portion (on the left) and all 0s in the host portion (onthe right)
Every class has its default subnet mask as:
Class A: 255 . 0 . 0. 0
11111111 . 00000000 .00000000 .00000000
Class B: 255 . 255 . 0 . 0
11111111 . 11111111 . 00000000 . 00000000
Class C: 255 . 255 . 255 . 0
11111111 . 11111111 . 11111111 . 00000000
1/2
Network Part(8-
bits)
Host Part (24-bits)
Network Part(16-bits) Host Part(16-bits)
Network Part (24-bits) Host Part(8-bits)
7/30/2019 12 - IP Subnetting
6/20
Subnet Mask
www.asghars.blogspot.com6
It can be observed that masks are typically written in dotteddecimal number
We can also write or represent the masks in prefix or CIDR
(Classless Inter Domain Routing) notation
In CIDR or prefix notation the binary 1s in subnet mask ispreceded by a /, for example:
Decimal Notation: 255.255.255.0
Binary Notation: 11111111.11111111.11111111.00000000CIDR Notation: /24
The following IP address is mentioned with its mask in CIDR
notation: 192.0.0.0/24
Network Part (24-bits)
2/2
7/30/2019 12 - IP Subnetting
7/20
Subnetting
www.asghars.blogspot.com7
A classful network (A, B & C) is simply a set of consecutivelynumbered IP addresses
Subnetting subdivides these classful network into smaller,logical groups of addresses called subnets
Subnet is shorthand for sub divided network
With no subnets, the network has a flat topolgy
A flat topology relies on L2 MAC addresses to deliverpackets
In flat topology as the network grows, the use of thenetwork bandwidth becomes less efficient, routers can beused in this case to separate networks by breaking thenetwork into multiple subnets
1/8
7/30/2019 12 - IP Subnetting
8/20
Subnetting
www.asghars.blogspot.com8
As we learn that each IP address in class (A, B & C) has adefault subnet mask associated with it
These masks define the pre-defined number of network and
host parts
In subnetting the default subnet mask is customizedaccording to our needs i.e. the host part will be shrink to
make room for the subnet field(s), but the network part will
remain the same
Subnetting can be based on the following scenarios:
Subnetting Based on Networks
Subnetting Based on Hosts
2/8
7/30/2019 12 - IP Subnetting
9/20
Subnetting
www.asghars.blogspot.com9
Subnetting Based on Networks
The following steps can be used to find the subnets basedon number of networks
1. Determine number of networks & convert to binary
2. Reserve bits in subnet i.e customize the default subnet &find the increment
3. Use the increment to find network ranges
Example; Divide the 216.21.5.0 (Class C) network into 5subnets
1. Determine number of networks & convert to binary128 64 32 16 8 4 2 1
1 0 1
=> 3-bits
3/8
7/30/2019 12 - IP Subnetting
10/20
Subnetting
www.asghars.blogspot.com10
2. Reserve bits in subnet & find the increment
Default Mask: 255.2555.255.0
11111111.11111111.11111111.00000000
Customized Mask: 1111111.11111111.11111111.11100000
255.255.255.224
Increment will be the lowest network bit value converted to
decimal
1111111.11111111.11111111.11100000=> 32
3. Use increment to find network ranges
216.21.5.0 --- 216.21.5.31
3-bits reserved for
subnets
4/8
7/30/2019 12 - IP Subnetting
11/20
Subnetting
www.asghars.blogspot.com11
216.21.5.32 --- 216.21.5.63
216.21.5.64 --- 216.21.5.95
216.21.5.96 --- 216.21.5.127
216.21.5.128 --- 216.21.5.160
Note; Every subnet has two reserved IP addresses
called Network ID (Zero Subnet) i.e the first address of
subnet and the last one which is called the broadcast
address (Broadcast Subnet)
To find the total possible of subnets with 3-bits of
subnet field we can use the following formula:
Total subnets = 2s (where s is the subnet bits)
= 23 = 6
5/8
7/30/2019 12 - IP Subnetting
12/20
Subnetting
www.asghars.blogspot.com12
Subnetting Based on Hosts
The same previous steps can be used to find the subnetsbased on number of networks
1. Determine number of hosts & convert to binary
2. Reserve bits in subnet i.e customize the default subnet &find the increment
3. Use the increment to find network ranges
Example; Divide the network 10.0.0.0 (Class A) network intosubnets with 100 hosts each
1. Determine number of hosts & convert to binary128 64 32 16 8 4 2 1
1
=> 7-bits (Bcz if we take 128 then 128 > 100)
6/8
7/30/2019 12 - IP Subnetting
13/20
Subnetting
www.asghars.blogspot.com13
2. Reserve bits in subnet & find the increment
Default Mask: 255.0.0.0 => /8
11111111.00000000.00000000.00000000
Note: Here we are concerned with no. of hosts, so we will reserve
the host bits
Customized Mask:1111111.11111111.11111111.10000000
255.255.255.128 => /25
Again, increment will be the lowest network bit value
converted to decimals
1111111.11111111.11111111.10000000
=> 128
7-bits reserved for
hosts
7/8
7/30/2019 12 - IP Subnetting
14/20
Subnetting
www.asghars.blogspot.com14
3. Use increment to find network ranges
10.0.0.0 --- 10.0.0.127
10.0.0.128 --- 10.0.0.255
10.0.1.0 --- 10.0.1.127
- - - - - - - - - - - - - - - - - Total subnets = 2s = 217 = 131072
To find the total possible of hosts/subnet with 7-bits of
host field we can use the following formula:
Total No. of hosts/subnet = 2h
- 2 (where h is the hosts bits)= 27 2 = 128
8/8
7/30/2019 12 - IP Subnetting
15/20
IP Address Reverse Engineering
www.asghars.blogspot.com15
The purpose of reverse engineering is to check thevalidity of the IP address, i.e.
Is the address on the same network as that of other
hosts plug onto the same switch, or
What network range it belongs
Example; check the IP address 192.168.11.32/28 is
valid or not
1. Determine number of subnets bitsDefault Mask: 255.255.255.0 => /24
=> 28 24 = 4 bits
1/3
7/30/2019 12 - IP Subnetting
16/20
IP Address Reverse Engineering
www.asghars.blogspot.com16
2. Determine the increment11111111.11111111.11111111.11110000
128 64 32 16 8 4 2 1
=> Lowest Bit = 16
3. Find network ranges
192.168.11.0 --- 192.168.11.15
192.168.11.16 --- 192.168.11.31192.168.11.32 --- 192.168.11.47
192.168.11.48 --- 192.168.11.63
- - - - - - - - - - - - - - - - - - - - - - - -
2/3
7/30/2019 12 - IP Subnetting
17/20
IP Address Reverse Engineering
www.asghars.blogspot.com17
The given IP address falls in the range 192.168.11.32to 192.168.11.47, as it is the network or subnet ID,
therefore, it is not a valid IP address
3/3
7/30/2019 12 - IP Subnetting
18/20
Rule of Exception
www.asghars.blogspot.com18
The subnetting process works by finding thenumber of bits that are required to meet a givenrequirement
For example; to find a range of 25 networks, you
need a 5 subnet bits to satisfy the requirement,however, because binary numbers start from 0,there are exceptions to this rule i.e:
For network ranges 2, 4, 8, 16, 32, 64 and 128 always
subtract 1 when finding the networks For number of hosts 3, 7, 15, 31, 63, 127 always add 1
when finding the number of hosts
1/2
7/30/2019 12 - IP Subnetting
19/20
Rule of Exception
www.asghars.blogspot.com19
Thus to be on the safer side, to save bits alwayssubtract 1 from number of subnets and always add
1 to the number of hosts
2/2
7/30/2019 12 - IP Subnetting
20/20
Resident Subnet of an IP / How Router Find the
Subnet No
www.asghars.blogspot.com20
The router use the boolean AND operation to findthe subnet ID or resident subnet of the given IP
address Convert IP & Mask tobinary
1
Perform the Boolean AND on IP and
Mask2
Convert the resulting binary number, 8 bits at a
time , back to decimal. This value is the subnet
number 3
Note:
1111111 (255) when ANDed with IP octet result in the same octet value (as with the
case
in first two octets in our example).
Similarly, any IP address octet, ANDed with 00000000 (0) yields an octet of eight
binary 0s .
So you can guess its value without converting to binary.
1/1