0% found this document useful (0 votes)
22 views55 pages

BGP Unicast Routing

The document discusses unicast routing and hierarchical routing. It describes how unicast routing works from source to destination hosts via routers. It also discusses least-cost routing and how networks can be modeled as weighted graphs to determine the lowest cost routes. The document introduces different routing algorithms like distance-vector routing and link-state routing. It explains how distance vectors are used to share routing information and how link-state databases are constructed through flooding to allow routers to independently calculate least-cost trees.

Uploaded by

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

BGP Unicast Routing

The document discusses unicast routing and hierarchical routing. It describes how unicast routing works from source to destination hosts via routers. It also discusses least-cost routing and how networks can be modeled as weighted graphs to determine the lowest cost routes. The document introduces different routing algorithms like distance-vector routing and link-state routing. It explains how distance vectors are used to share routing information and how link-state databases are constructed through flooding to allow routers to independently calculate least-cost trees.

Uploaded by

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

Unit 3

Unicast
Routing
20-1 INTRODUCTION

• Unicast routing in the Internet, with a large number of


routers and a huge number of hosts, can be done only
by using hierarchical routing: routing in several steps
using different routing algorithms.

20.2
20.20.1 General Idea
• In unicast routing, a packet is routed, hop by hop, from its source
to its destination by the help of forwarding tables.
• The source host needs no forwarding table because it delivers its
packet to the default router in its local network.
• The destination host needs no forwarding table either because it
receives the packet from its default router in its local network.
• This means that only the routers that glue together the networks in
the internet need forwarding tables.
• So, routing a packet from its source to its destination means
routing the packet from a source router to a destination router .

20.3
Figure 20.1: An internet and its graphical representation

An internet is modeled as a weighted graph: set of nodes (routers) and edges (networks), in
which each edge is associated with a cost.
The cost of an edge has a different interpretation in different routing protocols.
If there is no edge between the nodes, the cost is infinity.
20.20.2 Least-Cost Routing

• When an internet is modeled as a weighted graph,


one of the ways to interpret the best route from the
source router to the destination router is to find the
least cost between the two.
• In other words, the source router chooses a route to
the destination router in such a way that the total
cost for the route is the least cost among all
possible routes.

Example: In Figure 20.1, the best route between A


and E is A-B-E, with the cost of 6.

20.5
Figure 20.2: Least-cost trees for nodes in the internet of Figure 4.56

A least-cost tree
is a tree with the
source router as the
root that spans the
whole graph (visits all
other nodes) and in
which the path
between the root and
any other node is the
shortest.

20.6
20-2 ROUTING ALGORITHMS

• Several routing algorithms have been designed in


the past.
• The differences between these methods are in the
way they interpret the least cost and the way they
create the least-cost tree for each node.

20.7
20.2.1 Distance-Vector Routing
• In distance-vector routing, the first thing each node creates is its
own least-cost tree with the basic information it has about its
immediate neighbors.
• Incomplete trees are exchanged between immediate neighbors to
make the trees more and more complete and to represent the
whole internet.
• In distance-vector routing, a router continuously tells all of its
neighbors what it knows about the whole internet (although the
knowledge can be incomplete).

20.8
Figure 20.3: Graphical idea behind Bellman-Ford equation

Bellman-Ford equation is used to find the least cost (shortest distance)

Dxy min{(cxa Day), (cxb Dby), (cxc Dcy), }

Dxy min{Dxy, (cxz Dzy)}

20.9
Figure 20.4: The distance vector corresponding to a tree

Distance Vector : A one-dimensional array to represent the least-cost


tree.
Name of the distance vector defines the root.
Indexes define the destinations.
Value of each cell defines the least cost from the root to the
destination.
A distance vector does not give the path to the destinations as the least-
20.10
Figure 20.5: The first distance vector for an internet
• Each node in an internet, when it is
booted, sends some greeting
messages out of its interfaces and
discovers the identity of the
immediate neighbors and the
distance between itself and each
neighbor.
• It then makes a simple distance
vector (rudimentary) and leaves the
value of other cells as infinity.
• These rudimentary vectors cannot
help the internet to effectively
forward a packet.
• Eg: Node A thinks that it is not
connected to node G because the
corresponding cell shows infinity.
• To improve these vectors, the
nodes in the internet need to help
each other by exchanging
information.
Figure 20.6: Updating distance vectors

After each node has created its vector, it sends a


copy of the vector to all its immediate neighbors.

After a node receives a distance vector from a


neighbor, it updates its distance vector using the
Bellman-Ford equation (second case).

The figure shows two events:


In the first event, node A has sent its vector to node
B. Node B updates its vector using the cost c BA = 2.
In the second event, node E has sent its vector to
node B. Node B updates its vector using the cost c EA
= 4.

20.12
Figure 20.7: Two-node instability
Count to Infinity
If a link is broken (cost becomes infinity), every other router should
be aware of it immediately, but in distance-vector routing, this takes
some time.
Example: Two-node loop problem.
1.At the beginning, both nodes A and B know how to reach node X.
2.Suddenly, the link between A and X fails. Node A changes its
table. If A can send its table to B immediately, everything is fine.
3.The system becomes unstable if B sends its forwarding table to A
before receiving A’s forwarding table. Node A receives the update
and, assuming that B has found a way to reach X, updates its
forwarding table.
4.Now A sends its new update to B. B thinks that something has
been changed around A and updates its forwarding table.
5.The cost of reaching X increases gradually until it reaches infinity.
Then, A and B know that X cannot be reached.
The system is not stable. Node A thinks that the route to X is via B;
node B thinks that the route to X is via A. Packets destined for X
will bounce between A and B, creating a two-node loop problem.

20.13
20.2.2 Link-State Routing

A routing algorithm that directly follows our discussion


for creating least-cost trees and forwarding tables is link-
state (LS) routing.
This method uses the term link-state to define the
characteristic of a link (an edge) that represents a
network in the internet.
In this algorithm the cost associated with an edge defines
the state of the link. Links with lower costs are preferred
to links with higher costs.
if the cost of a link is infinity, it means that the link does
not exist or has been broken.
20.14
Figure 20.8: Example of a link-state database

link-state database (LSDB): The collection of states for all links.


The LSDB can be represented as a two-dimensional array(matrix) in which the value of each
cell defines the cost of the corresponding link.
There is only one LSDB for the whole internet; each node needs to have a duplicate of it to be
able to create the least-cost tree.

20.15
Figure 20.9: LSPs created and sent out by each node to build LSDB

how each node can create this


LSDB?
By flooding: Each node send LS
packet (LSP) to all its immediate
neighbors (each interface) to
collect two pieces of information
for each neighboring node:
1. The identity of the node.
2. The cost of the link.
When a node receives an LSP, it
compares the LSP with the copy it
may already have. The node check
the sequence number in both LSP
to know which one is old and
discards it, and keep the new one.

Then the node sends a copy of it out of each interface except the one from which the packet arrived. This
guarantees that flooding stops somewhere in the network (where a node has only one interface).
Each node creates the comprehensive LSDB. This LSDB is the same for each node and shows the whole
map of the internet. In other words, a node can make the whole map if it needs to, using this LSDB.
Compare link-state routing with
distance-vector routing

In the distance-vector routing algorithm, each router tells


its neighbors what it knows about the whole internet;

in the link-state routing algorithm, each router tells the


whole internet what it knows about its neighbors.

20.17
Table 20.2: Dijkstra’s Algorithm S
To create a least-cost tree for itself, using the shared LSDB, each node needs to run the
Dijkstra Algorithm:
1. The node chooses itself as the root
of the tree, creating a tree with a single
node, and sets the total cost of each
node based on the information in the
LSDB.
2. The node selects one node, among
all nodes not in the tree, which is
closest to the root, and adds this to the
tree. After this node is added to the
tree, the cost of all other nodes not in
the tree needs to be updated because
the paths may have been changed.
3. The node repeats step 2 until all
nodes are added to the tree.

20.18
Figure 20.10: Least-cost tree S

The figure shows the formation of the least-cost tree using Dijkstra’s algorithm. We need to
go through an initialization step and six iterations to find the least-cost tree.

20.19
20.2.3 Path-Vector Routing

Both link-state and distance-vector routing are


based on the least-cost goal. However, there are
instances where this goal is not the priority. For
example, assume that there are some routers in the
internet that a sender wants to prevent its packets
from going through. In other words, the least-cost
goal, applied by LS or DV routing, does not allow a
sender to apply specific policies to the route a packet
may take. To respond to these demands, a third
routing algorithm, called path-vector (PV) routing
has been devised.

20.20
Figure 20.11: Spanning trees in path-vector routing

The Figure shows a small


internet with only five
nodes. Each source has
created
its own spanning tree that
meets its policy. The
policy imposed by all
sources is to use
the minimum number of
nodes to reach a
destination.
-The spanning tree
selected by A and E is
such that the
communication does not
pass through D.
- The spanning tree
selected by B is such that
the communication does
not pass through C.

20.21
Figure 20.12: Path vectors made at booting time S

20.22
Figure 20.13: Updating path vectors S

20.23
Table 20.3: Path-vector algorithm for a node S

20.24
20-3 UNICAST ROUTING PROTOCOLS

We discuss three common protocols used in the


Internet:
1.Routing Information Protocol (RIP), based on
the distance-vector algorithm.
2.Open Shortest Path First (OSPF), based on the
link-state algorithm.
3.Border Gateway Protocol (BGP), based on the
path-vector algorithm.
20.25
20.3.1 Internet Structure

Before discussing unicast routing protocols, we need


to understand the structure of today’s Internet. The
Internet has changed from a tree-like structure, with
a single backbone, to a multi-backbone structure
run by different private corporations today.
Although it is difficult to give a general view of the
Internet today, we can say that the Internet has a
structure similar to what is shown in Figure 20.14.

20.26
Figure 20.14: Internet structure

The Internet has changed from a tree-like structure, with a single backbone, to a
multi-backbone structure run by different private corporations today.

20.27
20.3.2 Routing Information Protocol

The Routing Information Protocol (RIP) is one of the most


widely used intradomain routing protocols based on the
distance-vector routing algorithm we described earlier.
RIP was started as part of the Xerox Network System (XNS),
but it was the Berkeley Software Distribution (BSD) version
of UNIX that helped make the use of RIP widespread.
RIP is normally used in small Autonomous systems (ASs).
Autonomous systems (Ass) is an internetwork under the
control of a single organization.

20.28
Figure 20.15: Hop counts in RIP
The cost is defined as the number of hops, which means the number of networks (subnets) a
packet needs to travel through from the source router to the final destination host.

1 hop (N4)

2 hops (N3, N4)

3 hops (N2, N3, N4)

20.29
Figure 20.16: Forwarding tables
A forwarding table
in RIP is a three-
column table:
1.Address of the
destination network.
2.The address of the
next router to which
the packet should be
forwarded.
3.The cost (the
number of hops) to
reach the destination
network.

20.30
Figure 20.17: RIP message format

RIP has two types of messages:


request and response.

A request message: can ask about specific


entries or all entries. It is sent by a router that
has just come up or by a router that has some
time-out entries.

A response (or update) message can be either


solicited (asked) or unsolicited.
- A solicited response message: sent only in
answer to a request message. It contains
information about the destination
specified in the corresponding request
message.
- unsolicited response message: sent
periodically, every 30 seconds or when there
is a change in the forwarding table.

20.31
RIP Algorithm:
RIP implements the same algorithm as the distance-vector routing algorithm
Instead of sending only distance vectors, a router needs to send the whole
contents of its forwarding table in a response message.

•The receiver adds one hop to each cost and changes the next router field to the
address of the sending router.
• Each route in the modified forwarding table is called the received route and
each route in the old forwarding table the old route. The received router selects
the old routes as the new ones except in the following three cases:

1. If the received route does not exist in the old forwarding table, it should be
added to the route.
2. If the cost of the received route is lower than the cost of the old one, the
received route should be selected as the new one.
3. If the cost of the received route is higher than the cost of the old one, but the
value of the next router is the same in both routes, the received route should be
selected as the new one.
 The new forwarding table needs to be sorted according to the destination
route (mostly using the longest prefix first).
20.32
Figure 20.18: Example of an autonomous system using RIP (Part I) S
Example 20.1
Figure 20.18 shows a more realistic example of the operation of RIP in an
autonomous system. First, the figure shows all forwarding tables after all routers have
been booted.

20.33
Figure 20.18: Example of an autonomous system using RIP (Part II) S

Then we show changes in some tables when some update messages


have been exchanged.

20.34
Figure 4.73: Example of an autonomous system using RIP (Part III) S

Finally, we show the stabilized forwarding tables when there is no


more change.

20.35
20.3.3 Open Shortest Path First

Open Shortest Path First (OSPF) is also an


intradomain routing protocol like RIP, but it is
based on the link-state routing protocol we described
earlier in the chapter.
OSPF is an open protocol, which means that the
specification is a public document.

20.36
Figure 20.19: Metric in OSPF

In OSPF, like RIP, the cost of reaching a destination from the host is calculated from
the source router to the destination network.
However, each link (network) can be assigned a weight based on the throughput,
round-trip time, reliability, and so on. An administration can also decide to use the
hop count as the cost.

Total cost: 4
Total cost: 7

Total cost: 12

20.37
Figure 20.20: Forwarding tables in OSPF

Each OSPF router can create a


forwarding table after finding the
shortest-path tree between itself and the
destination using Dijkstra’s algorithm.

Comparing the forwarding tables for


the OSPF and RIP in the same AS: The
only difference is the cost values.

20.38
Figure 20.21: Areas in an autonomous system

OSPF was designed to be able to handle routing in a small or large AS.


The flooding may not create a huge volume of traffic in a large AS.
To prevent this, the AS needs to be divided into small sections called areas. Each area acts as a
small independent domain for flooding LSPs.

One of the areas in the AS is designated as the backbone area, responsible for gluing the areas
together.
The routers in the backbone area are responsible for passing the information collected by each
area to all other areas.

20.39
Figure 20.22: Five different LSPs (Part I)
OSPF requires that a router advertise the following to all neighbors for the formation of the LSDB:
•The existence of different entities as nodes.
•The different types of links that connect each node to its neighbors.
•The different types of cost associated with each link.
This means we need different types of advertisements, each capable of advertising different situations.
We can have five types of link-state advertisements:
1.Router ink.
2.Network link.
3.Summary link to network.
4.Summary link to AS border router.
5.External link.

20.40
Figure 20.22: Five different LSPs (Part II)

20.41
Figure 20.23: OSPF message formats (Part I) S

Attention

20.42
Figure 20.23: OSPF message formats (Part II) S

Attention

20.43
20.3.4 Border Gateway Protocol

The Border Gateway Protocol version 4 (BGP4) is


the only interdomain routing protocol used in the
Internet today. BGP4 is based on the path-vector
algorithm we described before, but it is tailored to
provide information about the reachability of
networks
in the Internet.

20.44
Figure 20.24: A sample internet with four ASs
In our example, data exchange between AS2, AS3, and AS4 should pass through AS1.
Each autonomous system in this figure uses one of the two common intradomain protocols, RIP or
OSPF.
Each router in each AS knows how to reach a network that is in its own AS, but it does not know
how to reach a network in another AS.
To enable each router to route a packet to any network in the internet, we install:
•External BGP (eBGP) on each border router.
-Internal BGP (iBGP), on all routers.
So, the border routers will run three routing protocols (intradomain, eBGP, and iBGP),
but other routers are running two protocols (intradomain and iBGP).

20.45
Figure20.25: eBGP operation
eBGP allows two physically connected border routers in two different ASs to form pairs of
eBGP by creating a TCP connection using the well-known port 179.
A simplified update messages sent by routers involved in the eBGP sessions.
For example, message number 1 is sent by router R1 and tells router R5 that N1, N2, N3,
and N4 can be reached through router R1.
Router R5 add this information at the end of its forwarding table.
When R5 receives any packet destined for these four networks, it can find in its
forwarding table that the next router is R1.

20.46
Figure 20.26: Combination of eBGP and iBGP sessions in our internet

The iBGP protocol is similar to the eBGP protocol in that it uses the service of TCP on
the well-known port 179, but it creates a session between any possible pair of routers
inside an autonomous system.
in this stage only four messages are exchanged.
Foe example, the first message (1) is sent by R1 announcing that networks N8 and N9
are reachable through the path AS1-AS2, but the next router is R1.

20.47
Figure 20.27: Finalized BGP path tables (Part I)
The updating process
continue. Then, each router
combines the information
received
from eBGP and iBGP and
creates a path table after
applying the criteria
for finding the best path.

20.48
Figure 20.27: Finalized BGP path tables (Part II)
The updating process
continue. Then, each router
combines the information
received
from eBGP and iBGP and
creates a path table after
applying the criteria
for finding the best path.

20.49
Figure 20.27: Finalized BGP path tables (Part III)
The updating process
continue. Then, each router
combines the information
received
from eBGP and iBGP and
creates a path table after
applying the criteria
for finding the best path.

20.50
Figure 20.28: Forwarding tables after injection from BGP (Part I) S

20.51
Figure 20.28: Forwarding tables after injection from BGP (Part II) S

20.52
Figure 20.29: Format of path attribute S

20.53
Figure 20.30: Flow diagram for route selection S

20.54
Figure 20.30: BGP messages S

20.55

You might also like