Subnetting

doctorheavenlyΔίκτυα και Επικοινωνίες

24 Οκτ 2013 (πριν από 3 χρόνια και 7 μήνες)

186 εμφανίσεις

Subnetting
Presented By :
Presented By :
HosseinPour Taheri
What is subnetting?

Network
Network
Host
Host
172
16
0
0
Network
Network
Subnet
Host
Rick Graziani graziani@cabrillo.edu
2

Subnetting is the process of borrowing bits from the HOST bits, in order
to divide the larger network into small subnets.

Subnetting does NOT
give you more hosts, but actually costs you hosts.

You lose two host IP Addresses for each subnet, and perhapsone for
the subnet IP address and one for the subnet broadcast IP address.

You lose the last subnet and all of its hosts IP addresses as the
broadcast for that subnet is the same as the broadcast for the network.

In older networks, you would have lost the first subnet, as the subnet IP
address is the same as the network IP address. (This subnet can be
used in most networks.)
Analogy
Dividing the barrel of apples into small
barrels or baskets does not give us
any more apples
100 Apples
Rick Graziani graziani@cabrillo.edu
3
Analogy
101010
10
10
10
10 barrels x 10 apples = 100 apples
100 Apples
(10 * 10)
Rick Graziani graziani@cabrillo.edu
4

It is the same as taking a barrel of 100
apples and dividing it into 10 barrels of
10 apples each.
10
1010
10
Analogy
Before subnetting:

In any network (or subnet) we can
not use all the IP addresses for host
addresses.

We lose two addresses for every
network or subnet.
100 –2 apples = 98 Usable Apples
98 Apples
(100 –2)
Rick Graziani graziani@cabrillo.edu
5
network or subnet.
1.
Network Address -One address is
reserved to that of the network.
2.
Broadcast Address One address
is reserved to address all hosts in
that network or subnet.
(less 2)
(less 2)
(less 2)
(less 2)
(less 2)
(less 2)
888
888
10 barrels x 8 apples = 80 apples
80 Apples
10 * (10 -2)
Rick Graziani graziani@cabrillo.edu
6

In subnetting we will see that we continue to
lose two apples per subnet, one for the
address and one for the broadcast.
(less 2)
(less 2)
(less 2)
888
8
(less 2)
(less 2)
(less 2)
(less 2)
(less 2)
(less 2)
888
888
10 barrels x 8 apples = 80 apples
64 Apples
8 * (10 -2)
X
---
Rick Graziani graziani@cabrillo.edu
7

We might also lose the last basket of apples,
subnet, as it contains the broadcast address
for the entire network.

In older networks, we might also lost the first
basket, subnet, as it contained the address of
the entire network, but this is usually no longer
the case.
X
(less 2)
(less 2)
(less 2)
888
8---
Subnet Example
Network address
172.16
.0.0 with /16 network mask
Network
Network
Host
Host
172
16
0
0
Rick Graziani graziani@cabrillo.edu
8
Subnet Example
Network
Network
Subnet
Host
Network address
172.16
.0.0 with /16 network mask
Using Subnets: subnet mask 255.255.255.0or /24
Network
Network
Host
Host
172
16
0
0
Rick Graziani graziani@cabrillo.edu
9
Network
Network
Subnet
Host

Applying a mask which is larger than the default subnet
mask, will divide your network into subnets.

Subnet mask used here is 255.255.255
.0 or /24
Network Mask:
255.255.0.0 or /16
Subnet Mask:
255.255.255.0 or /24
11111111
11111111
00000000
00000000
11111111
11111111
11111111
00000000
Important things to remember about Subnetting

You can only subnet the host portion, you do not have control of the
network portion.

Subnetting does not
give you more hosts, it only allows you to divide
your larger network into smaller networks.

When subnetting, you will actually lose hosts:

For each subnet you lose the addressof that subnet

For each subnet you lose the
broadcast
address of that subnet
Rick Graziani graziani@cabrillo.edu
10

For each subnet you lose the
broadcast
address of that subnet

You may lose the first and lastlast subnets(coming)

Analogy: Large barrel of 100 apples.

Why subnet?

Divide larger network into smaller network.

Limit layer 2 and layer 3 broadcasts to their subnet.

Better management of traffic.

Host IP Address: 172.16.18.33

Network Mask: 255.255.0.0

Subnet Mask: 255.255.255.0
Given the following Host IP Address, Network Mask and Subnet mask find the
following information:

Major Network Information

Major Network Address
Subnetting Example #1 (on the board)
Rick Graziani graziani@cabrillo.edu
11

Major Network Address

Major Network Broadcast Address

Range of Hosts if not subnetted

Subnet Information

Subnet Address

Range of Host Addresses (first host and last host)

Broadcast Address

Other Subnet Information

Total number of subnets

Number of hosts per subnet

Host IP Address: 138.101.114.250

Network Mask: 255.255.0.0

Subnet Mask: 255.255.255.192
Given the following Host IP Address, Network Mask and Subnet mask find the
following information:

Major Network Information

Major Network Address
Subnetting Example #2
Rick Graziani graziani@cabrillo.edu
12

Major Network Address

Major Network Broadcast Address

Range of Hosts if not subnetted

Subnet Information

Subnet Address

Range of Host Addresses (first host and last host)

Broadcast Address

Other Subnet Information

Total number of subnets

Number of hosts per subnet
Major Network Information

Host IP Address: 138.101.114.250

Network Mask: 255.255.0.0

Subnet Mask: 255.255.255.192

Major Network Address: 138.101.0.0

Major Network Broadcast Address
: 138.101.255.255
Rick Graziani graziani@cabrillo.edu
13

Major Network Broadcast Address
: 138.101.255.255

Range of Hosts if not Subnetted: 138.101.0.1 to 138.101.255.254

138. 101. 114. 250
IP Address
10001010 01100101 01110010 11111010
Mask
11111111 11111111 11111111 11000000

255. 255. 255. 192

Step 1: Convert to Binary
128 64 32 16 8 4 2 1
Rick Graziani graziani@cabrillo.edu
14
Step 1:
Translate Host IP Address and Subnet Mask into binary notation
Step 2:

138. 101. 114. 250
IP Address
10001010 01100101 01110010 11111010
Mask
11111111
11111111
11111111
11000000

Network
10001010 01100101 01110010 11000000

138 101 114 192

Step 2: Find the Subnet Address
Rick Graziani graziani@cabrillo.edu
15
Determine the Network (or Subnet) where this Host address lives:
1. Draw a line under the mask
2. Perform a bit-wise AND operation on the IP Address and the Subnet
Mask
Note: 1 AND 1 results in a 1, 0 AND anything results in a 0
3. Express the result in Dotted Decimal Notation
4. The result is the
Subnet Address
of this Subnet or Wire which is
138.101.114.192
Step 2:

138. 101. 114. 250
IP Address
10001010 01100101 01110010 11111010
Mask
11111111
11111111
11111111
11000000

Network
10001010 01100101 01110010 11000000

138 101 114 192

Step 2: Find the Subnet Address
Rick Graziani graziani@cabrillo.edu
16
Determine the Network (or Subnet) where this Host address lives:
Quick method:
1.
Find the last (right-most) 1 bit in the subnet mask.
2.
Copy all of the bits in the IP address to the Network Address
3.
Add 0s for the rest of the bits in the Network Address

G.D. S.D.



IP Address
10001010 01100101 01110010 11 111010
Mask
11111111
11111111
11111111
11 000000

Network
10001010 01100101 01110010 11 000000



¬
¬¬
¬
subnet
®
®®
®

¬
¬¬
¬
host
®
®®
®

counting range counting

range

Step 3: Subnet Range / Host Range
Rick Graziani graziani@cabrillo.edu
17
Step 3:
Determine which bits in the address contain Network (subnet)
information and which contain Host information:

Use the Network Mask: 255.255.0.0 and divide (Great Divide) the
from the rest of the address.

Use Subnet Mask: 255.255.255.192 and divide (Small Divide) the
subnet from the hosts between the last 1 and the first 0 in the
subnet mask.

range




G.D. S.D.



IP Address
10001010 01100101 01110010 11 111010
Mask
11111111
11111111
11111111
11 000000

Network
10001010 01100101 01110010 11 000000



¬
¬¬¬
subnet
®
®®®

¬
¬¬¬
host
®
®®®
counting range countin
g
range
First Host
10001010 01100101 01110010 11 000001

138 101 114 193





Step 4: First Host / Last Host
Rick Graziani graziani@cabrillo.edu
18
Host Portion

Subnet Address
:
all 0s

First Host
: all 0s and a 1

Last Host
: all 1s and a 0

Broadcast
: all 1s





Last Host
10001010 01100101 01110010 11 111110

138 101 114 254


Broadcast
10001010 01100101 01110010 11 111111
138 101 114 255


G.D. S.D.



IP Address
10001010 01100101 01110010 11 111010
Mask
11111111
11111111
11111111
11 000000

Network
10001010 01100101 01110010 11 000000



¬
¬¬¬
subnet
®
®®®

¬
¬¬¬
host
®
®®®
counting range countin
g
range


Total number of subnets
Step 5: Total Number of Subnets
Rick Graziani graziani@cabrillo.edu
19

First Host
10001010 01100101 01110010 11 000001

138 101 114 193


Last Host
10001010 01100101 01110010 11 111110

138 101 114 254


Broadcast
10001010 01100101 01110010 11 111111
138 101 114 255


Total number of subnets

Number of subnet bits 10

210
= 1,024

1,024 total subnets

Subtract one ifall-zeros subnet cannot be used

Subtract one ifall-ones subnet cannot be used

G.D. S.D.



IP Address
10001010 01100101 01110010 11 111010
Mask
11111111
11111111
11111111
11 000000

Network
10001010 01100101 01110010 11 000000



¬
¬¬¬
subnet
®
®®®

¬
¬¬¬
host
®
®®®
counting range countin
g
range


Total number of hosts per subnet
Step 6: Total Number of Hosts per Subnet
Rick Graziani graziani@cabrillo.edu
20

First Host
10001010 01100101 01110010 11 000001

138 101 114 193


Last Host
10001010 01100101 01110010 11 111110

138 101 114 254


Broadcast
10001010 01100101 01110010 11 111111
138 101 114 255


Total number of hosts per subnet

Number of host bits 6

26
= 64

64 host per subnets

Subtract one for the subnet address

Subtract one for the broadcast address

62 hosts per subnet
Your Turn!
Problem 1

Host IP Address: 10.10.10.193

Network Mask: 255.255.0.0

Subnet Mask: 255.255.255.0
Problem 2

Rick Graziani graziani@cabrillo.edu
21

Host IP Address: 10.10.10.193

Network Mask: 255.255.255.0

Subnet Mask: 255.255.255.240
Problem 3

Host IP Address: 10.10.10.193

Network Mask: 255.255.255.0

Subnet Mask: 255.255.255.252
A Trial Separation

Subnet masks apply only to Class A, B or C IP addresses.

The subnet mask is like a filter that is applied to a
messages destination IP address.

Its objective is to determine if the local network is the
Peter Smith
22

Its objective is to determine if the local network is the
destination network.
A Trial Separation (Cont.)

The subnet mask goes like this:
1.
If a destination IP address is
206.175.162.21
, we know
that it is a Class C address & that its binary equivalent is:
11001110.
10101111
.
10100010
.
00010101
Peter Smith
23
11001110.
10101111
.
10100010
.
00010101
A Trial Separation (Cont.)
2.
We also know that the default standard Class C subnet
mask is:
255.255.255.0
and that its binary equivalent is:
11111111.
11111111
.
11111111
.
00000000
Peter Smith
24
A Trial Separation (Cont.)
3.
When these two binary numbers (the
IP address & the subnet mask) are
combined using Boolean Algebra, the
Peter Smith
25
combined using Boolean Algebra, the
Network ID of the destination network
is the result:
A Trial Separation (Cont.)
4.
The result is the IP address of the network which in this
case is the same as the local network & means that the
message is for a node on the local network.
Peter Smith
26
Types of subnetting

There are two types of subnetting:

Classful

Classless (VLSM)

Classful subnetting is used in older network protocols and
has various issues that reduce its effectiveness

Classful subnetting would not allow you to use Subnet Zero

Classful subnetting would not allow you to use Subnet Zero

Classless subnetting (VLSM) is a more efficient system to
preserve IP addresses and is used in modern routing
protocols

Classless subnetting allows you to use Subnet Zero
***
27
Some rules

You cannot use the Network address or the
Broadcast addressas a hostaddress in either
Classful or Classless subnetting!

Once a subnet address is allocated to a subnet
with its subnet mask it cannot be used for
with its subnet mask it cannot be used for
subnetting again
***
28
Variable Length Subnet Masks

More than one subnet mask
172.80.40.0
172.80.40.1 47.254
172.80.32.0
172.80.32.1

39.254
172.80.24.0
172.80.24.1

31.254
172.80.8.0
172.80.8.1 
15.254
172.80.32.1

39.254
172.80.24.1

31.254
172.80.16.0
172.80.16.1 23.254
29
We need
1.
An IP address to perform VLSM on
2.
The number of segments we want to divide the major
network into
3.
The number of hosts involved in each part of each
segment
***
30
Example using a Class C network address
60 hosts
No subnet mask
192.168.1.0
120 hosts
No subnet mask
No subnet mask
30 hosts
No subnet mask
31
Process
1.
Find the segment with the largest number of hosts
connected to it
2.
Find an appropriate subnet mask for the largest
segment
3.
Write down the subnet addresses to fit the subnet mask
4.
Take one of the newly created subnet addresses and
4.
Take one of the newly created subnet addresses and
apply a new subnet mask to it that is more appropriate
5.
Write down the subnet addresses to fit the new subnet
mask
6.
Repeat from step 4 for smaller segments
32
Step 1
1.
Find the segment with the largest number of hosts
connected to it

In the example the largest segment has 120 hosts
connected so we must start with this segment

How many bits would we need to make 120?

To accomodate120 hosts we need to use 7 bits from

To accomodate120 hosts we need to use 7 bits from
the host portion of the address (2
7
-2 = 126)
33
120 hosts
60 hosts
30 hosts
Step 2
2.
Find an appropriate subnet mask for the largest
segment

If we have borrowed 7 bits for our hosts the subnet
mask (in binary) will be
11111111.1111111.1111111.1000000

What is 11111111.11111111.11111111.10000000

What is 11111111.11111111.11111111.10000000
expressed in base
10
?

Converted to decimal (base
10
) we get 255.255.255.128
34
Step 3
3.
Write down the subnet addresses to fit the subnet mask
￿
Now we need to find the subnet addresses that this
subnet mask will create
￿
Use the formula (256 -the subnet mask)
￿
256 128 = 128
￿
Therefore the subnets would be
￿
Therefore the subnets would be
￿
192.168.1.0 and
￿
192.168.1.128
￿
We can now assign 192.168.1.0/25 to accommodate the
120 segment
￿
192.168.1.128 can be used for further subnettingfor the
other two segments
35
So far...
120 hosts (126 in total)
60 hosts (62 in total)
No subnet mask
120 hosts (126 in total)
192.168.1.0/25
30 hosts (30 in total)
No subnet mask
36
Step 4
4.
Take one of the newly created subnet addresses and
apply a new subnet mask to it that is more appropriate
￿
We still have two segments to deal with and we have a
new subnet address to work with of 192.168.1.128
￿
We must start with the larger segment, which has 60
hosts
￿
￿
To accommodate 60 hosts we need to borrow 6 bits from
the host portion of the given IP address
￿
26
2 = 62 hosts
￿
This will give us a subnet mask of
1111111.1111111.1111111.11000000
￿
Converted to decimal this will be?
￿
255.255.255.192
37
Done
60 hosts
(62 in total)
30 hosts
(30 in total)
Step 5
5.
Write down the subnet addresses to fit the new subnet
mask

Now we need to find the subnet addresses that this
subnet mask will create

256 192 = 64

Therefore the new subnet addresses would be

Therefore the new subnet addresses would be

192.168.1.128 and

192.168.1.192

We can now use 192.168.1.128/26 for the segment
with 60 hosts

We have 192.168.1.192 left over to further subnet
38
So far...
120 hosts (126 in total)
60 hosts (62 in total)
192.168.1.128/26
120 hosts (126 in total)
192.168.1.0/25
30 hosts (30 in total)
No subnet mask
39
Step 4 is repeated
4.
Take one of the newly created subnet addresses and
apply a new subnet mask to it that is more appropriate
￿
We still have the segment with 30 hosts to deal with
￿
We work this out in the same way as before
￿
To accommodate 30 hosts we need to borrow 5 bits
from the host portion of the IP address
from the host portion of the IP address
￿
25
2 = 30 hosts
￿
This will give us a subnet mask of
1111111.1111111.1111111.11100000 which is
255.255.255.224
40
Step 5 is repeated
5.
Write down the subnet addresses to fit the new subnet
mask
￿
Now we need to find the subnet addresses that this
subnet mask will create
￿
256 224 = 32
￿
Therefore the new subnet addresses would be
￿
Therefore the new subnet addresses would be
192.168.1.192 and 192.168.1.224
￿
We can now use 192.168.1.192/27 for the segment
with 30 hosts
￿
We still have the new 192.168.1.224 subnet which
could be used for future growth
41
Result!
120 hosts (126 in total)
60 hosts (62 in total)
192.168.1.128/26
192.168.1.0
120 hosts (126 in total)
192.168.1.0/25
30 hosts (30 in total)
192.168.1.192/27
42
Exercise 1

192.168.2.0/24

7 remote sites, 30 hosts
each

P to P links
between routers
Remote A 30 hosts
Remote B 30 hosts
Remote C 30 hosts
Remote D 30 hosts
Remote E 30 hosts
Remote F 30 hosts
Remote G 30 hosts
Central
43
Exercise 1 solution
Remote hosts

25
2 =30 hosts

11111111.11111111.1111111.11100000 (255.255.255.224)

256 224 = 32

192.168.2.0/27 (assigned to segment)

192.168.2.32/27 (assigned to segment)

192.168.2.64/27 (assigned to segment)

192.168.2.96/27 (assigned to segment)

192.168.2.96/27 (assigned to segment)

192.168.2.128/27 (assigned to segment)

192.168.2.160/27 (assigned to segment)

192.168.2.192/27 (assigned to segment)

192.168.2.224/27 (left for further subnetting)

Eight subnets created.

First seven give to remote sites; eighth subnet re-subnetted to
accommodate the P to P links.
44
Exercise 1 solution continued
P to P links

22
2 = 2 hosts

11111111.11111111.11111111.11111100 (255.255.255.252)

256 252 = 4

192.168.2.224/30 (assigned to segment)

192.168.2.228/30 (assigned to segment)

192.168.2.232/30 (assigned to segment)

192.168.2.236/30 (assigned to segment)

192.168.2.236/30 (assigned to segment)

192.168.2.240/30 (assigned to segment)

192.168.2.244/30 (assigned to segment)

192.168.2.248/30 (assigned to segment)

192.168.2.252/30 (expansion)

Eight subnets created supporting 2 IP addresses

Only seven subnets are needed, leaving one left over for expansion.
45
Exercise

192.168.3.0
Backbone
6 hosts
30 hosts
126 hosts
6 hosts
6 hosts
30 hosts
30 hosts
46
Exercise 2 solution
30 Hosts 25
2 = 30
11111111.11111111.11111111.11100000 (255.255.255.224)
256

224 = 32
Backbone 27
2 = 126
11111111.1111111.11111111.10000000 (255.255.255.128)
256 128 = 128
192.168.3.0 /25(assigned to backbone)
192.168.3.128/25
47
6 hosts 23
2 =6
11111111.11111111.11111111.11111000 (255.255.255.248)
256 248 = 8
192.168.3.224/29 (assigned to segment)
192.168.3.232/29 (assigned to segment)
192.168.3.240/29 (assigned to segment)
192.168.3.248/29 (expansion)
256

224 = 32
192.168.3.128/27 (assigned to segment)
192.168.3.160/27 (assigned to segment)
192.168.3.192/27 (assigned to segment)
192.168.3.224/27
Summary

Classless subnetting (VLSM) is used in most networks and
uses modern routing protocols

Subnetting is all about

Preserving IP addresses

Making large networks more manageable (logically)

Preserving bandwidth

Preserving bandwidth

Providing a level of security

To determine the number of hosts a subnet can support use
the formula 2
n
2

Always start the VLSM process with the segment with the
largest amount of hosts to accommodate

You cannot use the subnet address or broadcast address as
a host address
48
Quoetesof the day
I am thankful for all of those who
said NO to me. Its because of them
Im doing it myself.
Im doing it myself.

Albert Einstein