Sie sind auf Seite 1von 47

Layer 3

Routing and Addressing


Layer 3 Responsibilities
Move data through a set of networks.
Use a hierarchical addressing scheme.
Segment network and control flow of traffic.
Talk to other networks with services offered by ISPs (Internet
Service Providers).
Layer 3 Devices
Routers
Interconnect network segments or entire networks.
Make logical decisions based on IP addresses.
Determines best path for data on an internetwork.
A.K.A Layer 3 Switching
Path Determination
The process the router uses to choose the next hop in the path
the packet travels.
The router uses the network address to identify the destination
network of a packet within an internetwork.
IP addresses can be assigned by a network administrator or
automatically (dynamically.)
Layer 3 Packet/Datagram
VERS HLEN Service Type Total Length
Identification Flags Fragment Offset
Time to Live Protocol Header Checksum
Source IP Address
Destination IP Address
IP Options (if any) Padding
Data
Network Layer Addresses
233.14.17.0
Network layer addresses are 32 bits long.
They are represented as four octets in dotted decimal
format.
The IP address has two components:
The Network ID
The Host Id
Layer 3 Addresses
Network ID
Assigned by ARIN
(www.arin.net)
Identifies the network
to which a device is
attached.
May be identified by
one, two, or three of
the first three octets.
Host ID
Assigned by a network
administrator.
Identifies the specific
device on that
network.
May be identified by
one, two, or three of
the last three octets.
IP Addresses
32 bit address represented as 8 bit dotted decimals.
Different class addresses reserve different amounts of bits
for the Network and Host portions of the address.
Class A N H H H
Class B N N H H
Class C N N N H
Classes
How do you know what class an IP address is in?
If the first octet is between:
0 127 it is a class A address
128-191 it is a class B address
192 223 it is a class C address
Number of Hosts
Maximum number of hosts vary for each class.
Class A has 16,777,214 available hosts (2
24
2)
Class B has 65,534 available hosts (2
16
2)
Class C has 254 available hosts (2
8
2)

The first address in each network is reserved for the network
address and the last address is reserved for the broadcast
address.
Recognizing Class in Binary
Format
128s
place
64s
place
32s
place
Class A 0
Class B 1 0
Class C 1 1 0
Initial bit
pattern in
first octet
of IP
address.
IP Addresses as Decimal
Numbers
Reserved Addresses
1. Network Address (wire address) This is an IP address
that ends with binary 0s in all host bits.
Class A Network Address example:
113.0.0.0
Hosts on a network can only communicate directly
with other hosts if they have the same network ID. If
they dont, they will not be able to communicate
unless there is another device connecting the
networks.
Reserved Addresses
2. Broadcast Address is used to send data to all of the
devices on a network.
Broadcast IP addresses end with binary 1s in the host
part of the address.
Class B Broadcast Address example:
176.10.255.255

(Remember decimal 255 = binary 11111111)
Basics of Subnetting
Subnetworks are smaller divisions of networks.
They provide addressing flexibility.
A.K.A. subnets
Subnet addresses are assigned locally, usually by a
network administrator.
Subnets reduce a broadcast domain.
Subnet Addresses
Include Class A, B, or C network portion plus a subnet
field and a host field.
Bits are borrowed from the host field and are designated as
the subnet field.
Network Subnet Host
How many bits can I borrow?
Size of Host
Field
Maximum # of borrowed
bits
Class A
24 22
Class B
16 14
Class C
8 6
The minimum number of bits you can borrow is 2.
Default Subnet Masks
Class A 255.0.0.0
Class B 255.255.0.0
Class C 255.255.255.0
Calculating a Subnet
We will subnet the IP address:
223.14.17.0
What class IP address is this?
Class C

Step #1
Determine the default subnet mask

Class C default subnet mask:
255.255.255.0
Step #2
Determine the number of subnets needed and
hosts on each to determine how many bits to
borrow from the host ID.
Need:
13 subnets
10 hosts on each subnet
Step #3
Figure the actual number of subnets and hosts by
borrowing bits from host ID.
Lets see how many subnets and hosts we will
have by borrowing 4 bits from the host.

Step #3 continued
223.14.17.0
X X X X H H H H
16 possible
subnets
16 possible hosts
for each subnet
Step #3 continued
We get 16 possible subnets and 16 possible hosts for each
subnet because:
For the 4 bits borrowed each bit can be a 1 or a 0 leaving
you with 2
4
or 16 possible combinations.
The same goes for the 4 leftover host bits.
Important: There are only 14 available subnets and hosts on
each subnet. Why?
Step #3 continued
Because you cannot use the first and last subnet.
Because you cannot use the first and last address within
each subnet.
For each, one is the broadcast address and one is the
network address.
Step #4
Determine the subnet mask.
223.14.17.0
X X X X H H H H
Where X represents the borrowed bits for subnetting.
Step #4 continued
Add the place values of X together to get the last octet
decimal value of the subnet mask.
128 + 64 + 32 + 16 = 240
The subnet mask is: 255.255.255.240
The subnet mask is used to reveal the subnet and host
address fields in IP addresses.
Step 5
Determine the ranges of host addresses for each subnet.
Subnet # Subnet Bits Host Bits In Decimal
1 0000 0000-1111 .0 -.15
2 0001 0000-1111 .16 - .31
3 0010 0000-1111 .32 - .47
4 0011 0000-1111 .48 - .63
5 0100 0000-1111 .64 - .79
6 0101 0000-1111 .80 - .95
7 0110 0000-1111 .96 - .111
8 0111 0000-1111 .112 - .127
Step 5 continued
Subnet # Subnet Bits Host Bits In Decimal
9 1000 0000-1111 .128 -.143
10 1001 0000-1111 .144 - .159
11 1010 0000-1111 .160 - .175
12 1011 0000-1111 .176 - .191
13 1100 0000-1111 .192 - .207
14 1101 0000-1111 .208 - .223
15 1110 0000-1111 .224 - .239
16 1111 0000-1111 .240 - .255
Step 5 continued
There are 16 possible subnets.
There are 16 possible hosts on each subnet.
That equals 256 possible hosts.
What are our available subnets?
What are our available hosts on each subnet? Why?????
Figuring Subnet
Network Addresses
Step #1: Change the IP host address to binary.
Step #2: Change the subnet mask to binary.
Step #3: Use the boolean operator AND to combine the two.
Step #4:Convert the network binary address to dotted
decimal.
Figuring Subnet
Network Addresses
IP Host 172.16.2.120
Subnet Mask 255.255.255.0
10101100.00010000.00000010.01111000
11111111.11111111.11111111.00000000
10101100.00010000.00000010.00000000
172.16.2.0
This is the subnet network address. It is the lowest numbered
address on the subnet network. It can help determine path.
AND
Revision on IP
Addressing
Subnetting Review
Logical Addressing
At the network layer, we use logical, hierarchical
addressing.
With Internet Protocol (IP), this address is a 32-bit
addressing scheme divided into four octets.
Do you remember the classes 1st octets value?
Class A: 1 - 127
Class B: 128 - 191
Class C: 192 - 223
Class D: 224 - 239 (multicasting)
Class E: 240 - 255 (experimental)
Network vs. Host
N H H H
Class A: 2
7
= 126 networks; 2
24
> 16 million hosts
N N H H
Class B : 2
14
= 16,384 networks; 2
16
> 65,534 hosts
N N N H
Class C : 2
21
> 2 million networks; 2
8-
= 256-2=254 hosts
Why Subnet?
Remember: we are usually dealing with a broadcast
topology.
Can you imagine what the network traffic overhead would
be like on a network with 254 hosts trying to discover each
others MAC addresses?
Subnetting allows us to segment LANs into logical
broadcast domains called subnets, thereby improving
network performance.
Stealing Bits
In order to subnet, we must steal or borrow bits from the host
portion on the IP address.
First, we must to determine how many subnets we need and how
many hosts per subnet.
We do this through the power of 2
For example, I need 8 subnets from a Class C:
2
4
= 16 - 2 = 14 subnets
Remember: we subtract 2 because these subnets are not
used
How many host do we have?
Its a Class C, so 4 bits are left: 2
4
= 16 - 2 = 14 hosts
Remember: we subtract 2 because one address is the
subnet address and one is the broadcast address
Subnet Mask
We determine the subnet mask by adding up the decimal
value of the bits we borrowed.
In the previous Class C example, we borrowed 4 bits.
Below is the host octet showing the bits we borrowed and
their decimal values.
128 64 32 16 8 4 2 1
1 1 1 1
We add up the decimal value of these bits and get 240.
Thats the last non-zero octet of our subnet mask.
So our subnet mask is 255.255.255.240
Last Non-Zero Octet
Memorize this table. You should be able to:
Quickly calculate the last non-zero octet when
given the number of bits borrowed.
Determine the number of bits borrowed given the
last non-zero octet.
Determine the amount of bits left over for hosts
and the number of host addresses available.
Bits
Borrowed
Non-Zero
Octet Hosts
2 192 62
3 224 30
4 240 14
5 248 6
6 252 2
CIDR Notation
Classless Interdomain Routing is a method of representing
an IP address and its subnet mask with a prefix.
For example: 192.168.50.0/27
What do you think the 27 tells you?
27 is the number of 1 bits in the subnet mask.
Therefore, 255.255.255.224
Also, you know 192 is a Class C, so we borrowed 3
bits!!
Finally, you know the magic number is 256 - 224 = 32,
so the first useable subnet address is 197.168.50.32!!
Lets see the power of CIDR notation.
202.151.37.0/26
Subnet mask?
255.255.255.192
Bits borrowed?
Class C so 2 bits borrowed
Magic Number?
256 - 192 = 64
First useable subnet address?
202.151.37.64
Third useable subnet address?
64 + 64 + 64 = 192, so 202.151.37.192
198.53.67.0/30
Subnet mask?
255.255.255.252
Bits borrowed?
Class C so 6 bits borrowed
Magic Number?
256 - 252 = 4
Third useable subnet address?
4 + 4 + 4 = 12, so 198.53.67.12
Second subnets broadcast address?
4 + 4 + 4 - 1 = 11, so 198.53.67.11
200.39.89.0/28
What kind of address is 200.39.89.32?
Class C, so 4 bits borrowed
Last non-zero octet is 240
Magic number is 256 - 240 = 16
32 is a multiple of 16 so 200.39.89.32 is a subnet
address--the second subnet address!!
Whats the broadcast address of 200.39.89.32?
32 + 16 -1 = 47, so 200.39.89.47
194.53.45.0/29
What kind of address is 194.53.45.26?
Class C, so 5 bits borrowed
Last non-zero octet is 248
Magic number is 256 - 248 = 8
Subnets are .8, .16, .24, .32, ect.
So 194.53.45.26 belongs to the third subnet address
(194.53.45.24) and is a host address.
What broadcast address would this host use to communicate
with other devices on the same subnet?
It belongs to .24 and the next is .32, so 1 less is .31
(194.53.45.31)
No Worksheet Needed!
After some practice, you should never need a subnetting
worksheet again.
The only information you need is the IP address and the
CIDR notation.
For example, the address 221.39.50/26
You can quickly determine that the first subnet address is
221.39.50.64. How?
Class C, 2 bits borrowed
256 - 192 = 64, so 221.39.50.64
For the rest of the addresses, just do multiples of 64 (.64,
.128, .192).
The Key!!
MEMORIZE THIS TABLE!!!
Bits
Borrowed
Non-Zero
Octet Hosts
2 192 62
3 224 30
4 240 14
5 248 6
6 252 2
Practice On Your Own
Below are some practice problems. Take out a sheet
of paper and calculate...
Bits borrowed
Last non-zero octet
Second subnet address and broadcast address
1. 192.168.15.0/26
2. 220.75.32.0/30
3. 200.39.79.0/29
4. 195.50.120.0/27
5. 202.139.67.0/28
6. Challenge: 132.59.0.0/19
7. Challenge: 64.0.0.0/16

Das könnte Ihnen auch gefallen