Networks Lecture 15

ICMP

ICMP = Internet Control Message Protocol

Generally used for reachability messages:

ICMP type Code Meaning
0 0 Reply echo (ping)
8 0 Request echo (ping)
3 various Network/host/port unknown or unreachable
4 0 source quench for congestion control (generally not used)
11 0 TTL expired
12 0 IP header invalid

Routing

Routing: find a path through the graph of intermediate routers in order to forward a datagram to its destination.

Model: weighted graph. Vertices of graph are routers. Edges are network links. Edge weights are the cost associated with network link. Higher weight = higher cost. The "cost" may represent economic cost, capacity, geographical distance, or any other metric representing the desirability of using the link.

Routing algorithms find the minimum weight path from source to destination.

Global vs. distributed routing

Global routing algorithm: each router starts with a complete picture of network toplogy and link costs. Requires broadcast (flooding) when link costs change.

Distributed routing algorithm: routers communicate only with their immediate neighbors. They learn about paths to other nodes (and associated costs) only indirectly.

Link State Routing

A global routing algorithm. Starting from a complete model of the network (topology and link costs), each node uses Dijkstra's algorithm to compute the shortest path to each other node. The forwarding table is built by using the first hop on the shortest path to each destination.

Dijkstra's algorithm:

// Find minimum cost paths to all destination nodes from
// source node u.

LinkState(N,u)

   N' = { u }

   foreach node v
      if IsNeighbor(u,v) then
         D(v) = cost(u,v)
      else
         D(v) = infinity

   do
      find w such that (w not in N') and D(w) is minimum
      add w to N'
      for each neighbor v of w where (v not in N')
         D(v) = min(D(v), D(w) + cost(w,v))
         if (D(w) + cost(w,v) < D(v))
            p(v) = w
            D(v) = D(w) + cost(w,v)
   until N' = N

At each step we look at the closest node to the source node (least cost)

We know that there is not a lower cost to the destination through a different node (other than the closest node): if there were it would have to be closer.

Example:

At node A:

step  D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) D(G),p(G) N'
----------------------------------------------------------------------
0     3,A       1,A       -         -         -         -         u
1     3,A       1,A       3,C       4,C       -         -         u,C
2     3,A                 3,C       4,C       -         4,B       u,C,B
3                         3,C       4,C       -         4,B       u,C,B,D
4                                   4,C       6,E       4,B       u,C,B,D,E
5                                             5,G       4,B       u,C,B,D,E,G
6                                             5,G                 u,C,B,D,E,G,F

To forward to a host, trace backwards from destination using p(v) field. E.g., path to node F

A -> B -> G -> F

Distance Vector Routing

A distributed routing algorithm. Based on distance vectors. A distance vector contains the distances to all other nodes in the network. Each node maintains its own distance vector, and also has the distance vectors of each of its immediate neighbors.

The algorithm is based on the Bellman-Ford equation:

dx(y) = min { cost(x,v) + dv(y) } over all v in N

where dx(y) is the minimum-cost path from x to y.

Initially, a node starts with its distance vector containing the link costs to its immediate neighbors. It does not know its neighbors' distance vectors, so it assumes that they contain only infinite-cost entries to other nodes.

The algorithm works iteratively. Each node starts by sending its own distance vector to its immediate neighbors.

Any time a node receives a distance vector from a neighbor, it recomputes its own distance vector according to the Bellman-Ford equation. If the node's distance vector does change, it forwards its new distance vector to each of its neighbors.

Count To Infinity

Distance vector routing can be slow to learn of increases in link cost.

E.g.: the cost of the link from X to Y increases from 4 to 60

The increase causes Y to believe that the best path to reach node X is by routing through Z. However, Z's route to X is through Y, so this creates a routing loop. Y and Z will exchange distance vectors repeatedly, and with each exchange the perceived cost of the route to X increases by 1 (because the cost of the X-Y link is 1). This is known as the count to infinity problem.

Poisoned Reverse

Poisoned reverse can solve the count to infinity problem for routing loops of 2 nodes. In poisoned reverse, whenever a node P routes to a remote node Q via a neighbor N, the distance vector it sends to N has the cost of reaching node Q as infinity. This prevents N from trying to route through P in order to reach Q.

Poisoned reverse does not solve the count to infinity problem for routing loops involving three or more nodes. Therefore, it is not a general solution to the problem of routing loops in distance vector algorithms.