Table of Contents
There are really two aspects to this topic, which we will describe as Routing and as Forwarding.
There is a basic pattern that is seen most prominently when dealing with routing, but also can be found at many other levels.
We imagine that networked entities are constantly passing information around our network that other such entities can use. Each network entity constantly observers this information, and organizes this observed information in some manner. Then periodically each entity goes through this organized information and uses it to optimize something (in the case of routing a forwarding path) it is searching for.
This is the original now classic protocol, easy to understand but now only used for very small networks. One wonders if the acronym in some minds stands for "Rest in Peace", which could either represent the death that happens to packets if it is not set up properly or is on too large of a network, or what some of us think should happen to this protocol in a modern setting.
The Observation involved is that each router sends out (usually by broadcast) its complete forwarding table at regular intervals. The Organization involved is that each router which receives such a broadcast enters this information into a store which describes where the route came from, the particular source and destination for the route, and the length of the route. The Optimization is then to see if the new entry describes a better route than the best one you have found so far. If so, it is entered into the forwarding table in place of the previously best route.
Woops:- having found a better route means that you have a new forwarding table and should now tell everyone the exciting news. Yes, this produces lots of broadcasts, some triggered by a broadcast just received.
You also need to be careful here: you had better not direct the new information back along the link from which you received it. Those folks have better information already, so will not be tempted to use the new information. EXCEPT in the situation that they lose an old connection just after they told you about it. If they receive your information, they think you can still get there at only one hop more, and enter the actually erroneous information into their table. Of course this triggers them to tell you new information, and you note in your table that the destination is still reachable but with additional hops.
That whole process just described is called "counting to infinity". It leads to nothing except routers bouncing up a false route at increasing distances along which no traffic can actually reach its destination.
To prevent this RIP routers use "split horizon" which means broadcast new information to every network interface except the one on which it was received. This will prevent the immediate bouncing but does not prevent a more circular situation in which the routers are not directly connected. Thus the originators of the protocol decided to define infinity as the number 16 for this purpose, imaging with the Internet of those days that no traffic would need more than that many hops (and in a small network of today you would exit through a gateway to a network which used a better routing protocol in less than 16 hops).
The protocol Open Shortest Path First (OSPF) and a very similar protocol Intermediate System-Intermediate System (ISIS) is quite suitable for individual autonomous systems. What is being optimized here is that when constructing a forwarding table from the observed and organized routing information we choose the shortest path, measured in terms of a metric that is part of the observed information.
The Observation implementation is that routers discover other routers they are directly connected to and send them not their entire forwarding table but instead the links between nodes of which they are aware. This sending is done at regular intervals, not by broadcast but by direct exchange between pairs which have discovered one another ( called Peers as you should expect). The Organization is to store the information by which links have now become available, and the Optimization is to determine new best routes based on the changes that have just occured in link information. This may seem as if it requires a great deal of computation, but in fact algorithms for updating optimal routes based on discovery of new links run quickly and efficiently.
A router which receives new links from a peer just passes them on to other peers (a form of split horizon makes sense here), and we end up with every router able to take advantage of a complete picture of the domain involved. and the
Adjacency. The routers that exchange link-state updates are those that "form an adjacency". Two routers connected by a point-to-point link always do this, routers that share a broadcast link must make a choice to do so. An adjacency begins by an exchange of the full link-state database of each router, and from then on the routers merely exchange links. The process of forming an adjacency is a dialogue of finite state machines.
This is the protocol that is used between autonomous systems, thus it controls the routing at the highest level that takes our packets from our Internet service provider through whatever transit providers are required until reaching the Internet service provider of our destination peer.
Here the observed information relates to routing policy which is provided by various autonomous systems. The optimization involves a "shortest" path, measured in terms of a specific combination of a variety of metrics that are part of the observed information.
It knows a bit about exchanging packets with OSPF (or ISIS) as well, so packets move via one of those intermediate protocols within an automomous system until they reach a Border Router which is typically running both protocols
Again two of these border routers decide to peer, and are actually usually connected through a network segment that each has an interface to (this way they do not need routing to connect to one another).
The Observation involved is that each router has policies established by its administrator on behalf of the autonomous system that it belongs to, and exchanges those policies with the policies of its peer. The Organization involved is first that each set of policies advertised to a peer is filtered in accordance with rules and each set of policies accepted from a peer has been through an incoming filter set up according to rules appropriate for it. In essence the policies that are transferred were agreed to by both peers. The Optimization involved is that each now selects what it regards as the best path to its peer, and this best path can depend upon the type of traffic involved as well as other criteria.