I’ve been working on my CCNA and have a need to break down the concepts, configurations etc. into bite sized study topics. So instead of creating this one in my notebook as I usually do, I decided I would share some key points of the OSPF protocol. Don’t expect anything ground breaking here, but if you are also working on your CCNA or just want to review, then maybe you’ll also find this handy. Oh and all of these are notes from the CCNA ICND2 official exam certification guide (second edition) by Wendell Odom.
OSPF – Open Shortest Path First
Features can be broken into 3 main categories: Neighbors, Databse exchange, and Route Calculation.
OSPF routers first form a neighbor relationship that builds a foundation for all continuing OSPF communication. Then the neighbor routers exchange the contents of their LSDBs (Link-State DataBase), called database exchange. Last, as soon as the routers have the topology information in their LSDBs, they use Dijkstra Shortest Path First algorithm to calculate the new best routes, and adds them to the routing table.
1. neighbors check and verify basic OSPF settings before exchanging routing info. These settings must match
2. The OSPF Hello process defines how neighbors can be dynamically discovered. (knows when the neighbor is healthy, when the connection has been lost, and tells the router when to recalculate the routing table to reconverge the new routes.
3. OSPF does checks of the information in the Hello messages to ensure the 2 routers should become neighbors.
OSPF RIDs are 32-bit numbers written in dotted decimal. They are used to uniquely ID each router.
Hellos are sent based on their Hello timer settings
- The hello message follows the IP packet header, with IP packet protocol type 89.
- Hello packets are sent to multicast IP address 22.214.171.124
- OSPF routers listen for packets sent to IP multicast address 126.96.36.199, in part hoping to recieve Hello packets and learn about new neighbors
Hello messages include the sending RID, Area ID, Hello Interval, dead interval, router priority, and the RID of the designated router, the RID of the backup designated router, and a list of neighbors that the sending router already knows.
potential problems becoming a neighbor (If any of these are different, the routers do not become neighbors).
- Subnet mask used on the subnet
- Subnet number (as derived using the subnet mask and each router’s interface IP address)
- Hello interval
- Dead interval
- OSPF area ID
- Must pass authentication checks (if used)
- Value of the stub area flag
OSPF Topology Database Exchange
1. Based on the OSPF interface type, the routers may or may not collectively elect a Designated Router (DR) and Backup Designated Router (BDR).
2. For each pair of routers that need to become fully adjacent, mutually exchange the contents of their respective LSDBs
3. When completed, the neighbors monitor for changes and periodically reflood LSAs while in the Full (fully adjacent) neighbor state.
When a DR is required, the neighboring routers hold an election. To elect a DR, the neighboring routers look at two fields inside the Hello packets they receive and choose the DR based on the following criteria:
- The router sending the Hello with the highest OSPF priority setting becomes the DR
- If two or more routers tie with the highest priority setting, the router sending the Hello wither highest RID wins.
- It’s not always the case, but typically the router with the second-highest priority becomes the BDR.
- A priority setting of 0 means that the router does not participate in the election and can never become the DR or BDR
- The range of priority values that allow a router to be a candidate are 1 through 255.
- If a new, better candidate comes along after the DR and BDR have been elected, the new candidate does not preempt the existing DR and BDR.
OSPF neighbor states and their meanings
Neighbor State – Meaning
Down – A known neighbor is no longer reachable, often because of an underlying interface failure.
Init – An interim state in which a Hello has been heard from the neighbor, but that Hello does not list the router’s RID as having been seen yet.
Two-way – The neighbor has sent a Hello that lists the local router’s RID in the list of seen routers, also implying that neighbor verification checks all passed.
Full – Both routers know the exact same LSDB details and are fully adjacent
- A larger topology database requires more memory on each router.
- Processing the larger-topology database with the SPF algorithm requires processing power that grows exponentially with the size of the topology database.
- A single interface status change (up to down or down to up) forces every router to run SPF again!
There is no exact definition of “large” but, networks with at least 50 routers and at least a few hundred subnets, engineers should use OSPF scalability features to reduce the problems just described.
OSPF areas break up the network so that routers in one area know less topology info about the subnets in the other area(s), And they do not know about the routers in the other area at all.
OSPF Design Terminology
Term – Description
Area Border Router (ABR) – An OSPF router with interfaces connected to the backbon area and to at least one other area.
Autonomous System Border Router (ASBR) – An OSPF router that connects to routers that do not use OSPF for the purpose of exchanging external routes into and out of the OSPF domain
Backbone router – A router in one area, the backbone area.
Internal router – A router in a single nonbackbone area.
Area – A set of routers and link s that share the same detailed LSDB information, but not with routers in other areas, for better efficiency.
Backbone area – A special OSPF area to which all other areas must connect. Area 0.
External route – A route learned from outside the OSPF domain and then advertised into the OSPF domain.
Intra-area route – A route to a subnet inside the same area as the router
Interarea route – A route to a subnet in an area of which the router is not a part.
Autonomous system – In OSPF, a reference to a set of routers that use OSPF
OSPF Area Design Advantages
- The smaller per-area LSDB requires less memory.
- The router requires fewer CPU cycles to process the smaller per-area LSDB with the SPF algorithm, reducing CPU overhead and improving convergence time.
- The SPF algorithm has to be run on internal routers only when an LSA inside the area changes, so routers have to run SPF less often.
- Less information must be advertised between areas, reducing the bandwidth required to send LSAs.
- Manual summarization can only be configured on ABRs and ASBRs, so areas allow for smaller IP routing tables by allowing for the configuration of manual route summarization.
- Enter OSPF configuration mode for a particular OSPF process using the router ospf process-id global command.
- (Optional) Configure the OSPF router ID by:
A. Configuring the router-id id-value router subcommand.
B. Configuring the IP address on a loopback interface.
- Configure one or more network ip-address wildcard-mask area area-id router subcommands, with any matched interfaces being added to the listed area.
- (Optional) Change the interface Hello and Dead intervals using the ip ospf hello-interval time and ip ospf dead-interval time interface subcommands.
- (Optional) Impact routing choices by tuning interface costs as follows:
A. Configure costs directly using the ip ospf cost value interface subcommand.
B. Change interface bandwidths using the bandwidth value interface subcommand.
C. Change the numerator in the formula to calculate the cost based on the interface bandwidth, using the auto-cost reference-bandwidth value router subcommand.
- (Optional) Configure OSPF authentication:
A. On a per-interface basis using the ip ospf authentication interface subcommand.
B. For all interfaces in an area using the area authentication router subcommand.
- (Optional) Configure support for multiple equal-cost routes using the maximum-paths number router subcommand.
Configuring the OSPF Router ID
- If the router-id rid OSPD subcommand is configured, this value is used as the RID.
- If any loopback interfaces have an IP address configured and the interface has a line and protocol status of up/up, the router picks the highest numeric IP address among the up/up loopback interfaces.
- The router picks the highest numeric IP address from all other working (up/up)
OSPF Metrics (cost)
OSPF calculates the metric for each possible route by adding up the outgoing interfaces OSPF costs. The OSPF cost for an interface can be configured, or a router can calculate the cost based on the interface’s bandwidth setting.
IOS chooses an interface’s cost based on the following rules:
- The cost can be explicitly set using the ip ospf cost x interface subcommand, to a value between 1 and 65,535, inclusive
- IOS can calculate a value based on the generic formula ref-BW / Int-BW, where Ref-BW is a reference bandwidth that defaults to 100Mbps, and Int-BW is the interface’s bandwidth setting.
- The reference bandwidth can be configured from its default setting of 100 (100Mbps) using the router OSPF subcommand auto-cost reference-bandwidth ref-bw, which in turn affects the calculation of the default interface cost.
OSPF supports three types of authentication, Null authentication (meaning none), simple text password (easy to break), MD5 (best option)
OSPF authentication types
type – meaning – command to enable authentication – what the password is configured with
0 – None – ip ospf authentication null – –
1 – Clear Text – ip ospf authentication – ip ospf authentication-key key-value
2 – MD5 – ip ospf authentication message-digest – ip ospf message-digest-key key-number md5 key-value
router ospf process-id —- Enters OSPF configuration mode for the listed process.
network ip-address wildcard-mask area area-id —– router subcommand that enables OSPF on interfaces matching the address/wildcard combination and sets the OSPF area.
ip ospf cost interface-cost —- Interface subcommand that sets the OSPF cost associated with the interface
bandwidth bandwidth —- Interface subcommand that directly sets the interface bandwidth (Kbps)
auto-cost reference-bandwidth number —- Router subcommand that tells OSPF the numberator in the ref-bw / int-bw formula used to calculate the OSPF cost based on the interface bandwidth.
ip ospf hello number —- Interface subcommand that sets the OSPF Hello interval, and also resets the Dead interval to 4 times this number.
ip ospf dead-interval number —- Interface subcommand that sets the OSPF dead timer.
ip ospf network type —- Interface subcomand that defines the OSPF network type.
router-id id —- OSPF command that statically sets the router ID.
ip ospf hello-interval seconds —- Interface subcommand that sets the interval for periodic Hellos.
ip ospf priority number-value —- Interface subcommand that sets the OSPF priority on an interface.
maximum-paths number-of-paths —- Router subcommand that defines the maximum number of equal-cost routes that can be added to the routing table.
ip ospf authentication [null | message-digest] —- Interface subcommand that enables type 0 (null), type 1, or type 2 (message-digest) authentication.
ip ospf message-digest-key key-number md5 key-value – Interface subcommand that sets the OSPF authentication key if MD5 auth is used.
ip ospf authentication-key key-vlaue —- Interface subcommand that sets the OSPF authentication key if simple password authentication is used.
area area authentication [message-digest | null] —- Router subcomand that configures the default authentication service for interfaces in the listed area.
show ip route ospf —- Lists routes in the routing table learned by OSPF.
show ip protocols —- Shows routing protocol parameters and current timer values.
show ip ospf interface —- Lists the area in which the interface resides, neighbors adjacent on this interface, and Hello and dead timers.
show ip ospf neighbor [neighbor-RID] —- Lists neighbors and current status with neighbors, per interface, and optionally lists details for the router ID listed in the command.
debug ip ospf events —- Issues log messages for each OSPF packet.
debug ip ospf hello —- Issues log messages describing Hellos and Hello failures.