Unicast Routing
Unicast Routing
Unicast Routing
20.1 INTRODUCTION
20.4
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
The question is what other routers the packet should visit?
20.5
Figure 20.1: An internet and its graphical representation
20.7
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.8
20-2 ROUTING ALGORITHMS
20.10
Figure 20.3: Graphical idea behind Bellman-Ford equation
20.11
Figure 20.4: The distance vector corresponding to a tree
A distance vector does not give the path to the destinations as the least-cost
tree does; it gives only the least costs to the destinations.
20.12
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.
For example, 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
20.14
Table 20.1: Distance-Vector Routing Algorithm for A Node S
20.15
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.16
20.2.2 Link-State Routing
20.20
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:
20.21
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.22
20.2.3 Path-Vector Routing
20.23
Figure 20.11: Spanning trees in path-vector routing
20.25
Figure 20.13: Updating path vectors S
20.26
Table 20.3: Path-vector algorithm for a node S
20.27
20-3 UNICAST ROUTING PROTOCOLS
20.29
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.30
20.3.2 Routing Information Protocol
1 hop (N4)
20.32
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.33
Figure 20.17: RIP message format
RIP has two types of messages:
Request and Response
20.35
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.36
Figure 4.73: Example of an autonomous system using RIP (Part III) S
20.37
RIP Algorithm
20.39
Timers in RIP
RIP uses three timers to support its operation.
20.41
Performance
Before ending this section, let us briefly discuss the performance of RIP:
❑ Update Messages - The update messages in RIP have a very simple
format and are sent only to neighbours; they are local. They do not
normally create traffic because the routers try to avoid sending them at
the same time.
❑ Convergence of Forwarding Tables - RIP uses the distance-vector
algorithm, which can converge slowly if the domain is large, but, since
RIP allows only 15 hops in a domain (16 is considered as infinity), there is
normally no problem in convergence. The only problems that may slow
down convergence are count-to-infinity and loops created in the domain;
use of poison-reverse and split-horizon strategies added to the RIP
extension may alleviate the situation.
❑ Robustness - As distance-vector routing is based on the concept that
each router sends what it knows about the whole domain to its
neighbours. This means that the calculation of the forwarding table
depends on information received from immediate neighbours, which in
turn receive their information from their own neighbours. If there is a
failure or corruption in one router, the problem will be propagated to all
routers and the forwarding in each router will be affected.
20.42
20.3.3 Open Shortest Path First
20.43
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.44
Figure 20.20: Forwarding tables in OSPF
20.45
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.46
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 link.
2. Network link.
3. Summary link to network.
4. Summary link to AS border router.
5. External link.
20.47
Figure 20.22: Five different LSPs (Part II)
20.48
Figure 20.23: OSPF message formats (Part I) S
1. Hello message
Attention
2.Database description
20.49
Figure 20.23: OSPF message formats (Part II) S
Attention
20.50
OSPF Algorithm
20.51
Performance
Before ending this section, let us briefly discuss the
performance of OSPF:
❑ Update Messages. The link-state messages in OSPF
have a somewhat complex format. They also are flooded
to the whole area. If the area is large, these messages may
create heavy traffic and use a lot of bandwidth.
❑ Convergence of Forwarding Tables. When the flooding
of LSPs is completed, each router can create its own
shortest-path tree and forwarding table; convergence is
fairly quick. However, each router needs to run Dijkstra’s
algorithm, which may take some time.
❑ Robustness. The OSPF protocol is more robust than
RIP because, after receiving the completed LSDB, each
router is independent and does not depend on other
routers in the area. Corruption or failure in one router
does not affect other routers as seriously as in RIP.
20.52
20.3.4 Border Gateway Protocol
20.53
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.54
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.55
There are two problems that need to be addressed:
1. Some border routers do not know how to route
a packet destined for nonneighbour ASs. For
example, R5 does not know how to route
packets destined for networks in AS3 and AS4.
Routers R6 and R9 are in the same situation as
R5: R6 does not know about networks in AS2
and AS4; R9 does not know about networks in
AS2 and AS3.
2. None of the nonborder routers know how to
route a packet destined for any networks in
other ASs. To address the above two problems,
we need to allow all pairs of routers (border or
nonborder) to run the second variation of the
BGP protocol, iBGP.
20.56
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.
For 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.57
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.58
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.59
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.60
Figure 20.28: Forwarding tables after injection from BGP (Part I)
20.61
Figure 20.28: Forwarding tables after injection from BGP (Part II) S
20.62
Figure 20.29: Format of path attribute
20.63
The following gives a brief description of each attribute.
❑ ORIGIN (type 1) -This is a well-known mandatory attribute, which
defines the source of the routing information. This attribute can be
defined by one of the three values: 1, 2, and 3. Value 1 means that the
information about the path has been taken from an intradomain protocol
(RIP or OSPF). Value 2 means that the information comes from BGP.
Value 3 means that it comes from an unknown source.
20.64
❑ NEXT-HOP (type 3) - This is a well-known mandatory attribute, which
defines the next router to which the data packet should be forwarded.
We have also used this attribute in our examples. As we have seen,
this attribute helps to inject path information collected through the
operations of eBGP and iBGP into the intradomain routing protocols
such as RIP or OSPF.
20.65
❑ LOCAL-PREF (type 5 ) -The local preference attribute is a well-known
discretionary attribute. It is normally set by the administrator, based on
the organization policy. The routes the administrator prefers are given
a higher local preference value (an attribute value of 4-byte unsigned
integer). For example, in an internet with five ASs, the administrator of
AS1 can set the local preference value of 400 to the path AS1 → AS2 →
AS5, the value of 300 to AS1 → AS3 → AS5, and the value of 50 to AS1
→ AS4 → AS5. This means that the administrator prefers the first path
to the second one and prefers the second one to the third one. This
may be a case where AS2 is the most secured and AS4 is the least
secured AS for the administration of AS1. The last route should be
selected if the other two are not available.
❑ ATOMIC-AGGREGATE (type 6) - This is a well-known discretionary
attribute, which defines the destination prefix as not aggregate; it only
defines a single destination network. This attribute has no value field,
which means the value of the length field is zero.
❑ AGGREGATOR (type 7) - This is an optional transitive attribute,
which emphasizes that the destination prefix is an aggregate. The
attribute value gives the number of the last AS that did the aggregation
followed by the IP address of the router that did so.
20.66
Figure 20.30: Flow diagram for route selection
20.67
Messages BGP uses four types of messages for communication between
the BGP speakers across the ASs and inside an AS: open, update,
keepalive, and notification. All BGP packets share the same common
header.
❑ Open Message. To create a neighbourhood relationship, a router
running BGP opens a TCP connection with a neighbor and sends an open
message.
❑ Update Message. The update message is the heart of the BGP protocol.
It is used by a router to withdraw destinations that have been advertised
previously, to announce a route to a new destination, or both. Note that
BGP can withdraw several destinations that were advertised before, but it
can only advertise one new destination (or multiple destinations with the
same path attributes) in a single update message.
20.69
Performance