BGP Unicast Routing
BGP Unicast Routing
Unicast
Routing
20-1 INTRODUCTION
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
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
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
20.9
Figure 20.4: The distance vector corresponding to a tree
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
20.15
Figure 20.9: LSPs created and sent out by each node to build LSDB
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
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
20.20
Figure 20.11: Spanning trees in path-vector routing
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
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
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)
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
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
20.34
Figure 4.73: Example of an autonomous system using RIP (Part III) S
20.35
20.3.3 Open Shortest Path First
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
20.38
Figure 20.21: Areas in an autonomous system
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
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