Chapter 6 Network Layer - July 2023
Chapter 6 Network Layer - July 2023
Network Layer
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
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 4
Communication from Host to Host
Network
Layer
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 5
IPV4: Example Network Layer Protocol
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)
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)
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 14
IPv4 Packet
IPv4 Packet Header
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.
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
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
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
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?
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
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 33
What happens when a router receives a
packet?
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
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 36
Router Routing Tables
Directly Connected Routing Table Entries
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
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
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
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
• 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
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
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
Presentation_ID © 2008 Cisco Systems, Inc. All rights reserved. Cisco Confidential 56
example
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