Routing Algorithm
Routing Algorithm
The main function of network layer is routing packets from the source machine to the
destination machine.
The algorithms that choose the routes and the data structures that they use are a major area of
network layer design.
The routing algorithm is that part of the network layer software responsible for deciding which
output line an incoming packet should be transmitted on.
There are two processes inside router:
1. One of them handles each packet as it arrives, looking up the outgoing line to
use for it in the routing table. This process is forwarding.
2. The other process is responsible for filling in and updating the routing tables.
That is where the routing algorithm comes into play. This process is routing.
When new connections are established, certain properties are desirable in a routing algorithm:
1) Correctness
2) Simplicity
3) Robustness
4) Stability
5) Fairness
6) Optimality
Routing algorithms can be grouped into two major classes:
1) Nonadaptive
2) Adaptive
Nonadaptive algorithm do not base their routing decisions on measurements or estimates of
the current traffic and topology. This procedure is sometimes called static routing.
Adaptive algorithm change their routing decisions to reflect changes in the topology, and
usually the traffic as well.
One can make a general statement about optimal routes without regard to network topology or
traffic.
This statement is known as the optimality principle.
It states that if router J is on the optimal path from router I to router K, then the optimal path
from J to K also falls along the same route.
As a direct consequence of the optimality principle, we can see that the set of optimal routes
from all sources to a given destination form a tree rooted at the destination.
Such a tree is called a sink tree
The goal of all routing algorithms is to discover and use the sink trees for all routers
(a) A subnet. (b) A sink tree for router B.
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 or link.
To choose a route between a given pair of routers, the algorithm just finds the shortest path
between them on the graph.
Many other metrics besides hops and physical distance are also possible.
For example, each arc could be labeled with the mean queuing and transmission delay for some
standard test packet as determined by hourly test runs.
With this graph labeling, the shortest path is the fastest path rather than the path with the
fewest arcs or kilometers.
In the general case, the labels on the arcs could be computed as a function of the distance,
bandwidth, average traffic, communication cost, mean queue length, measured delay, and other
factors
By changing the weighting function, the algorithm would then compute the “shortest” path
measured according to any one of a number of criteria or to a combination of criteria.
The first five steps used in computing the shortest path from A to D. The arrows indicate the working
node.
Flooding
Another static algorithm is flooding, in which every incoming packet is sent out on every
outgoing line except the one it arrived on.
Flooding obviously generates vast numbers of duplicate packets, in fact, an infinite number
unless some measures are taken to damp the process.
One such measure is to have a hop counter contained in the header of each packet, which is
decremented at each hop, with the packet being discarded when the counter reaches zero.
Ideally, the hop counter should be initialized to the length of the path from source to
destination.
Selective flooding , the routers do not send every incoming packet out on every line, only on
those lines that are going approximately in the right direction.
Flooding is not practical in most applications.
Complete topology and all delays are experimentally measured and distributed to every router.
Dijkstra’s algorithm can be run to find the shortest path to every other router.
When two or more routers are connected by a LAN, the situation is slightly more complicated.
LAN to which three routers, A, C, and F, are directly connected.
Each of these routers is connected to one or more additional routers.
One way to model the LAN is to consider it as a node itself. Fig(b).
Here we have introduced a new, artificial node, N, to which A, C, and F are connected.
The fact that it is possible to go from A to C on the LAN is represented by the path ANC here.
It is required by the Link State Routing algorithm that each router not have a reasonable
estimate of the delay/cost to each of its neighbors.
Send “ECHO” packet (ping) that the other side is required to send back immediately.
1. Measure Round Trip time; Divide by 2 to get an estimate.
2. More accurate estimate by repeating the process several times and by averaging
estimates.
3. Assumes symmetric delay.
Channel Load Issue when Measuring Delay
To factor the load in: round trip timer must be started when the ECHO packed is
queued.
To ignore the load: round trip timer must be started when ECHO packed reaches front
of the queue.
Packet Format:
Identity of Sender
Sequence Number
Age
List of Neighbors
Corresponding Delay
(a) A subnet. (b) The link state packets for this subnet.
As the packets are distributed and installed, the routers getting the first ones will change
their routes before other routers in the network update their routing tables.
Once a router has accumulated a full set of link state packets, it can construct the entire subnet
graph because every link is represented.
Every link is, in fact, represented twice, once for each direction.
Hierarchical Routing
Large Networks:
Proportionally large routing tables are required for each router
More CPU time is needed to scan them
More bandwidth is needed to send status reports.
At certain point network may grow so large where it is no longer feasible for every
router to have an entry for every other router.
Solution: Routing has to be done hierarchically.
Routers divided in Regions (as in telephone network):
Each router knows how to route packets to destinations within its own region.
However, router does not have any information regarding the topology of the network
of other regions.
When different networks are interconnected they are regarded as a separate region in order to
free the routers in one network from having to know the topological structure of the other
ones.
Huge networks will require more than two-level hierarchy.
How many hierarchical levels are optimal.
Kamoun and Kleinrock (1979): optimal number for an N router subnet is ln(N), requiring total
of e*ln(N) entries per router.
Broadcast Routing
Multicast Routing
Application that require separate processes (i.e., each from separate location) access and ability
to work on the same data.
Small group can use point-to-point messaging to accomplish this task.
Broadcasting can be used but communicating with 1000 “interested” machines out of
million-node network is inefficient.
Need a mechanism that would send messages to well-defined groups that are numerically large
in size but small compared to the network as a whole.
Sending a message to a such a group is called multicasting.
Corresponding routing algorithm is called multicast routing.
Requirements:
Create and Destroy Groups
Nodes should be able to Join and Leave Groups, etc.
Group Management.
When a process joins a group it informs its host.
Routers must know which of their hosts belong to which group.
Host must inform their routers about changes in group membership, or
Routers must query their hosts periodically.
Information shared with Neighboring Routers (propagation of information through the
subnet).
Tree Pruning
Link State Routing – each router is aware of the complete topology, including which hosts
belong to which groups.
Pruning starting from leaf-node up toward root node.
Distance Vector Routing – Basic pruning algorithm is based on reverse path forwarding.
Router with no hosts interested in a particular group and no connections to other routers
responds with PRUNE message to a multicast message.
Also when a router with no group members among its hosts receives a multicast
message it too will respond with a PRUNE message effectively recursively pruning the
subnet.
Potential Problem is that it scales poorly to large networks.
Core-Based Trees – an alternative algorithm:
Uses one spanning tree per group,
Root (core) node near the middle of the group.
Host sends multicast message to core node; which in turn sends the message along the
spanning tree.
Tree will not be optimal for every source,
Reduction is storage from m trees to one tree per group.
Increasing number of users of Portable Computers and Personal Computer Devices. They
require access to:
E-mail
File System, etc.
In order to route a packet to a mobile host, the network first has to find it.
World Model of communication network:
WAN consisting of routers and hosts,
LAN’s connected to WAN, and
MAN’s connected to WAN.
When a new host enters an area, either by connecting to it (e.g., plugging into LAN), or
wandering into the cell it must register itself with the foreign agent of that area.
Registration Procedure
1. Each foreign agent broadcast a packet announcing its existence and address.
2. The mobile host registers with the foreign agent:
Gives its home address,
Current data link layer address, and
Some security information.
3. The foreign agent contact the mobile host’s home agent and informs it about a
mobile host in his area. This message contains:
The foreign agent’s network address,
Security information
4. The home agent authenticates security information containing:
Timestamp (to prove that it was generated within the past few seconds), etc.
Acknowledges foreign agent by indicating to proceed if everything checks
out.
5. Foreign agent registers and informs the mobile [Link] out when done
(typically mobile hosts just turn-off their computers).
Ad Hoc networks refers to the extreme case of mobility where not only the hosts are mobile
but routers as well. Examples:
1. Military vehicles on a battlefield with no existing infrastructure.
2. A fleet of ships at sea.
3. Emergency workers at en earthquake that destroyed the infrastructure.
4. A gathering of people with notebook computers in an area lacking 802.11 (IEEE
Wireless LAN protocol).
Each node consists of a router and a host – usually on the same computer.
Networks of neighboring nodes are called ad hoc networks or MANETs (Mobile Ad hoc
NETworks).
Ad hoc On-demand Distance Vector routing (AODV) Algorithm
AODV takes into account limited bandwidth and low battery life of devices.
It is a on-demand algorithm; that is it determines a route to some destination only when
there is a demand to send a packed to a destination.
Route Discovery
Ad-hoc network can be described by a graph of the nodes (routers + hosts).
Two nodes are connected, if they can communicate directly using their radios.
Scenario: A wants to send a packet to node I.
To locate an unknown node (I), source node A constructs a special ROUTE
REQUEST packet and broadcasts it.
(a) Range of A's broadcast. (b) After B and D have received A's broadcast. (c) After C, F, and G have
received A's broadcast. (d) After E, H, and I have received A's broadcast.
The Source address, Destination address, and Hop count are copied from the incoming
request, but the Destination sequence number taken from its counter in memory.
The Hop count field is set to 0.
The Lifetime field controls how long the route is valid.
Route Maintenance