Monday, December 1, 2014

OSPFv2 Overview

This is a quick overview of the OSPF (Open Shortest Path First) routing protocol. The version of OSPF focused on in this post will be the IPv4 OSPFv2 variant. I will do another post on OSPFv3, which is OSPF for IPv6. This post will be somewhat Cisco centric (again, reading up for the CCIE exam) and so some of the points below may not be directly from the RFC, but more in the adaptation of OSPFv2 in Cisco gear.
  • Open standard based on RFC 2328 (2328 is the current OSPFv2 specification, but there are many RFCs that add different functionality to OSPF apart from what is described in 2328)
  • Classless
  • Link-State routing protocol
  • Uses IP protocol 89
  • Sends Hello messages
    • Used to form neighbor relationships
    • Used as a keepalive between neighbors
    • Default Hello interval is 10 seconds
      • Default on NBMA and point-to-multipoint NBMA links is 30 seconds
  • Uses a Dead timer 
    • Default Dead timer is 4 times the Hello timer
  • Sends partial and full updates
    • Updates are triggered
    • Updates will be sent after 30 minutes by default (half the MaxAge timer)
  • Uses multicast address 224.0.0.5 (all OSPF routers) and 224.0.0.6 (all OSPF designated routers) or unicast to communicate with neighbors
  • Default administrative distance is 110
  • Uses bandwidth as metric for best path selection
    • Default reference bandwidth is 100 mpbs
    • Cost is calculated by ref-bw / interface-bw (example: 100mpbs / 10mbps = cost 10)
  • Supports authentication using clear text, MD5 or SHA
  • Supports route summarization only at Area or Autonomous System Boundaries.
  • Supports equal cost load-sharing
  • Does not support split-horizon, but ignores self-originated LSAs - which is kind of the same thing.
  • Uses Shortest Path First (SPF) algorithm to process the contents of the Link-State Database (LSDB)
Things that has to match in Hello packets for OSPF neighbor adjacency relationships to form:
  • Authentication (if used)
  • Hello and Dead timers
  • Network Mask
  • OSPF Area ID
  • OSPF Area Type
  • Link MTU size
  • No duplicate RIDs
OSPF is a link-state routing protocol, which means all routers have the entire network topology database and calculates the best paths to reach destinations using this topology. The benefits of this is that, unlike distance vector protocols, OSPF routers know exactly what the network looks like from the perspective of all its neighbors - the drawback, though, is the resource consumption of having to maintain a full overview of the topology on every single router. So, when it is said that all OSPF routers must know the exact same topology it is not the entire truth - the truth is that ALL routers in the same area must know the exact topology. 
Areas are a way of dividing an OSPF domain into logical groupings of routers. It allows for smaller topology databases and also enables the routers on the area borders to summarize networks advertised between the OSPF areas. These routers are known as Area Border Routers (ABR).
For OSPF to function properly in a multi-area design, all areas must be connected to area 0, which is the backbone area in OSPF. The reason for this is that ABRs only advertise non-backbone area networks into area 0.

Below is a drawing of a network with two different area configuration - the left one is improper area design and will cause routes in area 4 to be missing from on neighbor routers and the one on the right is a way to fix that design flaw by removing area 4 and including the network into area 3 instead, which will allow for all routes to be available throughout the OSPF multi-area domain.
OSPF Area Designs
The use of areas in OSPF also serves to reduce the flooding of Link-State Advertisements (LSAs) between routers. LSAs describes different network properties depending on the type of LSA. OSPF routers flood different types of LSAs based on its role in the network. In a non-backbone area it will be normal to have LSA types 1 and 2 and ABRs will send type 3 LSAs into the backbone area.

OSPF uses different network types for interfaces enabled for OSPF. The reason is to allow OSPF to determine its behaviour in regards to the following:
  • Whether there will be an election of a DR/BDR on that interface
  • Whether to use multicast or unicast to communicate with neighbors
  • Whether two or more routers are allowed on the same subnet
Below is a table listing the different network types and the OSPF behaviour they dictate.
OSPF Network Types
A last note I want to put on OSPF is that it does not calculate based on the best way to reach a prefix - instad it finds the best way to reach the node (router) that advertises the prefix. The end result is pretty much the same, but if you think about it, one router can have many prefixes and so if you calculate based on each prefix you will have to calculate many times - whereas if you calculate the best path to the node you have the answer to ALL the prefixes with a single calculation.

No comments:

Post a Comment