Professional Documents
Culture Documents
Packet Switches
In order to grow, WANs use many switches
Basic component is the packet switch that
can connect to local computers and to
other packet switches
WAN topology
Chosen to accommodate expected traffic
and to provide redundancy
[1,2] A
address
[1,5] B
D [2,6]
switch 1
switch 2
[1,2]
A
S3
S1
B
[1,5]
D
[3,5]
S2
E
[2,1]
F
[2,6]
Routing in a WAN
Large WANs use interior switches and exterior
switches
Their routing tables must guarantee that
Universal routing - there must be a next hop for
every possible destination
Optimal routes - the next hop must point to the
shortest path to the destination
Default routes
A routing table may be simplified by including
(at most) one default route
Switch 1
Destn next hop
1
*
interface 3
Switch 2
Destn next hop
2
4
interface 4
*
interface 3
Switch 3
Destn next hop
3
interface 2
interface 3
4
interface 4
Dijkstras algorithm
S = set of nodes, labelled with current distance
from source, but for which minimum distance
is not yet known
Initialise S to everything but the source
Iterate:
select the node, u, from S that has smallest current
distance from source
examine each neighbour of u and if distance to
the neighbour from source is less via u than is
currently recorded in S then update
Implementation
Data structure to store information about the
graph (nodes and edges)
Integer labels for the nodes [1..n]
Three data structures:
current distance to each node - array - D[1..n]
next hop destination for each node array - R[1..n]
set S of remaining nodes - linked list - S
Given:
a graph with nonnegative weight assigned to each edge
and a designated source node
Compute:
the shortest distance from the source node to
each other node and a next-hop routing table
Method:
Initialise the set S to contain all nodes except
the source
Initialise D so that D[u] = weight(source, u)
Initialise R so that R[v] = v if there is an edge
from the source to v and zero otherwise
Example
S = { 1, 2,
1
Distance D
2 3 4 5 6
3,
7
4, 5,
Example
S = source = 6
6,
7 }
8X
5
S = { 1, 2,
3,
4, 5,
Distance D
3 4 5 6
2
X
13
6,
7 }
Given:
a local routing table, a weight for each link that connects
to another switch and an incoming routing message
Compute:
an updated routing table
Method:
maintain a distance field in each routing table entry
initialise routing table with a single entry that has the
destination equal to the local packet switch, the next hop
unused and the distance set to sero
Repeat forever {
wait for the next routing message to arrive over the network;
let the sender be switch N
for each entry in the message {
let V be the destination in the entry and D the distance
compute C as D plus the weight of the link over which
the message arrived
examine and update the local routing table {
if ( no route exists to V ) {
add an entry to the local table for V
with next hop N and distance C
} else if ( a route exists with next hop N ) {
replace existing distance with C
} else if (route exists with distance > C )
change next hop to N and distance to C
}
}
}