Está en la página 1de 20

12 - IP Subnetting

By Muhammad Asghar Khan


Reference: CCENT/CCNA ICND1 Official Exam Certification Guide By Wendell Odom

1/1

Agenda 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

2 www.asghars.blogspot.com

1/2

Intro to Binary Numbers


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 to decimal 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

www.asghars.blogspot.com

2/2

Intro to Binary Numbers

The decimal number 21 can be converted to binary as:


LSB 2 (21)10 = 10101 MSB LSB 21 - 1

2
2 2

10 - 0
5 -1 2 -0 1 MSB

www.asghars.blogspot.com

1/2

Subnet Mask

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 subnetwork portion (on the left) and all 0s in the host portion (on the 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
Network Part(16-bits) Host Part(16-bits) Network Part(8bits) Host Part (24-bits)

Class C: 255 . 255 . 255 . 0 11111111 . 11111111 . 11111111 . 00000000


Network Part (24-bits) Host Part(8-bits)

www.asghars.blogspot.com

2/2

Subnet Mask

It can be observed that masks are typically written in dotted decimal 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 is preceded by a /, for example:
Decimal Notation: 255.255.255.0 Binary Notation: 11111111.11111111.11111111.00000000

CIDR Notation:

/24

Network Part (24-bits)

The following IP address is mentioned with its mask in CIDR notation: 192.0.0.0/24
6 www.asghars.blogspot.com

1/8

Subnetting

A classful network (A, B & C) is simply a set of consecutively numbered 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 deliver packets In flat topology as the network grows, the use of the network bandwidth becomes less efficient, routers can be used in this case to separate networks by breaking the network into multiple subnets
7 www.asghars.blogspot.com

2/8

Subnetting

As we learn that each IP address in class (A, B & C) has a default subnet mask associated with it

These masks define the pre-defined number of network and host parts
In subnetting the default subnet mask is customized according 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:

8

Subnetting Based on Networks Subnetting Based on Hosts


www.asghars.blogspot.com

3/8

Subnetting

Subnetting Based on Networks

The following steps can be used to find the subnets based on number of networks
1. 2.

3.

Determine number of networks & convert to binary Reserve bits in subnet i.e customize the default subnet & find the increment Use the increment to find network ranges

1.

Example; Divide the 216.21.5.0 (Class C) network into 5 subnets


Determine number of networks & convert to binary 128 64 32 16 8 4 2 1 1 0 1 => 3-bits
www.asghars.blogspot.com

4/8

Subnetting
2.

Reserve bits in subnet & find the increment Default Mask: 255.2555.255.0 11111111.11111111.11111111.00000000 Customized Mask: 1111111.11111111.11111111.11100000
3-bits reserved for subnets

3.

255.255.255.224 Increment will be the lowest network bit value converted to decimal 1111111.11111111.11111111.11100000 => 32 Use increment to find network ranges 216.21.5.0 --- 216.21.5.31
www.asghars.blogspot.com

10

5/8

Subnetting
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
www.asghars.blogspot.com

11

6/8

Subnetting

Subnetting Based on Hosts

The same previous steps can be used to find the subnets based on number of networks
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 into subnets with 100 hosts each
1.

1.

Determine number of hosts & convert to binary 128 64 32 16 8 4 2 1 1 => 7-bits (Bcz if we take 128 then 128 > 100)
www.asghars.blogspot.com

12

7/8

Subnetting
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
13 www.asghars.blogspot.com
7-bits reserved for hosts

8/8

Subnetting
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

14

www.asghars.blogspot.com

1/3

IP Address Reverse Engineering

The purpose of reverse engineering is to check the validity 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 bits


Default Mask: 255.255.255.0 => /24 => 28 24 = 4 bits

15

www.asghars.blogspot.com

2/3

IP Address Reverse Engineering


2.

Determine the increment 11111111.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.31 192.168.11.32 --- 192.168.11.47 192.168.11.48 --- 192.168.11.63 -----------------------16 www.asghars.blogspot.com

3/3

IP Address Reverse Engineering

The given IP address falls in the range 192.168.11.32 to 192.168.11.47, as it is the network or subnet ID, therefore, it is not a valid IP address

17

www.asghars.blogspot.com

1/2

Rule of Exception

The subnetting process works by finding the number of bits that are required to meet a given requirement 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
www.asghars.blogspot.com

18

2/2

Rule of Exception

Thus to be on the safer side, to save bits always subtract 1 from number of subnets and always add 1 to the number of hosts

19

www.asghars.blogspot.com

Resident Subnet of an IP / How Router Find the 1/1 Subnet No

The router use the boolean AND operation to find the subnet ID or resident subnet of the given IP Convert IP & Mask to address binary

Convert the resulting binary number, 8 bits at a time , back to decimal. This value is the subnet number

Perform the Boolean AND on IP and Mask 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. 20 www.asghars.blogspot.com

También podría gustarte