Vous êtes sur la page 1sur 12

Routing

ETSN01 Advanced Telecommunications

Emma Fitzgerald
2015
Routing and Forwarding

Routing is the process of selecting the best end-to-end path


through a network.
Forwarding is the process of selecting the next hop for a packet.

Lund University Slide 2 of 12


Dijkstras Algorithm

Algorithm to find the shortest path through a graph


Dijkstra invented it in about 20 minutes without the aid of
pen or paper to demonstrate the capabilities of the ARMAC
computer
Traverses through a graph, starting with an initial node, and
iteratively updates estimates of the shortest paths to all other
nodes
Can either traverse the entire graph, or stop when we reach
some target node

Lund University Slide 3 of 12


Dijkstras Algorithm

1. Assign tentative distance estimate to each node: 0 for the


initial node, for all other nodes
2. Mark all nodes except the initial node as visited. Set initial
node as current node.
3. For the current node, iterate through its unvisited neighbours
and calculate their distance. Compare to the current distance
value and take whichever is smaller as the new value.
4. Mark the current node as visited.
5. If we have reached the target node or there are no more
unvisited nodes with distance < , stop. Otherwise, set the
unvisited node with the smallest distance as the new current
node and go back to step 3.

Lund University Slide 4 of 12


The Bellman-Ford Algorithm

In Dijkstras algorithm, edge weights must be non-negative.


The Bellman-Ford algorithm is also used to compute the
shortest path.
Slower than Dijkstras but works even with negative weights
and in cases where we do not have complete information at
the start.
Dijkstras algorithm starts at the source and builds up the
shortest path step-by-step. In the Bellman-Ford algorithm,
first we find all shortest paths with one edge, then two edges,
and so on until we have covered the whole graph.

Lund University Slide 5 of 12


The Bellman-Ford Algorithm

1. Set the distance for the source node to 0 and for all other
nodes to . Set the predecessor of all nodes to null.
2. Iterate through each edge (u, v). If the distance from u to v,
plus the edge weight, is less than the current distance to v, we
have discovered a shorter path to v. Set the distance to v to
this new value and the predecessor of v to u.
3. Repeat step 2 N 1 times, where N is the number of nodes
in the graph. (N 1 is the maximum length of a non-cyclic
path.)
4. For each edge (u, v) in the graph, if the distance to u plus the
edge weight is less than the distance to v, the graph contains
a negative-weight cycle. Terminate.
5. Otherwise, we have found the shortest paths to each node
from the source.
Lund University Slide 6 of 12
Routing

Static routing: manually configured tables


Dynamic routing
Distance vector routing
Link state routing
Each node has a routing table that contains the cost to each
destination and the next hop for each.

Lund University Slide 7 of 12


Distance Vector Routing

Uses the Bellman-Ford algorithm


Nodes begin only with knowledge of their immediate
neighbours and the costs to reach them.
Nodes then send this information (the routing table)to their
neighbours.
If a neighbour sends us a route that is shorter than one we
already have, update our table to reflect this.
After updating, send the new table to our neighbours.
If a node goes down, discard any lines in the routing table
that have it as the next hop and follow the above to find a
new route.

Lund University Slide 8 of 12


Link State Routing

Uses Dijkstras algorithm


Each node floods the network with the list of nodes it can
connect to and the costs to them.
Every node builds up a picture of the entire network, then can
use Dijkstras algorithm to determine the shortest path to
each destination.
The routing table is then constructed based on the computed
shortest paths.

Lund University Slide 9 of 12


Path Vector Routing

Both distance vector and link state routing are only used
within a single autonomous system (typically a network run by
a single provider).
These protocols do not scale well to large networks such as
the internet.
Between autonomous systems, we use a variant of distance
vector routing called path vector routing. Each autonomous
system has a speaker node.
Only speaker nodes communicate across the AS boundary,
and exchange information about which destinations they can
reach and the paths to them.

Lund University Slide 10 of 12


IP Addresses

On the internet, routing destinations are described by Internet


Protocol addresses.

32 bits for IPv4, 128 bits for IPv6


(e.g. 2001:db8:0:1234:0:567:8:1)
Lund University Slide 11 of 12
CIDR

IP addresses are hierarchical. Each address belongs to s


subnet.
Originally, the subnet part of the address had a fixed length
depending on the address class.
With the introduction of classless inter-domain routing
(CIDR), the subnet could be any length.
Subnet addresses are written with a suffix indicating the
number of bits in the subnet, e.g. 192.168.2.0/24 (IPv4) or
2001:db8::/32 (IPv6).
Destinations in a routers routing and forwarding tables may
be full IP addresses or subnets.
A destination IP address will then be matched to the most
specific destination in the table when making forwarding
decisions.
Lund University Slide 12 of 12

Vous aimerez peut-être aussi