Chapter-7-Network Layer Delivery - Forwarding and Routing
Chapter-7-Network Layer Delivery - Forwarding and Routing
Undergraduate Program
School of Electrical and Computer Engineering
Outlines
• Forwarding Techniques and Routing Table
• Unicast Routing Protocols
• Intra- and Interdomain Routing algorithms
• Distance Vector Routing,
• Link State Routing ,
• Path Vector Routing
• Network layer protocols
• Address mapping protocols
• ARP,RARP, DHCP
• Network management protocols
• ICMP, IGMP, ICMPV6
• Routing protocols (will be covered in unicast routing protocols)
• RIP, OSPF, BGP
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 2
Delivery, Forwarding and Routing
Delivery
• The handling of datagrams by the underlying physical network –
Delivery
• Direct delivery
• The destination host and the deliverer are connected to the same physical
network
• How to know→ if the network address of destination is the same as the
network address of network the sender id connected.
• Indirect delivery
• The destination host is not on the same network as the deliverer
• The datagram travels from router to router until it reaches the destination
• The last delivery is always a direct delivery.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 3
Delivery, Forwarding and Routing
Forwarding
• Forwarding – to place the datagram in its route to its
destination
• To place a datagram from an incoming port to an outgoing
• Routing table is required to make the forwarding decision !!
• Table where routers store routes to the list of all their known
destinations
• Forwarding techniques – based on the content of the routing
table
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 4
Delivery, Forwarding and Routing
Cont.… (Forwarding techniques )
• Next-hop method versus route method
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 5
Delivery, Forwarding and Routing
Cont.… (Forwarding techniques )
• Network specific method vs. host specific
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 6
Delivery, Forwarding and Routing
Cont.… (Forwarding techniques )
• Default forwarding
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 7
Delivery, Forwarding and Routing
Forwarding process
• A simple forwarding module
• We need at least four columns in a routing table
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 8
Delivery, Forwarding and Routing
E.g.:
• Build a routing table for router R1
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 9
Delivery, Forwarding and Routing
Address aggregation
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 10
Delivery, Forwarding and Routing
Longest mask matching
• The routing table is sorted from longest mask to the shortest mask
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 12
Delivery, Forwarding and Routing
Routing table
• How do routers acquire these routing tables?
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 13
Delivery, Forwarding and Routing
Routing protocols
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 14
Delivery, Forwarding and Routing
Cont.…
• Intradomain (Interior gateway protocol(IGP)) : sharing routing
protocol with in a single network domain (Autonomous
Systems).
• Routing algorithms
• Distance-based (RIP routing protocol)
• Link state (OSPF routing protocol)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 15
Delivery, Forwarding and Routing
Distance vector routing
• The least-cost route between any two nodes is the route with minimum
distance
• Uses Routing by Rumor
• Each router shares the information about what they know to their
neighbor router and the metrics cost to reach each destination.
• The metrics cost is the number of hops/routers from source to destination.
• Routers don’t have the complete map of the whole network.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 16
Delivery, Forwarding and Routing
Cont.…
• Initialization→
• Updating →
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 17
Delivery, Forwarding and Routing
Two node loop instability
• Solutions
• Defining infinity – to redefine infinity to a smaller number
• Most implementation define Infinity=16
• Implies - the distance vector routing cannot be used in large system
• Split horizon
• Each node sends only part of its table through each interface
• If the optimum path to x is through A, the node doesn’t advertise this piece of
information to A
• Split horizon and poison reverse
• DV- if there is no news about a route within a giver time, the node deletes the
route
• Node B can still advertise the value for X, but if the source of information is A,
it can replace the distance with infinity
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 18
Delivery, Forwarding and Routing
Routing information protocol (RIP)
• Applies Distance vector algorithm
• Included in BSD-UNIX Distribution in 1982
• Distance metric: uses hop count (max = 15 hops and infinity=16)
• Distance vectors: exchanged among neighbors every 30 sec via Response
• Message (also called advertisement) contains
• The routers destination network
• Their metrics to reach their known destination network
• Each advertisement: list of up to 25 destination nets within AS
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 20
Delivery, Forwarding and Routing
Cont.… (RIP)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 21
Delivery, Forwarding and Routing
Cont.… (RIP: Link Failure and Recovery)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 22
Delivery, Forwarding and Routing
Cont.… (RIP: Limitations)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 23
Delivery, Forwarding and Routing
Link state routing
• Each node has the entire topology of the domain, the list of
nodes and link, how they are connected (type, cost,
condition of the link (up or down)
• Employs Dijkstra's algorithm
• The whole topology is established from partial knowledge of each
node
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 24
Delivery, Forwarding and Routing
Cont.…
• Building routing tables: Four set of actions
• Creation of the states of links by each node- link state packet (LSP)
• Dissemination of LSP to every other router
• Formation of a shortest path tree for each node
• Calculation of a routing table based on the shortest path tree
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 25
Delivery, Forwarding and Routing
Link state packet
• Contains
• Node identity
• List of links
• Sequence number
• To distinguished new LSP from old ones
• Age
• Prevents old LSPs from remaining in the domain for a long time
• Generated
• When there is a change in the topology of the domain
• On a periodic basis
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 26
Delivery, Forwarding and Routing
Flooding of LSPs
• The creating node sends a copy of the LSP out of each
interface
• A node that receives an LSP compares it with the copy it
may already have
• If older than the one it has – discards the LSP
• Otherwise, sends a copy of it out of each interface except the one
from which the packet arrived
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 27
Delivery, Forwarding and Routing
Formation of shortest path tree
• Start with root node
• All other nodes can be reached from the root through only one
single route
• A shortest path tree – the distance between the root and every
other node is the shortest
• Dijkstra algorithm
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 28
Delivery, Forwarding and Routing
Example
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 29
Delivery, Forwarding and Routing
Open Shortest Path First(OSPF)
• Open
• Developed by IETF IGP working group, RFC2328.
• Version:
• OSPFV1(1989): old, not used anymore ; OSPFV2(1998): used for IPV4;
OSPFV3(2008): used for IPV6 (also for IPV4 as well)
• OSPF
• Each router floods link-state information through its neighbors to other
routers with Link state Advertisements (LSA)
• Based on the flooded link-state information, each router maintains a
complete link-state database (LSDB)
• Based on the LSDB, a routing table is constructed using SPF (e.g.,
Dijkstra’s) algorithm.
• At the border of an area, special routers summarize the information and
sent it to other areas
• Runs over IP directly.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 30
Delivery, Forwarding and Routing
Cont.….
• OSPF Tables
• Neighbor table
• Directly connected OSPF
routers
• State of Adjacency
• Topology table
• Everything OSPF knows
• Stored in link-state database
(LSDB) in a form of LSA
• Routing table
• Routers routing table (not only
for OSPF)
• OSPF contributes its best routes
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 31
Delivery, Forwarding and Routing
Example
• Router 4: Neighbor table
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 32
Delivery, Forwarding and Routing
Cont.… (Example)
• Router 5: Topology table
OSPF LSDB
LSA
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 33
Delivery, Forwarding and Routing
Cont.… (Example)
• Router 5: routing table
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 34
Delivery, Forwarding and Routing
LSA Flooding
• OSPF is enabled on R2 G0/0,
Se0/1/0 and Se0/0/0 interface.
• When a new network is added
to R2, it will tell about the new
network segment.
Se0/0/0
192.168.10.192/30
Se0/0/0 • R2 creates an LSA update to
.194 .202 192.168.10.200/30 tell the neighbors about the
R0 network on G0/0
Se0/1/0 .193 .201 Se0/1/0 • Some of the information on the
192.168.10.196/30
R1
.197 .198 LSA,
Se0/0/0 R2
Se0/0/0
• Until all routers have the
.1 G0/1
G0/0 .129 same information the LSA
will be flooded
192.168.10.0/26 192.168.10.128/26
• 30 min. expiration time.
LSA
• Each router the calculates
RouterID: 1.1.1.1
IP: their best route to
192.168.10.128/26 192.168.10.128/26.
Cost: 1
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 35
Delivery, Forwarding and Routing
Features of OSPF
• Use flexible metrics instead of only hop count.
• Supports variable-length subnetting.
• Allows load balancing among equal-cost paths.
• Supports multiple routes; one for each IP type of service
(ToS).
• Authenticates route exchanges.
• Quick convergence.
• Uses multicast rather than broadcast of its messages to
reduce network load.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 36
Delivery, Forwarding and Routing
OSPF Areas
• OSPF uses areas to divide up the network.
• Small networks can be single-area without any negative on performance.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 38
Delivery, Forwarding and Routing
OSPF Areas…
• OSPF areas must be
contagious.
• All OSPF areas must at least
Area 0 have one ABR connected to
(Backbone) the backbone.
• OSPF interfaces with the
same subnet must belong to
the same area.
Area Area
1 2
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 39
Delivery, Forwarding and Routing
Router Identities (Router ID)
• Each router in an OSPF network needs a unique ID.
• The ID is included in any OSPF messages the router generates that
other OSPF routers will process.
• The router ID is chosen according to one of the following criteria:
• The highest IP address on the routers active loopback interfaces is used
(this is a logical interface on a router).
• If no loopback interface exists with an IP address, the highest IP address
on its active interfaces is used when the router boots up.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 40
Delivery, Forwarding and Routing
OSPF cost
• OSFP metrics is called cost.
• It is automatically calculated based on the bandwidth (speed) of the
interface.
• It is calculated by dividing a references bandwidth value by the interface's
bandwidth.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 41
Delivery, Forwarding and Routing
OSPF cost…
• The OSPF cost to a destination
is the total cost of the outgoing
/exit interfaces
R0
192.168.10.0/26 192.168.10.128/26
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 42
Delivery, Forwarding and Routing
Path vector routing
• Distance vector routing
• Intra-domain
• Subjected to instability if there are more than a few hops in the
domain of operation
• Link state routing
• Intra-domain
• needs a huge amount of resources to calculate routing tables
• creates heavy traffic because of flooding
• Path vector
• Inter-domain routing
• Applies the principle of distance vector routing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 43
Delivery, Forwarding and Routing
Path vector routing
• There is one node (can be more than one) in each AS that
acts on behalf of the entire AS
• Let us call it the speaker node
• The speaker node in an AS creates a routing table and
advertises it to speaker nodes in the neighboring ASs
• speaker node advertises the path, not the metric of the
nodes
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 44
Delivery, Forwarding and Routing
Initial routing tables and updating
• Updating
• When a speaker node receives a two-column table from a
neighbor, it updates its own table
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 45
Delivery, Forwarding and Routing
Border Gateway Protocol (BGP)
• Inter-domain(exterior getaway) routing protocol using path vector
routing
• BGP is the routing protocol of choice on the Internet.
• Essentially, the Internet is a collection of interconnected Autonomous
Systems.
• BGP maintains a separate routing table based on shortest AS Path and
various other attributes, as opposed to IGP metrics like distance or
cost.
• Weight - Which route has the highest weight?
• AS-Path - Which route has the shortest AS-Path?
• Age - Which route is the oldest? (oldest is preferred).
• BGP operation
• Establish session (use TCP service)
• Exchange all active routes
• Exchange incremental updates
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 47
Delivery, Forwarding and Routing
Outlines
• Forwarding Techniques and Routing Table
• Unicast Routing Protocols
• Network layer protocols
• Address mapping protocols
• ARP,RARP, DHCP
• Network management protocols
• ICMP, IGMP, ICMPV6
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 48
Delivery, Forwarding and Routing
Network layer Protocols
• Address mapping
• Maps a logical address to its corresponding physical address and
vice versa
• Static mapping
• Creation of a table that associates a logical address with a physical
address
• Dynamic mapping
• A machine that knows one of the two addresses, can use a protocol to
find the other one
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 49
Delivery, Forwarding and Routing
Address resolution protocol (ARP)
• IP datagram must be
encapsulated in a frame
• The sender needs the physical
address of the receiver
• The host/router sends an ARP
query
• The packet includes the physical
and IP addresses of the sender +
the IP address of the receiver
• Every host/router receivers and
process the ARP query
• The intended recipient sends back
an ARP reply
• Recipient IP + physical address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 50
Delivery, Forwarding and Routing
Cont.… (ARP)
• Cache memory
• ARP rely is stored in the cache memory (for about 20 to 30
minutes)
• Before sending ARP request, the system first checks it cache
• Packet format
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 51
Delivery, Forwarding and Routing
Cont.… (ARP: Operation)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 52
Delivery, Forwarding and Routing
ARP: Different cases
• Different cases in which ARP service can be required
• A host wants to send a packet to another host on the same
network
• The logical address that must be mapped to the physical address
→the destination IP address of the datagram
• A host wants to send a packet to another host on another network
• The logical address that must be mapped to the physical address →
the IP address of the router
• A routers that has received a datagram destined for a host on
another network
• The logical address that must be mapped to the physical address
→the IP address of the next router
• A router that has received a datagram destined for a host on the
same network
• The logical address that must be mapped to the physical address
→the destination IP address of the datagram
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 53
Delivery, Forwarding and Routing
Cont.…
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 54
Delivery, Forwarding and Routing
Example
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 55
Delivery, Forwarding and Routing
Proxy ARP
• A proxy ARP is an ARP that acts on behalf of a set of hosts
• Whenever a router running a proxy ARP receives an ARP
request to one of these hosts
• Sends an ARP reply announcing its own hardware address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 56
Delivery, Forwarding and Routing
Reverse address resolution protocol (RARP)
• Finds the logical address for a machine that knows only its
physical address
• A RARP request is created and broadcasted on the local network
• A machine on the local network that knows all the IP addresses will
respond with a RARP reply
• The requesting machine must be running a RARP client program
• The responding machine must be running a RARP server program
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 57
Delivery, Forwarding and Routing
Dynamic host configuration protocol (DHCP)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 58
Delivery, Forwarding and Routing
Outlines
• Forwarding Techniques and Routing Table
• Unicast Routing Protocols
• Network layer protocols
• Address mapping protocols
• ARP,RARP, DHCP
• Network management protocols
• ICMP, IGMP, ICMPV6
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 59
Delivery, Forwarding and Routing
Internet control message protocol (ICMP)
• IP protocol is a best-delivery service
• No error-reporting or error correcting mechanisms
• What happens if a router must discard a datagram because if cannot find
a route to the final destination or the TTL has a zero value?
• ICMP is designed to compensate the deficiencies of IP
• Types of ICMP messages
• Error-reporting
• Query
• ICMP message format
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 60
Delivery, Forwarding and Routing
Error reporting
• ICMP reports error ( doesn’t correct error)
• Error messages are always sent to the original source
• Error types
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 61
Delivery, Forwarding and Routing
Cont.… (ICMP error messages)
• Time exceeded
• Error=>TTL value reaches zero or not all fragments that make up a
message arrive at the destination host within a certain time limit
• Parameter problem
• Error=> ambiguous or missing value in any field of the datagram
• Redirection
• Redirection message to the sending host
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 62
Delivery, Forwarding and Routing
Cont.… (ICMP error messages)
• No ICMP error message will be generated in response to a datagram
carrying an ICMP error message
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 63
Delivery, Forwarding and Routing
ICMP query
• ICMP can diagnose some network problem
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 64
Delivery, Forwarding and Routing
Debugging tools
• Ping
• The source host sends ICMP each request messages
• The destination responds with ICMP echo-reply message
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 65
Delivery, Forwarding and Routing
Traceroute
• Used to trace the route of packet from the source to the
destination
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 66
Delivery, Forwarding and Routing
Internet group management protocol (IGMP)
• IGMP – a protocol that manages multicast group
membership
• IGMP operation
• For each group there is one router that has the duty of distributing
the multicast packets destined for that group
• A host or multicast router can have membership in a group
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 67
Delivery, Forwarding and Routing
ICMPv6
• Network layer in v4 and v6
Sem. II, 2023/24 Data communication and Computer networks - Ch. 7 –Network Layer 68
Delivery, Forwarding and Routing