OSPF - The Open Shortest Path First Protocol
For those that have read the other stories (and if you have NOT, at least go and read Part 1, Elguapo's Guide to Routing), long story short here: OSPF is a Link State Protocol. Part 1 goes into the various differences in the two basic types of dynamic protocols, Link State and Distance Vector. (of course someone has to throw a monkey-wrench in there and hose the standard up; that would be Cisco, with Enhanced Interior Gateway Routing Protocol (EIGRP) - the distance vector that acts like a link-state)
OSPF started as an IETF task force for forming an Interior Gateway Protocol in 1988. They wanted to form a protocol based on the Shortest Past First algorithm (hereinafter SPF) developed by one Dr. Dijkstra for large, heterogeneous environments - this SPF research had started as late as the late 1970's, on the then ARPANET. The first OSPF was described in RFC 1131 in October 1989 and was replaced by OSPF 2, RFC 1247, in July of 1991. Since then, RFCs 1538, 2178, and 2328 have been released, the last being the current, called OSPF version 2, and what most people call OSPF today.
RIP was quickly running out of overhead, and they just wanted something that would interoperate within their AS, as well as something that was open - thus OSPF was open to RFCs, theoretically allowing vendors to interoperate (not that certain vendors have reputations for breaking this interoperability). OSPF has a number of concepts that we either need to introduce or go over again:
Routing Hierarchy: with OSPF, your routing hierarchy really needs to look like your networking hierarchy. It doesn't have to, but, man oh man, will it make your life much easier. I'll go into detail later on how to circumvent this, and when I do, you'll see why you don't want to. Trust me here, unless you just cannot avoid it, make your network topology as close to your routing topology as possible.
SPF and Topology Database: with OSPF, ALL routers in the same area share the same topology database and execute the SPF algorithm on said database - this is where they make themselves the root of a tree, and work themselves up the root of this tree, populating the routing table with the most appropriate route (obviously, each router has it's own location in this "tree", thus coming up with its own solution). If there is more than one route in this topology database (and there often are) there are some metrics (later!) for deciding which route(s) to use. Yes, OSPF can use more than one route per destination, balancing across multiple links (handy, eh?). OSPF only likes equal cost load balancing though (per destination/packet load balancing is outside the scope of this - sorry), so you better have same size pipes - or lie to it and tell it that it does. This is one of those "hidden rope" things - want to tell OSPF that your one hop 56k link is as big as your one hop DS3 link? Go for it, stand by for some serious packet-loss, though.
Go read the BGP article and look at the example where BGP will gladly pick one 56k link over two back to back OCRs, and you'll get an idea. OSPF won't give you this much rope to hang yourself, but it hides that rope much better. :-P
Autonomous System - AS. Just as before, all routers configured as that OSPF AS. The largest OSPF hierarchical grouping. Remember, one of the advantages of AS's is that they "hide" the functioning of that AS to any external AS that you connect to. This allows you to administer your internal network without constantly having to update/inform/whatever those you are connected to. It would obviously be polite to let them know if it is going to somehow affect their traffic pattern, but hey, it IS your AS.
Area - um, no abbreviation :-P. This is a sub hierarchy within an AS. Area numbers can look like either an integer or an IP address. (This very may well depend on the version of Cisco (sorry!) IOS you are running, I have seen both on Cisco boxes, which is what I know.) I prefer the IP address methodology - i.e.: 188.8.131.52. Area 0.0.0.0 (commonly referred to as "Area Zero") is the "Backbone" Area . All areas, somehow, must connect through this area. Two non contiguous areas cannot, without connecting through Area Zero, connect to each other. The exception to this is the "Virtual Link", a VPN-like "tunnel" through another area for the sole purpose of connecting to Area Zero; so that this area can then connect to an area it has no physical connection to (this can even be the area it is transiting, if you can believe such a thing). If I have to go through there anyway, why not design my network to take this into account? IF I ever find myself doing virtual links, I have screwed something up in my design forecasting, IMHO. I have never done one of these "in the wild".
Link State Advertisements - LSAs. These are just that, an advertisement of links that a router shares with all other routers within Areas that router is connected to. Note: An OSPF router can "live" in more than one Area: 1)a router in one non-backbone area is just that, an Internal Router. It will advertise all LSAs to all configured neighbors. 2) A router with an interface connected to area 0.0.0.0 is called a Backbone Router. LSA-wise, same story, it is just moving "backbone" traffic" 3) A router connected to multiple areas (say 0.0.0.0, 0.0.0.1 and 0.0.0.2) is an Area Border Router (ABR), and now we get to LSA "types", and LSA from 0.0.0.1 destined for 0.0.0.2 is "external" to "0.0.0.2". 4) If a router has more than one interface connected to more than one AS, that is an Autonomous System Boundary Router (ASBR).
This brings us to Area Types and LSA types (this is quite Cisco-centric, apologies - read previous articles for background here).
- Backbone Area/Standard/Transit Area. Accepts link updates and route summaries, but only by a single OSPF area. This is the Backbone Area (Duh!), area 0.0.0.0, all other area must either connect to this, or virtual link (blech!) to it. All interarea traffic has to go through this area.
Stub-Area - Accepts no routes from other ASs - uses a default route to find its way out of the area instead (a route of 0.0.0.0 on a Cisco box). Will accept LSAs for LSAs within the AS, however.
Totally-Stubby-Area - Cisco proprietary. Just like a Stub-Area, however, it will not accept an LSA even from an area from its own AS. Default routes for anything outside of its area.
Not-So-Stubby-Area - A special area that only lives on ASBRs, it imports type 7 LSAs at the ASBR and translates them to type 5 LSAs at the ABR. See below for LSA types (Sorry, this is getting long in the tooth, and this seems the most straight forward way of dealing with this little gem)
- LSA-Type 1 and 2 (respectively) - O-OSPF: this is for router and network link entries, and used within a single area
- LSA-Type 3 - IA-OSPF: this is for backbone and AB's, and used for interarea routes only.
- LSA-Type 4 - IA-OSPF: like a type 3, but not sent to Totally Stubby Areas.
- LSA-Type 5 - AS External Link Entry: not allowed in Stub, Totally Stub, NSSA. Sent by and ASBR to describe external routes.
- LSA-Type 6 - Multicast OSPF.
- LSA-Type 7 - AS External Link: only sent by ASBR part of NSSA, then translated to a type 5 at the ABR before continuing on.
Well, there you have it. Besides BGP, probably one of the more widely deployed routing protocols out there. The latest in my series. I hope you enjoyed reading it, or that you learned something, or hopefully, a little of both!