Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
1
4.2 Routing Algorithms
A routing algorithm decides which output link an incoming packet should be transmitted onEvery host is connected to a default routerIf the destination host is not directly connected, the packet is transferred to this default (first hop) router
2
Simple routing
Destination directly connected?If not send packet to default router
3
Shortest Path Routing
For a pair of communicating hosts, there is a shortest path between themShortness may be defined by:
Number of router/switch hopsGeographic distanceLink delayCost
4
Routing Algorithms (cont’d)
Two types of routing algorithms:
Global Routing Algorithms– Complete state information is used in routing decisions
Decentalized Routing Algorithms– Local/neighborhood state
Hierarchical Routing is used to make these algorithms scale to large networks
5
Routing Algorithms
Static routing algorithms do not base their routing decisions on the current state of the network
FloodingDynamic routing
Route path changes as link cost changes
6
Shortest Path
A
B
C E
FD3
1
24
2
3
2
Edge Weight(Distance)
What is the shortest path between A and F?
1
7
Computing the Shortest PathDijkstra’s Shortest Path Algorithm:
Step 1: Draw nodes as circles. Fill in a circle to mark it as a“permanent node.”Step 2: Set the current node equal to the source nodeStep 3: For the current node:
– Mark the cumulative distance from the current node to each non-permanent adjacent node. Also mark the name of the current node. Erase this marking if the adjacent node already has a shorter cumulative distance marked
– Mark the non-permanent node with the shortest listed cumulative distance as permanent and set the current node equal to it. Repeat step 3 until all nodes are marked permanent.
8
Dijskstra’s Shortest Path AlgorithmExample
A
B
G
E F
C
H
D
7
4
2
2
6
1
2 3
2
3
2
9
Graph model of a network
B
ED
C
FA
1
2
5
32 3
12
51
10
Link State Routing
Each router measures the distance (in delay, hop count, etc.) between itself and its adjacent routers
The router builds a packet containing all these distances. The packet also contains a sequence number and an age field.
Each router distributes these packets using flooding
11
Link State Routing (cont’d)
To control flooding, the sequence numbers are used by routers to discard flood packets they have already seen from a given routerThe age field in the packet is an expiration date. It specifies how long the information in the packet is good for.Once a router receives all the link state packets from the network, it can reconstruct the complete topology and compute a shortest path between itself and any other node using Dijsktra’s algorithm.
12
Hierarchical Routing
All routing algorithms have difficulties as the network becomes largeFor large networks, the routing tables grow very quickly, and so does the number of flood packetsHow can this be reduced? Hierarchical routing
13
Hierarchical Routing (cont’d)
Segment the network into regionsRouters in a single region know all the details about other routers in that region, but none of the details about routers in other regionsAnalogy: Telephone area codes
14
Hierarchical Routing (cont’d)
15
OSPF
Open Shortest Path FirstRouting algorithm now used in the InternetOSPF uses the Link State Routing algorithm with modifications to support:
Multiple distance metrics (geographical distance, delay, throughput)Support for real-time trafficHierarchical routingSecurity
16
OSPF (cont’d)
OSPF divides the network into several hierarchies:
Autonomous Systems (AS’s)– groups of subnets
Areas– Groups of routers within an AS
Backbone Areas– Groups of routers that connect other areas together
17
OSPF (cont’d)
AreaArea
BackboneArea
Autonomous System
Area
Area
BackboneArea
Autonomous System
Area
18
OSPF (cont’d)
Routers are distinguished by the functions they perform
Internal routers– Only route packets within one area
Area border routers– Connect to areas together
Backbone routers– Reside only in the backbone area
AS boundary routers– Routers that connect to a router outside the AS
19
OSPF: Modified Link State Routing
Recall:In link state routing, routers flood their routing information to all other routers in the network
In OSPF, routers only send their information to “adjacent routers”, not to all routers.Adjacent does NOT mean nearest-neighbor in OSPFOne router in each area is marked as the “designated router”Designated routers are considered adjacent to all other routers in the areaOSPF combines link state routing with centralized adaptive routing
20
OSPF: Adjacency
A
B
C
D
E
DesignatedRouter
Area
F
To backbonearea
Example:C is “adjacent” to B but not to A or EB is “adjacent” to all routers in the area
21
Distributed Routing Algorithms
Each router periodically exchanges routing information (e.g., estimated time delay, queue length, etc.) with its neighborsExamples:
Distance Vector RoutingRIP
22
Distance Vectors
Each router maintains lists of best-known distances to all other known routers. These lists are called “vectors.”Each router is assumed to know the exact distance (in delay, hop count, etc.) to other routers directly connected to it.Periodically, vectors are exchanged between adjacent routers, and each router updates its vectors.
23
Distance Vectors (cont’d)
24
Problem: Count-to-Infinity
With distance vector routing, good news travels fast, but bad news travels slowlyWhen a router goes down, it takes can take a really long time before all the other routers become aware of it
25
Count-to-InfinityA B C D E
1 2 3 4
3 2 3 4
3 4 3 4
5 4 5 4
5 6 5 6
7 6 7 6
Initially
After 1 exchange
After 2 exchanges
After 3 exchanges
After 4 exchanges
After 5 exchanges
etc… to infinity
26
Improvements
Split HorizonDon’t tell neighbor about routes obtained from it
Or never advertise a route out of the interface you learnt it
Poison reverseAdvertise network unreachable back through the same interface you learnt about it
advertising all network IDs, but those network IDs learned in a given direction are advertised with a metric of 16, indicating that the network is unavailable.
Triggered updates as opposed to periodic updates
Path vectors, Store vectors or complete path as opposed to just next hop
27
RIP
Route Information ProtocolOne of the routing algorithms used by the InternetBased on distance vector routingDid not scale well, and it suffered the count-to-infinity problemRIP is slowly being phased out
28
Recent Developments: IPv6
IPv4 (the standard IP protocol) has limited address spaceMost importantly, IP is running out of addresses. 32 bits is not enough.Real-time traffic and mobile users are also becoming more common
IP version 6(Also called IPng, or IP next generation)
29
IPv6: The Changes
Large address space:128-bit addresses (16 bytes)Allows up to 340,282,366,920,938,463,463,374,607,431,768,211,456unique addresses
Fixed length headers (40 bytes)Improves the speed of packet processing in routers
30
IPv6 header
Flow label: can be used to label all packets with a certain property for special handlingDS/ECN for indicating type of service
Source Address
Version (4) DS/ECN (8) Flow Label (20)
Payload (16) Next header (8) Hop limit (8)
Destination Address
31
IPv6: The Changes (cont’d)
Support for “flows”Flows help support real-time service in the InternetA “flow” is a number in the IPv6 header that can be used by routers to see which packets belong to the same streamGuarantees can then be assigned to certain flowsExample:
– Packets from flow 10 should receive rapid delivery– Packets from flow 12 should receive reliable delivery