0% found this document useful (0 votes)
20 views58 pages

Chapter 6 Network Layer - July 2023

Lecture Note for Introduction to Networking

Uploaded by

black hello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views58 pages

Chapter 6 Network Layer - July 2023

Lecture Note for Introduction to Networking

Uploaded by

black hello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Chapter 6:

Network Layer

Network Layer Protocols

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 1
Chapter 6
6.1 Network Layer Protocols
6.2 Routing
6.3 Routers
6.4 Summary

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 2
6.1 Network Layer Protocols

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 3
Communication from Host to Host
As we communicate…
Devices use the Transport Layer
to ensure reliable transmissions

The network layer enables


packets to travel through
networks…

Routers find the


best path…

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 4
Communication from Host to Host

Network
Layer

Addresses packets with an IP Address.


Encapsulates the packet.
Routes the packet to the destination.
Decapsulates the packet. 5.1.1.1

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 5
IPV4: Example Network Layer Protocol

▪ Internet Protocol Version 4 (IPV4) is the most widely used


version of IP.
▪ Only Layer 3 protocol used on the Internet.
▪ Focus of this course.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 6
IPV4: Example Network Layer Protocol

▪ Internet Protocol Version 6 (IPV6) is developed and slowly


being implemented.
▪ Will eventually replace IPV4.
▪ Different characteristics than IPV4.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 7
Network Layer in Communication
The Network Layer
Responsible to transmit packets from source node to final
destination node (End to end delivery)
▪ Addressing end devices
▪ Encapsulation
▪ Routing
▪ De-encapsulating

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 8
Network Layer in Communication
Network Layer Protocols
Common Network Layer Protocols
▪ Internet Protocol version 4 (IPv4)
▪ Internet Protocol version 6 (IPv6)

Legacy Network Layer Protocols


▪ Novell Internetwork Packet Exchange (IPX)
▪ AppleTalk
▪ Connectionless Network Service (CLNS/DECNet)

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 9
Characteristics of the IP protocol
Characteristics of IP

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 10
Characteristics of the IP protocol
IP - Connectionless

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 11
“Best Effort” Delivery (Unreliable)

▪ Unreliable means simply that IP does not have the capability


to manage and recover from undelivered or corrupt packets.
▪ Since protocols at other layers can manage reliability, IP is
allowed to function very efficiently at the Network Layer.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 12
Media Independent

▪ Not concerned with the physical medium.


▪ Operates independent of the layers that handle the physical
medium that carries the packet.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 13
Packaging the Transport Layer PDU

In TCP/IP based networks, the Network Layer PDU is the


IP Packet.

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 14
IPv4 Packet
IPv4 Packet Header

Byte 1 Byte 2 Byte 3 Byte 4

IP Header Differentiated Services


Version Total Length
Length
DSCP ECN

Identification Flag Fragment Offset

Time To Live Protocol Header Checksum

Source IP Address

Destination IP Address

Options (optional)
Padding

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 15
IPV4 Packet Header
8-bit fields -
Maximum “hops” Throughput Priority
before undeliverable.
Used in reconstruction
of any fragments.

Upper Layer Protocol


(TCP/UDP)

32 Bits binary value. 32 Bits binary value.


Source of the packet Destination of the packet
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 16
IPv4 Packet
Sample IPv4 Headers

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 17
Network Layer in Communication
Limitations of IPv4
▪ IP Address depletion
▪ Internet routing table expansion
▪ Lack of end-to-end connectivity

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 18
Network Layer in Communication
Introducing IPv6
▪ Increased address space
▪ Improved packet handling
▪ Eliminates the need for NAT
▪ Integrated security

▪ 4 billion IPv4 addresses


4,000,000,000
▪ 340 undecillion IPv6 addresses
340,000,000,000,000,000,000,000,000,000,000,000,000

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 19
IPv6 Packet
Encapsulating IPv6

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 20
IPv6 Packet
IPv6 Packet Header
Byte 1 Byte 2 Byte 3 Byte 4

Version Traffic Class Flow Label

Next
Payload Length Hop Limit
Header

Source IP Address

Destination IP Address

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 21
IPv6 Packet
Sample IPv6 Header

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 22
6.2 Routing
▪ Routing occurs when a host is sending a packet to another
network.
▪ Host have to determine whether a packet is for its own
network or another network.
▪ If its for another network, the host will send the packet to the
router (called the gateway)
▪ The router will then make the routing decision depending on
its routing table

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 23
Host forwarding decision
▪ Packet is for own network ? Start
Just forward to the destination

▪ Packet is for other networks ? Own No


Forward the frame to the router network
?

Where shall I
forward packet ?
Yes
Forward
frame to
Forward frame gateway
direct to
destination

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 24
Host must have a gateway configured

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 25
Host- Default Gateway
Most important for host is to have a default gateway
configured.
PC1

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 26
Host forwarding decision
Start
192.168.1.10

192.168.1.20 Own No
network
?

Where shall I
forward packet ?
Yes
Forward
frame to
Forward frame gateway
direct to
destination

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 27
Host forwarding decision
Start
192.168.1.10

10.1.1.2 Own No
network
?

Where shall I
forward packet ?
Yes
Forward
frame to
Forward frame gateway
direct to
destination

Hi
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 28
What happens when a router receives a
packet?

Today got business,


Packet coming to me….

My gateway, my
router, my darling,
help! This frame is
for external network
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 29
Router Routing Tables
Router Forwarding Decision
Must know :
Directly connected networks
Remote networks

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 30
Router – routing table
▪ Router keeps these network knowledge in its routing table
▪ Further later slides shows the routing table
▪ Before that, we must be able to be able to analyze the
router’s
• Connected networks
• Remote networks

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 31
Router Routing Tables
Directly connected/Remote networks
For router R1

Just look at router interfaces

Directly connected network Remote network


192.168.10.0/24 10.1.1.0/24
192.168.11.0/24 10.1.2.0/24
209.165.200.224/30
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 32
Router Routing Tables
Directly connected/Remote networks
For router R2 ??

Just look at router interfaces

Directly connected network Remote network

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 33
What happens when a router receives a
packet?

Ok, in order to forward, I


have to do this :
1. Calculate network
address
2. Check my ROUTING
TABLE to see whether
network exists.
a. If network exists
Forward to the next
hop/interface
b. If network does not
exist, is there a default
Nah, give you this packet gateway, if yes, forward
Please forward for me to default gateway
Else
DROP packet
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 34
Router Routing Tables
Routing table for ROUTER R1
For router R1

Routing table tells the router how to forward the packet


It consists of :
“Directly Connected” network connected to which interface
“Remote network” through which router/next hop
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 35
Router Routing Tables
IPv4 Router Routing Table
192.168.10.0/24 10.1.1.0/24
.10 G0/0 .10
PC1 .1
209.165.200.224 /30
.1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24
R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1#

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 36
Router Routing Tables
Directly Connected Routing Table Entries

192.168.10.0/24 64.100.0.1 10.1.1.0/24


.10 G0/0 .10
PC1 .1
209.165.200.224 /30
.1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

A B C
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0

A Identifies how the network was learned by the router.


B Identifies the destination network and how it is connected.
C Identifies the interface on the router connected to the destination network.

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 37
Router Routing Tables
Remote Network Routing Table Entries
192.168.10.0/24 64.100.0.1 10.1.1.0/24
.10 G0/0 .10
PC1 .1
209.165.200.224 /30
.1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0

A Identifies how the network was learned by the router.


B Identifies the destination network.
C Identifies the administrative distance (trustworthiness) of the route source.
D Identifies the metric to reach the remote network.
E Identifies the next hop IP address to reach the remote network.
F Identifies the amount of elapsed time since the network was discovered.
G Identifies the outgoing interface on the router to reach the destination network.
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 38
Router Routing Tables
Next-Hop Address
192.168.10.0/24 64.100.0.1 10.1.1.0/24
.10 G0/0 .10
PC1 .1
209.165.200.224 /30
.1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24
R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1#

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 39
Example 1 : what happens when a router
receives a packet?
Ok, in order to forward, I have to do this :
1. Calculate network address
2. Check my ROUTING TABLE to see
whether network exists.
a. If network exists
Forward to the next hop/interface
b. If network does not exist, is there
a default gateway, if yes, forward to
default gateway
Else
DROP packet

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 40
Example 1 : what happens when a router
receives a packet?
Ok, in order to forward, I have to do this :
1. Calculate network address
2. Check my ROUTING TABLE to see
whether network exists.
a. If network exists
Forward to the next hop/interface
b. If network does not exist, is there
a default gateway, if yes, forward to
default gateway
Else
1 DROP packet

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 41
Example 2
Ok, in order to forward, I have to do this :
1. Calculate network address
2. Check my ROUTING TABLE to see
whether network exists.
a. If network exists
Forward to the next hop/interface
b. If network does not exist, is there
a default gateway, if yes, forward to
default gateway
Else
172.16.16.1 DROP packet

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 42
Example 2
Ok, in order to forward, I have to do this :
1. Calculate network address
2. Check my ROUTING TABLE to see
whether network exists.
a. If network exists
Forward to the next hop/interface
b. If network does not exist, is there
a default gateway, if yes, forward to
default gateway
Else
1 172.16.16.1 DROP packet
3

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 43
What happens when a router receives a
packet?
Ok, in order to forward, I have to do this :
1. Calculate network address
2. Check my ROUTING TABLE to see
whether network exists.
a. If network exists
Forward to the next hop/interface
b. If network does not exist, is there
a default gateway, if yes, forward to
default gateway
Else
172.16.16.1 DROP packet

209.165.200.226

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 44
Example 2
Ok, in order to forward, I have to do this :
1. Calculate network address
2. Check my ROUTING TABLE to see
whether network exists.
a. If network exists
Forward to the next hop/interface
b. If network does not exist, is there
a default gateway, if yes, forward to
default gateway
3 Else
1 172.16.16.1 DROP packet

209.165.200.226

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 45
6.3 Router
▪ A router is a layer 3 device
▪ It is a device in the network layer
▪ Uses IP address to forward a packet
▪ A router is a computer.
▪ Function of a router is to make routing decisions. It uses
routing algorithm to choose the best path.

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 46
Anatomy of a Router
A Router is a Computer

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 47
Anatomy of a Router
Router CPU and OS

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 48
Anatomy of a Router
Router Memory

Volatile /
Memory Stores
Non-Volatile
• Running IOS
• Running configuration file
RAM Volatile
• IP routing and ARP tables
• Packet buffer

• Bootup instructions
ROM Non-Volatile • Basic diagnostic software
• Limited IOS

NVRAM Non-Volatile • Startup configuration file

• IOS
Flash Non-Volatile
• Other system files
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 49
Anatomy of a Router
Power supply unit
Inside a Router HWIC

Fan
Presentation_ID
RAM NVRAM
© 2008 Cisco Systems, Inc. All rights reserved.
CPU
Cisco Confidential 50
Anatomy of a Router
Router Backplane

Double-wide eHWIC slots eHWIC 0 AUX LAN


port interfaces

Console
RJ45 USB
Ports
Two 4 GB flash card slots Console
USB Type B

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 51
Anatomy of a Router
Connecting to a Router

WAN AUX LAN


Interface port interfaces

Console
RJ45

Console
USB Type B

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 52
Anatomy of a Router
LAN and WAN Interfaces

Serial interfaces

LAN interfaces

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 53
Understanding default gateway
▪ All devices in the network needs a default gateway in order to
be able to send packets to external network
▪ Host (PC/servers) need to be configured a default gateway
▪ Switches and routers need default gateways as well.
▪ The default gateway IP address is the interface of the router
that is in the same network as the device.

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 54
Configuring the Default Gateway
Default Gateway on a Host
.10
PC1 192.168.10.0/24
.1
.10 G0/0
PC2

R1
G0/1
.1

.10
.10 PC1 192.168.10.0/24
PC3
.1
.11 G0/0
.10 192.168.11.0/24 PC2
PC4
R1
G0/1
.1

.10
PC3

.11 192.168.11.0/24
PC4

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 55
Configuring the Default Gateway
Default Gateway on a Switch

.10
PC1 192.168.10.0/24 192.168.11.0/24
.1 .1
S1 G0/0 G0/1 S2
.11 R1
PC2 .50

If the default gateway were not configured


on S1, response packets from S1 would not
be able to reach the administrator at
192.168.11.10. The administrator would not
be able to manage the device remotely.

Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 56
example

Find default gateways for

Server A
Switch 2
PC1
Switch 3
PC2
Server B
Switch 1
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 57
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 58

You might also like