Chapter 22
Network Layer:
Delivery, Forwarding,
and Routing
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
22.1
Introduction
• This chapter describes the delivery,
forwarding, and routing of IP
packets to their final destinations.
Delivery - the way a packet is handled by the
underlying networks .
Forwarding - the way a packet is delivered to
the next station.
Routing - the way routing tables are created to
help in forwarding.
• Routing protocols - continuously update - are
consulted for forwarding and routing.
22.2
The network layer supervises the handling of
the packets by the underlying physical
networks.
Direct versus Indirect Delivery
Computer Networks 22-3
Forwarding means to place the packet in
its route to its destination.
Forwarding requires a host or a router to
have a routing table
Forwarding techniques to make the size
of the routing table manageable
Next-hop method versus route method
Network-specific method versus host-
specific method
Default method
Computer Networks 22-4
Route method versus next-hop method
Computer Networks 22-5
Host –specific versus network-specific
method
• Default method
Computer Networks 22-6
In classless addressing, we need at least
four columns in a routing table
Computer Networks 22-7
Make a routing table for router R1, using the
configuration in Figure
Computer Networks 22-8
Routing table for router R1
Computer Networks 22-9
22-3 UNICAST ROUTING PROTOCOLS
•Routing table - Static or Dynamic.
•Static table is one with manual entries.
•Dynamic table is one that is updated automatically
when there is a change somewhere in the Internet.
•Routing protocol is a combination of rules and
procedures that lets routers in the Internet inform
each other of changes.
Topics discussed in this section:
Optimization
Intra- and Interdomain Routing
Distance Vector Routing and RIP
Link State Routing and OSPF
Path Vector Routing and BGP
22.10
A message delivery can be 3
types
Unicast
Multicast
Broadcast
In unicast communication, there is one
source and one destination
The relationship between the source and
the destination is one-to-one.
In this type of communication, both the
source and destination addresses in the
IP, are the unicast addresses assigned to
the hosts
Figure 22.33 Unicasting
In multicast communication,
there is one source and a
group of destination.
The relationship is one-to-
many.
Source address is a unicast.
But the destination address is
a group address (which
defines one or more
destination)
Figure 22.34 Multicasting
Note
In multicasting, the router may
forward the received packet
through several of its interfaces.
In broadcast comm., the relationship
between the source and the
destination is one-to-all.
There is only one source, but all the
other hosts are the destinations.
The internet does not explicitly
support broadcasting bcoz of the
huge amount of traffic it would create
and bcoz of the bandwidth it would
need.
Eg. Tv, radio broadcasting
Multicasting starts with one single packet
from the source that is duplicated by the
routers. The destination address in each
packet is the same for all duplicates.
In multiple unicasting, several packets
start from the source, if there are 5
destination, for e.g., the source sends 5
packets, each with a different unicast
destination address.
Figure 22.35 Multicasting versus multiple unicasting
Routing Protocol
• Combination of rules and procedures
• Lets routers in an internet inform each other of changes.
• Routers share whatever they know about the internet or their
neighbourhood.
Routing Algorithm
• Network layer software 20
a)Routing requires a host or a router to have a routing table.
b)Usually when a host has a packet to send or when a router has received a
packet to be forwarded, it looks at this table to find the route to the final
destination.
c)However, this simple solution is impossible in today’s Internet world because
the number of entries in the routing table makes the table lookups inefficient.
d)Need to make the size of table manageable and handles issues such security at
the same time. The key question is how to design the routing table.
e)Next-hop routing, Network-specific routing, host specific routing
f) 21
Which of the available pathways is the optimum
pathway ?
One approach is to assign a cost for passing
through a network, called metric
Total metric is equal to the sum of the metrics
of networks that comprise the route
Router chooses the route with shortest
(smallest) metric
RIP (Routing Information Protocol): hop count
OSPF (Open Shortest Path First): allows
administrator to assign a cost based on the
type of service required
BGP (Border Gateway Protocol): criterion is the
policy
Computer Networks 22-22
Fact:
Nobody owns the whole Internet.
However, parts of the Internet are owned and administered by
commercial and public organisations (such as ISPs, universities,
governmental
Idea: offices, research institutes, companies etc.).
Divide the Internet in Autonomous Systems (AS) that are
independently administered by individual organisations. Let each
administrative authority use its own routing protocol within the AS.
23
Intra- and Interdomain Routing
• One routing protocol cannot handle the task of updating the
routing tables of all routers in Internet is so large that. For
this reason, an internet is divided into autonomous systems.
• An autonomous system (AS) is a group of networks and
routers under the authority of a single administration.
• Routing inside an autonomous system is referred to as
intradomain routing.
• Routing between autonomous systems is referred to as
interdomain routing.
• Each autonomous system can choose one or more intradomain
routing protocols to handle routing inside the autonomous system.
However, only one interdomain routing protocol handles routing
between autonomous systems (see Figure 22.12). 22.24
Intra- and Interdomain Routing
22.25
Example of Routing Protocols
22.26
The least cost route between any two
nodes is the route with minimum
distance.
In this protocol, as the name implies,
each node maintains a vector (table) of
minimum distances to every node.
The table at each node also guides the
packets to the desired by showing the
next stop in the route (next hop routing)
The whole idea of distance vector
routing is the sharing info between
neighbors
Let A connect to B and B connect to C.
A don’t know about C. But B does.
So if node B shares the routing table
with A, so node A also know how to
reach node C.
a)3 keys to understand how this algorithm works:
• Sharing knowledge about the entire AS. Each router
shares its knowledge about the entire AS with
neighbours. It sends whatever it has.
• Sharing only with immediate neighbours. Each router
sends whatever knowledge it has thru all its interface.
• Sharing at regular intervals. sends at fixed intervals,
e.g. every 30 sec.
29
Distance vector routing tables
• In distance vector routing, each node shares its routing table
with its immediate neighbors periodically and when there is a
change.
• The chosen route is with minimum distance. 22.30
At the beginning, each node can know only the
distance between itself and its immediate neighbors
Computer Networks 22-31
In distance vector routing, each node shares its routing
table with its immediate neighbors periodically and when
there is a change
Computer Networks 22-32
When a node receives a two-column table from a neighbor, it need to update its routing table
Updating rule:
Choose the smaller cost. If the same, keep the old one
If the next-node entry is the same, the receiving node chooses the new row
Computer Networks 22-33
Updating in distance vector routing
• Process:
i. Initialization
• Each node can know only distance with its
immediate neighbors.
• No neighbor; entry in table is mark as
infinite(unreachable)
ii. Sharing
• Sharing table with neighbors.
iii.Updating
• Update the routing table: calculate the
distance, add new node, modify the existing
record if needed.
22.34
Periodic update: A node sends its routing table, normally every 30 s
Triggered update: A node sends its two-column routing table to its neighbors anytime
there is a change in its routing table
Two-node instability
Computer Networks 22-35
Defining infinity: To redefine infinity to a smaller number, such as 100
Split horizon: Instead of flooding the table through each interface, each
node sends only part of its table through each interface. Node B
eliminates the last line of its routing table before it sends it to A
Split horizon and poison reverse: Node B can still advertise the value
for X, but if the source of information is A, it can replace the distance
with infinity as a warning: “Do not use this value, what I know about
this route comes from you.”
Computer Networks 22-36
If the instability is between three
nodes, stability cannot be guaranteed.
Computer Networks 22-37
A router consults a routing table when a packet is ready to be
forwarded
The routing table specifies the optimum path for the packet: static or
dynamic
Internet needs dynamic routing tables to be updated as soon as there
is a change
Routing protocols is a combination of rules and procedures for
dynamic routing tables
The routing protocols also include procedures for combining
information received from other routers
Unicast routing and multicasting routing
RIP (Routing Information Protocol), OSPF (Open Shortest Path First),
BGP (Border Gateway Protocol)
Computer Networks 22-38
a)RIP is based on distance vector routing, which uses the Bellman-Ford
algorithm for calculating the routing table.
b)RIP treats all network equals; the cost of passing thru a network is the same:
one hop count per network.
c)Each router/node maintains a vector (table) of minimum distances to every
node. (the least-cost route btw any nodes is the route with the minimum
number of hop-count).
d)The hop-count is the number of networks that a packet encounters to reach its
destination. Path costs are based on number of hops.
e)In distance vector routing, each router periodically shares its knowledge about
39
RIP: an intradomain routing protocol used inside an AS
Simple protocol based distance vector routing
Metric is simple, a hop count. The distance is defined as the number
of links (networks) to reach the destination
22-40 Computer Networks
22-41 Computer Networks
Computer Networks 22-42
Initial routing tables in a small
autonomous system
Final routing tables for the previous figure
a) Like RIP, in link state routing, each router also shares its knowledge about its
neighbourhood with every routers in the area.
b)However, in LSR, the link-state packet (LSP) defines the best known network topology (of
an area) is sent to every routers (of other area) after it is constructed locally. Whereas RIP
slowly converge to final routing list based information received from immediate
neighbours.
c) 3 keys to understand how this algorithm works:
• Sharing knowledge about the neighbourhood. Each router sends the state of its
neighbourhood to every other router in the area.
• Sharing with every other routers. Thru process of flooding. each router sends the
state of its neighbourhood thr all its output ports and each neighbour sends to every
45
Link State Routing (LSR)
• Link state routing has a different philosophy from
distance vector routing.
• Each node in the domain has the entire topology of
the domain- the list of nodes and links, how they are
connected including the type, cost (metric), and
condition of the links (up or down)-the node can use
• Dijkstra's algorithm to build a routing table.
22.46
Figure 22.20 Concept of link state routing
22.47
Figure 22.21 Link state knowledge
The topology must be dynamic, representing the latest state of each node and
each link. If there are changes in any point in the network (a link is down), the
topology must be updated for each node.
Node A knows that it is connected to node B with metric 5. To node C with
metric 2, to D with metric 3.
Creation of the states of the links by each node,
called the link state packet (LSP)
Dissemination of LSPs to every other router called
flooding
Formation of a shortest path tree for each
node
Calculation of a routing table based on the
shortest path tree
Node identity (to make the topology)
List of links (to make the topology)
Sequence number (flooding/distinguish new LSP from
old ones)
Age (prevents old LSPs from remaining in the domain for
a long time.)
• LSPs are generated (1) when there is a change in the
topology of the domain, (2) on a periodic basis,
normally 60 min or 2 h
The creating node sends a copy of the LSP out of
each interface
A node compares it with the copy it may already
have. If the newly arrived LSP is older than the
one it has, it discards the LSP. If it is newer,
1.It discards the old LSP and keeps the new one
2.It sends a copy of it out of each interface except
the one from which the packet arrived
After receiving all LSPs, each node will have a copy of
the whole topology.
However, the topology is not sufficient to find the
shortest path to every other node; a shortest path tree
is needed.
A tree is a graph of nodes and links.
A shortest path tree is a tree in which the path
between the root and every other node is the shortest.
Figure 22.22 Dijkstra algorithm
22.53
Figure 22.23 Example of formation of shortest path tree
22.54
Each node uses the shortest path tree protocol to construct
its routing table
The routing table shows the cost of reaching each node from
the root
22-55 Computer Networks
a)OSPF uses link state routing to update the routing table in an area; OSPF
divides an AS into different areas (depending on their type).
b)Unlike RIP, OSPF treats the entire network within differently with different
philosophy; depending on the types, cost (metric) and condition of each
link: to define the ‘state’ of a link.
c)OSPF allows the administrator to (only) assign a cost for passing through a
network based on the type of service required. e.g. minimum delay,
maximum throughput. (but not stating exact path)
d)Each router should have the exact topology of the AS network(a picture of
entire AS network) at every moment. The topology is a graph consisting of
56
Popular intradomain routing protocol based on link state routing
To handle routing efficiently and in a timely manner, OSPF divides an autonomous
system into area
Area is a collection of network, hosts, and routers all contained within an AS
AS can also be divided into many different areas
Area border gateway, backbone router, virtual link
Computer Networks 22-57
Figure 22.24 Areas in an autonomous system
22.58
The OSPF allows the administrator to assign a cost, called the metric, to each route
The metric can be based on a type of service (minimum delay, maximum throughput,
and so on)
Computer Networks 22-59
Figure 22.25 Types of links
22.60
Figure 22.26 Point-to-point link
• To connect two routers without any other host or
router in between
22.61
Figure 22.27 Transient link
• A network with several routers attached to it
22.62
Figure 22.28 Stub link
• Stub link is a network that is connected to
only one router
• Virtual link created for broken link by
administrator
• When the link between two routers is broken, the administrator may create a virtual link
between them using longer path that probably goes through several routers
22.63
Figure 22.29 Example of an AS and its graphical representation in OSPF
22.64
a)Border Gateway Protocol (BGP) is an inter-domain or inter-
autonomous system routing protocol: routing between different
ASs.
b)BGP uses path vector routing to update the routing table in an
area.
c)DVR and LSR are not suitable candidates for inter-AS routing :
• DVR: there are occasions in which the route with the smallest
hop count is not the preferred route; non-secure path although
65
d)PVR defines the exact paths as an ordered list of ASs that a
packet should travel thru to reach the destination (besides
having the destination network and next router info.) in its
routing table.
e)Security and Political issues involved: more desired to
avoid ‘unsaved’ paths/routes/ASs than to take a shorter
route.
f) 66
• Distance vector routing is subject to instability if there are more than
a few hops in the domain of operation
• Link state routing needs a huge amount of resources to calculate
routing tables. It also create heavy traffic because of flooding
• Need for a third routing algorithm for interdomain routing, called
path vector routing
• Path vector routing is similar to distance vector routing
• But, only speaker node creates a routing table and advertises it to
22-67 Computer Networks
Figure 22.30 Initial routing tables in path vector routing
22.68
• Sharing: Like distance vector routing, a speaker shares its table
with immediate neighbors
• Updating: When a speaker receives a two-column table from a
neighbor, it updates its own table
• Loop prevention
• Policy routing
• Optimum path
22-69 Computer Networks
a)Policy routing can be easily implemented through path vector routing.
b)When a router receives a message from its neighbour, the speaker node or AS
boundary router can check the path with its approved list of ASs.
c)If one of the ASs listed in the path is against its policy, the router can ignore that
path entirely and that destination.
d)For any unapproved paths, the router does not update its routing table with this
path, and it does not send the PV message to its neighbours.
e)This means that the routing table in path vector routing are not based on the
smallest hop count (as in distance vector routing) or the minimum delay metric
(as in open shortest path first routing); they are based on the policy imposed on
70
Interdomain routing protocol using path
vector routing
Types of autonomous systems (ASs)
Stub AS: only one connection to another AS
Multihomed AS: more than one connection
to other Ass, but still only a source or sink
for data traffic
Transit AS: a multihomed AS that also
allows transient traffic
Computer Networks 22-71
Path attribute
Well-known attribute
Well-known mandatory attribute:
ORIGIN (source of the routing information)
AS_PATH (the list of ASs)
NEXT-HOP(the next router)
Well-known discretionary attribute
Optional attribute
Optional transitive attribute
Optional nontransitive attribute
Computer Networks 22-72
A session is a connection between BGP routers for the exchange of router information
To create a reliable environment, BGP uses the services of TCP as semipermanent
connections
External and internal BGP
E-BGP sessions: used to exchange information between two speaker nodes belonging to
two different ASs
I-BGP sessions: used to exchange information between two routers inside an AS
Computer Networks 22-73
Figure 22.32 Internal and external BGP sessions
22.74
Thank you !!!