Sunday, September 9, 2012

Key OSPF Concepts

OSPF is a link-state routing protocol, which uses the Dijkstra Shortest Path First (SPF) algorithm to determine the best routes to destination subnets.

There are three tables maintained by OSPF: neighbors, the link-state database, and the IP routing table.
These tables can be seen with the following commands:

show ip ospf neighbor
show ip ospf database
show ip route

Importance of the RID
OSPF routers are uniquely identified by a router ID, or RID.  There are three main ways a router derives its RID.

The first is that the RID is manually set while in router config mode with the command router-id [value]
The RID is a 32 bit dotted decimal ID.

The second, is that the router picks the highest IP address out of any loopback adapters configured, and in the up state.

The last method is that the highest IP address is chosen out of an interface where at least the first interface status is "up".  So an IP address assigned to an interface with a status of up, down could be selected if it was the highest address.

Requirements for OSPF routers to become neighbors:

-Be on the same subnet with matching masks and ID's
-Having matching Hello and Dead intervals
-Be operating in the same OSPF Area
-Exchange and pass any authentication configured

Hello messages include the sending RID, Area ID, Hello and Dead timer intervals, router priority, RID of the DR and BDR, and a list of "seen" or neighbors the router already has paired with.


OSPF routers have four different neighbor states:
-Down: the neighbor is not reachable
-Init: A Hello has been received, but it does not contain the local router's RID in the seen list.
-2-Way: The local router has recieved a Hello message with its own RID listed in the seen list from the neighboring router.  These two routers must then match the required parameters for becoming neighbors.
-Full: The neighbors having matching LSDB's and are considered to be fully adjacent.


Depending on the network topology, and the types of OSPF interfaces in use, some routers will not become fully adjacent.  In a multi-access network, there will be an elected DR and BDR router.  Other routers will become fully adjacent with the DR and BDR routers and be considered to have full adjaceny and have exchanged their topology information with the DR.  Non DR/BDR routers will be displayed as DROther in the neighbor table and their state will be 2-way.

DR/BDR Election
The router sending the highest OSPF priority will become the DR.  OSPF priority is configured by interface with the command ip ospf priority <value 0-255>.  If the value is set to 0, the router will exclude itself entirely from the election.  If there is a tie, it will be broken by whichever router has the highest RID.  If a new OSPF router enters the network after the election with a higher priority/RID, it will not cause another election cycle.

In a point to point situation, there will not be a DR/BDR election, and valid neighbors will become fully adjacent with each other.

The type of OSPF interface is configured with the interface command ip ospf network <broadcast, point-to-point>  There are other types, but they are outside the scope of the CCNA.  point-to-point is assumed on serial links, such as how broadcast is assumed on Ethernet interfaces.

LSDB Exchange
When two routers have matching LSDB databases, they are considered to be in full adjacency with one another.  This happens by the two routers exchanging lists of their LSA's with one another.  Any gaps in consistency of the received LSA lists and their own LSDB tables is solved by sending a request for the LSA in question.  Maintenance of the relationship between the two routers is performed by continuing to exchange hello's every hello interval (default, 10 seconds).  If a hello is not heard within the dead interval, the connection will be considered lost to the neighbor.  LSA's are flooded every 30 minutes by default, or if there is a change to the topology.

Selecting best paths
Path selection is performed by running the SPF algorithm.  The LSDB table does not itself identify the best route to the destination subnet.  The SPF algorithm operates by adding the OSPF cost for each outgoing interface between itself as the starting point, and the destination.  The route with the lowest cost is installed in the routing table.

Load Balancing
By default, OSPF load balances over four equal cost routes.  This can be adjusted, up to a maximum of 16, with the router config command maximum-paths <value>

Metric Calculation
The cost of each interface can be set manually using the ip ospf cost command, with a value between 1 and 65,535.
The router can calculate the cost itself by taking the reference bandwidth and dividing it by the interface bandwidth.

Authentication
There are three types that can be used by OSPF.  The commands are used per interface.

Null/none (default)
 ip ospf authentication null

Plaintext                
ip ospf authentication
ip ospf authentication-key <value>

MD5        
ip ospf authentication message-digest
ip ospf message-digest-key <key number> md5 <password>





No comments:

Post a Comment