Routing
Routing
The main function of NL (Network Layer) is routing packets from the source
machine to the destination machine.
There are two processes inside router:
a) 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.
b) 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.
Regardless of whether routes are chosen independently for each packet or only
when new connections are established, certain properties are desirable in a
routing algorithm correctness, simplicity, robustness, stability, fairness,
optimality Routing algorithms can be grouped into two major classes:
1) nonadaptive (Static Routing)
2) adaptive. (Dynamic Routing)
Nonadaptive algorithm do not base their routing decisions on measurements or
estimates of the current traffic and topology. Instead, the choice of the route to
use to get from I to J is computed in advance, off line, and downloaded to the
routers when the network is booted.
This procedure is sometimes called static routing.
Adaptive algorithm, in contrast, change their routing decisions to reflect
changes in the topology, and usually the traffic as well.
Adaptive algorithms differ in
1) Where they get their information (e.g., locally, from adjacent routers, or from
all routers),
2) When they change the routes (e.g., every ΔT sec, when the load changes or
when the topology changes), and
3) What metric is used for optimization (e.g., distance, number of hops, or
estimated transit time). This procedure is called dynamic routing
Different Routing Algorithms
• Optimality principle
• Shortest path algorithm
• Flooding
• Distance vector routing
• Link state routing
• Hierarchical Routing
Initialization
Sharing
Updating
Initialization
Each node can know only the distance between itself and its immediate
neighbors, those directly connected to it. So for the moment, we assume that
each node can send a message to the immediate neighbors and find the distance
between itself and these neighbors.
Below fig shows the initial tables for each node. The distance for any entry that
is not a neighbor is marked as infinite (unreachable).
Sharing
The whole idea of distance vector routing is the sharing of information between
neighbors. Although node A does not know about node E, node C does. So if
node C shares its routing table with A, node A can also know how to reach node
E. On the other hand, node C does not know how to reach node D, but node A
does. If node A shares its routing table with node C, node C also knows how to
reach node D. In other words, nodes A and C, as immediate
neighbors, can improve their routing tables if they help each other.
NOTE: In distance vector routing, each node shares its routing table with its
immediate neighbours periodically and when there is a change
Updating
When a node receives a two-column table from a neighbor, it needs to update its
routing table. Updating takes three steps:
1. The receiving node needs to add the cost between itself and the sending node
to each value in the second column. (x+y)
2. If the receiving node uses information from any row. The sending node is the
next node in the route.
3. The receiving node needs to compare each row of its old table with the
corresponding row of the modified version of the received table.
a. If the next-node entry is different, the receiving node chooses the row with
the smaller cost. If there is a tie, the old one is kept.
b. If the next-node entry is the same, the receiving node chooses the new row.
For example, suppose node C has previously advertised a route to node X with
distance 3. Suppose that now there is no path between C and X; node C now
advertises this route with a distance of infinity. Node A must not ignore this
value even though its old entry is smaller. The old route does not exist anymore.
The new route has a distance of infinity.
1. Defining Infinity: redefine infinity to a smaller number, such as 100. For our
previous scenario, the system will be stable in less than 20 updates. As a matter
of fact, most implementations of the distance vector protocol define the distance
between each node to be 1 and define 16 as infinity. However, this means that
the distance vector routing cannot be used in large systems. The size of the
network, in each direction, cannot exceed 15 hops.
2. Split Horizon: In this strategy, instead of flooding the table through each
interface, each node sends only part of its table through each interface. If,
according to its table, node B thinks that the optimum route to reach X is via A,
it does not need to advertise this piece of information to A; the information has
come from A (A already knows). Taking information from node A, modifying
it, and sending it back to node A creates the confusion. In our
scenario, node B eliminates the last line of its routing table before it sends it to
A. In this case, node A keeps the value of infinity as the distance to X. Later
when node A sends its routing table to B, node B also corrects its routing table.
The system becomes stable after the first update: both node A and B know that
X is not reachable.
3. Split Horizon and Poison Reverse
Using the split horizon strategy has one drawback.
Normally, the distance vector protocol uses a timer, and if there is no news
about a route, the node deletes the route from its table. When node B in the
previous scenario eliminates the route to X from its advertisement to A, node A
cannot guess that this is due to the split horizon strategy (the source of
information was A) or because B has not received any news about X recently.
The split horizon strategy can be combined with the poison reverse strategy.
Node B can still advertise the value for X, but if the source of information is A,
it can replace the distance with infinity as a warning: "Do not use this value;
what I know about this route comes from you."
1. Creation of the states of the links by each node, called the link state packet
(LSP).
2. Dissemination of LSPs to every other router, called flooding, in an efficient
and reliable way.
3. Formation of a shortest path tree for each node.
4. Calculation of a routing table based on the shortest path tree I.
Initialization
Initial routing tables in path vector routing
Sharing
Just as in distance vector routing, in path vector routing, a speaker in an
autonomous system shares its table with immediate neighbours. In Figure, node
A1 shares its table with nodes B1 and C. Node C1 shares its table with nodes
D1, B1, and A1. Node B1 shares its table with C1 and A1. Node D1 shares its
table with C1.
Updating
When a speaker node receives a two-column table from a neighbor, it updates
its own table by adding the nodes that are not in its routing table and adding its
own autonomous system and the autonomous system that sent the table. After a
while each speaker has a table and knows how to reach each node in other Ass
a) Loop prevention. The instability of distance vector routing and the creation
of loops can be avoided in path vector routing. When a router receives a
message, it checks to see if its AS is in the path list to the destination. If it is,
looping is involved and the message is ignored.
c) Optimum path. What is the optimum path in path vector routing? We are
looking for a path to a destination that is the best for the organization that runs
the AS. One system may use RIP, which defines hop count as the metric;
another may use OSPF with minimum delay defined as the metric. In our
previous figure, each AS may have more than one path to a destination. For
example, a path from AS4 to ASI can be AS4-AS3-AS2-AS1, or it can be AS4-
AS3-ASI. For the tables, we chose the one that had the smaller number of
ASs,
but this is not always the case. Other criteria, such as security, safety, and
reliability, can also be applied.