Routing Algorithms
Routing Algorithms
COMPUTER NETWORKS
Networking Standards
(Network LAYER)
Network Layer
Question to be answered ?
Computer Networks 2
Network Layer
Network Layer
- The network layer is concerned with
getting packets from the source all
the way to the destination.
- Therefore, the main function (goal)
of network layer is routing packets
from the source machine to the
destination machine.
Computer Networks 3
Network Layer
To achieve its goal the network layer
must:
1- Know about the topology of the
communication subnet.
2- Choose appropriate paths through the
subnet.
3- Avoid overloaded communication lines
and routers (avoid congestion).
Computer Networks 4
Store-and-Forward Packet Switching
fig 5-1
Computer Networks 6
Network Layer
Computer Networks 7
Implementation of Connectionless Service
5-4
Network Layer
Routing Algorithms
Computer Networks 11
Network Layer
Routing Algorithms
Computer Networks 12
Network Layer
Routing Algorithms
Computer Networks 16
Network Layer
Routing Algorithms
Computer Networks 17
Network Layer
Routing Algorithms
Computer Networks 18
Network Layer
Routing Algorithms
Computer Networks 19
Network Layer
Shortest Path Routing
- The technique that is used in many
routing algorithms is simple and easy to
understand.
- The idea is to build a graph of the subnet,
with each node of the graph representing
a router and each arc of the graph
representing a communication line
(link). To choose a route between a given
pair of routers, the algorithm just finds the
shortest path between them on the graph.
Computer Networks 20
Network Layer
Shortest Path Routing
B 7 C
Metric is number of hops
2
- The path ABC is equal to
3
2 E 2 F 3 path ABE.
A D
1 2
Metric is the distance in km
6 4
2 - the path ABC is longer than
H the path ABE
G
Computer Networks 21
Network Layer
Shortest Path Routing
Computer Networks 22
Network Layer
Shortest Path Routing
Computer Networks 24
Collection of Subnetworks
z
w x y
A D B
C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Routing table in D
4. RIP (4) : Example
Dest Next hops Advertisement
w - 1 from A to D
x - 1
z C 4 z
…. … ...
w x y
A D B
C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z BA 75
x -- 1
…. …. ....
Routing table in D
4. RIP (5): Link Failure and Recovery
routed routed
Transport Transport
(UDP) (UDP)
network forwarding network
forwarding table (IP)
(IP)
link table link
physical physical
4. OSPF (1) (Open Shortest Path First)
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
eBGP session
iBGP session
5. BGP (3): Distributing reachability info
•With eBGP session between 3a and 1c, AS3 sends prefix reachability info to
AS1.
•1c can then use iBGP do distribute this new prefix reach info to all routers in
AS1.
•1b can then re-advertise the new reach info to AS2 over the 1b-to-2a eBGP
session.
•When router learns about a new prefix, it creates an entry for the prefix in its
forwarding table.
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
eBGP session
iBGP session
5. BGP (4): Path attributes & BGP routes
• When advertising a prefix, advert includes BGP attributes.
– prefix + attributes = “route”
• Two important attributes:
– AS-PATH: contains the ASs through which the advert
for the prefix passed: AS 67 AS 17
– NEXT-HOP: Indicates the specific internal-AS router
to next-hop AS. (There may be multiple links from
current AS to next-hop-AS.)
• When gateway router receives route advert, uses import
policy to accept/decline.
5. BGP (5): route selection
• Router may learn about more than 1 route to some prefix.
Router must select route.
• Elimination rules:
1. Local preference value attribute: policy decision
2. Shortest AS-PATH
3. Closest NEXT-HOP router: hot potato routing
4. Additional criteria
5. BGP (6): messages