Last day, we described the distance vector routing algorithm.
This is an idealized algorithm to compute forwarding tables.
One of its chief implementations is the Routing Information Protocol (RIP) which became popular because
of its inclusion in BSD Unix.
In our model of distance vector, we tell our neighbor routers our cost to reach them.
In the RIP model what we tell our neighbors is the cost to reach various networks to which we know of.
Otherwise, RIP is a fairly straightforward implementation of distance vector.
Routers running RIP send their advertisements every 30 seconds.
RIP supports multiple types of addresses not just IP.
Link State (OSPF)
The second major class of intradomain routing protocols are those based on link state routing.
The starting assumptions for these algorithms are similar to those for distance vector protocols: It is assumed
that each node is capable of finding out the state of its neighbors (up or down) and the cost of each link going out.
Link state routing makes use of reliable flooding. This is the process of making sure that all nodes participating
in the routing protocol get a copy of the link-state information from all other nodes.
To do this each node sends its link-state information on all of its directly connected links, with each node that
receives this information forwarding it out on all its links.
This link-state information is sent out in a so-called link-state packet (LSP).
Each node periodically calculates and sends out such packets.
An LSP consists of: The identity of the sender, followed by a sequence number, a TTL, and then followed by a list of neighbors.
After a router has been accumulating a set of link state
packets for a while, it can construct the entire subnet as
each link is represented in some link state packet.
Dijkstra's algorithm can then be used to construct the
shortest paths to all possible destinations, this can be
installed in the routing tables, and normal operations can
be resumed.
Link State -- Filling in More of the Details
As an example of LSPs for a specific graph consider:
The link state packets for each router in the graph (a)
below are listed in (b).
To avoid the flooding process continuing indefinately, routers keep track of
(source router, sequence) pairs and duplicates are
discarded. Only non-duplicates are forwarded using flooding.
The sequence number is 32-bits or 64 bits so is unlikely to wrap before being
discarded.
The TTL (aka Age) field is decremented once per second by the routers who are
remembering a particular router, sequence number pair, if it hits zero,
the router discards the entry. They also reflood this LSP with a TTL of 0. This
signals to other router to delete the entry.
If a router goes down, it starts at sequence number 0 again. If it was down for
a long time, all the earlier packets will have timed out, and so this will be okay.
If it has only been down a short time, the router will eventually receive one of
its own packets from before it went down. If it does, it adds 1 to this LSP's
sequence number and refloods.
All link state packets are acknowledged.
It can be proven that the link state algorithm converges quickly, does not generate much traffic, and responds rapidly to topology changes.
Link State -- Dijkstra's Algorithm
Dijkstra's algorithm (1959) can be used to find the shortest
path between two points in a graph, assuming we know its vertices, edges, and weights.
For each node, the link-state packets give us this information.
The algorithm works as follows
Each node is initially labeled with its distance from the source along the
best known path. Node for which no path is known are labeled initially with
INFINITY.
Nodes are also labeled temporary or permanent. Initially, the start node is
labeled permanent. We also have an active node which is initially the start
node.
In a round, we update the distances to each of the nodes adjacent to
the active node, we then search the graph for the temporary node of
least distance, mark it permanent and set it as active. Then iterate
until no change.
Open Shortest Path First Protocol (OSPF)
OSPF is one of the most common link-state routing protocols.
Another link state protocol which was very influential was
IS-IS (Intermediate System - Intermediate System) which
was developed for DECnet and later used by ISO in its
connectionless network layer protocol, CLNP.
Open in the name comes from the fact that the defining standards body, the IETF wanted this standard to be open (non-proprietary).
SPF is an alternative name for link-state routing.
(RIP) was replaced by OSPF sometime in the early 1990s as the main interior gateway protocol.
OSPF supports several features not in the original link-state algorithm:
Authentication of routing messages - this is to guard against a misconfigured host being able to claim that it is distance 0 from everybody.
Additional hierarchy - to increase scalability of the internetworks that can be handled by this protocol domains can be further split into areas. i.e., routers within an area only need to be able to route within that area; not necessarily the whole domain -- a second layer of routers is used to route between areas.
Load balancing -- OSPF allows multiple routes to the same place to be assigned the same cost and will cause traffic to be evenly distributed over those routes.
More on OSPF
Domains are also called autonomous systems (AS).
In OSPF, every AS has a backbone area, called area 0, and all other areas are
connected to this backbone (possible by tunnels).
A tunnel is represented by an arc and has a cost.
Each router connected to two or more areas is part of the backbone.
Within an area each router has the same link state database and runs
the same shortest path.
OSPF has three kinds of routes: intra-area, inter-area, and inter-AS.
Intra-area routes are essentially computed using only link state.
Inter-area routes are all computed in three steps: compute source to
backbone, backbone to destination area, destination area to final
destination.
We'll talk about inter-AS routes later.
Even More on OSPF
OSPF distinguishes four classes (allowed to overlap) of routers:
Intra-area routers
Area Border Routers connect two or more areas
Backbone Routers are on the backbone
AS boundary routers that talk to routers in other AS's.
When a router boots it sends HELLO on each of its point-to-point lines and
multicasts them on LANs to the group of other routers on the LAN.
OSPF works by exchanging information between adjacent routers.
On each LAN one router is voted to be a designated router.
Two routers are adjacent if they are on the same LAN and one is the
designated router. Only adjacent routers exchange information.
Periodically each router floods LINK STATE UPDATE messages to each
of its adjacent routers.
This has a sequence number to prevent it from propagating forever.
These messages are also sent when a line goes up or down or changes cost.
Other messages that are used are DATABASE DESCRIPTION, which
gives the sequence number of all link state entries currently held by the
sender. (Used when a line is brought up), LINK STATE REQUEST, and
LINK STATE ACKNOWLEDGEMENT.
Metrics
We haven't discussed so far how to calculate the cost of links.
We could always just give a cost of 1 to all links.
This has the drawback that it doesn't taken into account the latency of
the link. For instance, a satellite link might have a large latency.
It also doesn't take into account the capacity of the link.
ARPANET, a precursor of the Internet, used the queue length of packets waiting
to be transmitted on each link as a metric for load on a link.
This has the tendency of favoring the shortest queue, rather than actually than
actually measuring latency or capacity.
More Metrics
A later variant of ARPANET, timestamped each packet that came in with its ArrivalTime
at the router; its DepartTime was also recorded.
When a link-level ACK was received from the other side, the node computed the delay for the
packet as:
Here TransmissionTime and Latency were statically defined for the link.
(DepartTime-ArrivalTime) measures how long something stays in the queue.
Under light loads the above metric works reasonably well; however, at high loads (DepartTime-ArrivalTime) tends to dominate the Delay which can cause a congested router to suddenly get a high cost on that link, so it often won't be used even after it becomes idle.
Another problem with this approach was it allowed too many possible link values.
A later version still of Arpanet addressed these issues by compressing the range of the metric, and by smoothing the variation of the metric with time.
Nowadays, there is less variation in link speeds and latencies then in the early internet.
For this reason, in modern routers static metrics like (1/link_bandwidth) are commonly used.