My notes for EIGRP felt like I was just regurgitating the Key Points from the book. So with OSPF I read the book and looked at the command output, then decided to copy my notes from the BSCI and edit them down. In this manner I get more detail than the book, it refreshes my mind and I don’t feel like I am bored redoing the commands shown in the book. Please note, these are my notes, you got it off the web from some CCNA who is working toward a CCNP, you get the idea.
Open Shortest Path First (OSPF)
OSPF is a vendor neutral link-state routing protocol designed around the shortest path first or Dijkstra algorithm. OSPF learns all possible routes in the network and never produces routing loops.
OSPF creates three tables
1. Neighbor Table or Adjacency Database ñ Contains a list of recognized neighbors
2. Topology Table or LSDB ñ Contains all routers and their attached links the area or network. All routers in an area have Identical LSDB
3. Routing Table or Forwarding Database ñ Holds the best paths to destinations
Basic OSPF Operation
Exchange Hello messages to build neighbor table.
Elect DR and BDR.
Exchange LSA to build topology table.
Run SPF on topology table to build routing table.
OSPF Area Structure
OSPF uses a two-layer hierarchy.
1. Transit Area ñ Primary function is fast and efficient packet movement. End users are not usually found here. OSPF area 0 by definition is a transit area.
2. Regular Area ñ Primary function is to connect users and resources. By default a regular area does not allow transit traffic. It has a number of subtypes; standard area, stub area, totally stubby area and not-so-stubby area.
OSPF sends multicast hello packets to destination address 18.104.22.168. On a broadcast link hello packets are sent every 10 seconds and every 30 seconds on a nonbroadcast link. After initial hello exchange routers become neighbors as soon as they see themselves listed in the neighborís hello packet, this guarantees two way communication. Neighbor negotiation applies to the primary address only, secondary addresses have to belong to the same area as the primary address.
Routers must agree on the following to become neighbors:
Routers form an adjacency after they have synchronized their topology databases. After the hello exchange, routers proceed to the database exchange process. In order to minimize the amount of information exchange on a particular segment OSPF elects one router as the designated router (DR) and another as the backup designated router (BDR) on each multi-access segment. Instead of routers having to exchange information with every other router in the segment, they only have to exchange information with the DR and BDR. The DR and BDR relay information to all the other routers.
In mathematical terms this cuts communication from O(n*n) to O(n) where n is the number of routers on a segment. Each router tries to establish adjacency with the DR and BDR.
Building the Adjacency
The following are the states of an interface in the process of becoming adjacent to another router.
|Down||No hellos received from any router on segment|
|Attempt||Only valid for manually configured neighbors|
|Init||The router has received a hello packet from its neighbor but the receiving routerís ID was not in that hello packet.|
|Two-Way||Bi-directional communication has been established between the routers. At the end of this stage DR and BDR election is complete and the routers will decide whether to proceed with an adjacency.|
|Exstart||Routers are trying to establish the initial sequence number for packet exchange, the sequence number insures routers maintain recent information.|
|Exchange||Routers send entire link-state database.|
|Loading||Routers are finalizing their information exchange.|
|Full||Adjacency is complete, fully synchronized databases.|
OSPF routers on a LAN segment elects one DR and BDR, all other routers on that segment form full adjacencies with these two routers and pass LSAs only to them. The router with the highest OSPF priority on a segment will become the DR for that segment. Priority can be set from 0 ñ 255 with the default priority being 1 and a priority of 0 prevents the router from being elected.
OSPF Multicast Addresses:
22.214.171.124 goes to all OSPF routers.
126.96.36.199 goes to the DR and BDR.
Link State Advertisement (LSA)
LSAs are reliable, delivery is acknowledged they also have a sequence number and a set lifetime, so that each router recognizes that it has the most current link state database.
|Types 1 and 2 are flooded througout an area and are the basis of SPF path selection.|
|Type 1||Router Link LSA||Generated by every router and sent to every area to which it is connected. Lists each neighbor, the cost to every neighbor, directly connected link state. Establishes and maintains neighbor relationships.|
|Type 2||Network Link LSA||DR generated LSA that lists all the routers on the segment, the topological database.|
|Types 3 and 4 are called inter-area LSAs because they are passed between areas.|
|Type 3||Network Summary Link LSA||ABRs generate Type 3 LSAs to send between areas describing routes to the area’s networks. When an ABR receives type 1 LSAs it sends out type 3 LSAs to other areas advertising the networks it learned via type 1 LSAs.|
|Type 4||AS external ASBR summary link LSA||ASBRs produce this LSA to advertise their presence and describe routes to themselves.|
|Type 5||External Link LSA||Generated by ASBRs to describe routes external to OSPF, are flooded throughout the the AS except into totally stubby areas and totally stubby NSSAs.|
|Type 6||Multicast LSA||Used in multicast OSPF applications.|
|Type 7||NSSA External LSA||Created by an ASBR with one link in a NSSA. Stubby areas do not allow type 5 LSAs, so a type 7 LSA is a type 5 tunneled through the NSSA.|
OSPF Network Types
The TSHOOT book did a much better job than my notes summarizing the OSPF network types.
|Default network type for LAN interfaces||Default network type for Frame Relay serial interfaces||Default network type for non-Frame Relay serial interfaces||Can be configured for any interface|
|Neighbors discovered||Neighbors statically configured||Routers form adjacency||Neighbors automatically determined|
|All routers on same subnet||All routers on same subnet||Each point-to-point link on a separate subnet||All routers on same subnet|
|Has a designated router||Has a designated router||Does not have a dedicated router||Does not have a dedicated router|
TSHOOT p. 176
sh ip route meanings
|O||OSPF intra-area router LSA and network LSA. Networks from within the router’s area, advertised by router and network LSAs.|
|O IA||OSPS interarea or summary LSA, networks from outside the router’s area but within the OSPF AS. Advertised by summary LSAs.|
|O E1||Type 1 External Routes, networks from outside the router’s AS, advertised by external LSAs. Calculate the cost of an external route by adding the the external cost to the internal cost of each link the packet crosses. Use this type when multiple ASBRs are advertising an external route to the same AS.|
|O E2||Type 2 External Routes, networks from outside the router’s AS advertised by external LSAs. The calculated cost is the external cost only. Use this type if only one ASBR is advertising an external route the autonomous system.|
Commands to verify OSPF configuration:
sh ip ospf int [br]
From the output you can see that this command give a good overview of “who” is on the other end of an interface. When the brief option is on it gives a summation of the interfaces active in OSPF and their neighbors. This is intended to help debug the interface table.
R2#sh ip ospf int Serial0/0/0.23 is up, line protocol is up Internet Address 10.1.1.5/30, Area 0 Process ID 1, Router ID 10.1.1.5, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:01 Supports Link-local Signaling (LLS) Index 1/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 2, maximum is 2 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 10.1.1.9 Suppress hello for 0 neighbor(s)
R2#sh ip ospf int br Interface PID Area IP Address/Mask Cost State Nbrs F/C Se0/0/0.23 1 0 10.1.1.5/30 64 P2P 1/1 Se0/0/0.12 1 12 10.1.1.2/30 64 P2P 1/1
sh ip ospf neighbor
Intended to help debug the neighbor table of OSPF.
R2#sh ip ospf neigh Neighbor ID Pri State Dead Time Address Interface 10.1.1.9 0 FULL/ - 00:00:39 10.1.1.6 Serial0/0/0.23 188.8.131.52 0 FULL/ - 00:00:31 10.1.1.1 Serial0/0/0.12
sh ip ospf database
Shows the LSA headers contained in the link state database. Router Link States come from Type 1 LSAs and Net Link States come from Type 2 LSAs.
R2#sh ip ospf database OSPF Router with ID (10.1.1.5) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 10.1.1.5 10.1.1.5 429 0x8000066B 0x00805D 2 10.1.1.9 10.1.1.9 1590 0x80000669 0x002AB0 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.1.1.0 10.1.1.5 429 0x80000537 0x005D4A 10.1.1.8 10.1.1.9 1591 0x80000538 0x00F2A7 Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.1.4.9 10.1.1.9 1590 0x80000538 0x00CBC6 184.108.40.206 10.1.1.5 429 0x80000537 0x00D021 Router Link States (Area 12) Link ID ADV Router Age Seq# Checksum Link count 10.1.1.5 10.1.1.5 429 0x80000667 0x00FC43 2 220.127.116.11 18.104.22.168 1693 0x8000065E 0x00DAC1 2 Summary Net Link States (Area 12) Link ID ADV Router Age Seq# Checksum 10.1.1.4 10.1.1.5 436 0x80000539 0x003170 10.1.1.8 10.1.1.5 436 0x80000539 0x008BD1 Summary ASB Link States (Area 12) Link ID ADV Router Age Seq# Checksum 10.1.4.9 10.1.1.5 436 0x80000539 0x0064F0 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 10.1.4.4 10.1.4.9 1287 0x800004B2 0x00CEF3 0 10.1.4.8 10.1.4.9 1287 0x800000FC 0x001E5A 0 10.2.1.0 10.1.4.9 1287 0x800004B2 0x001EA7 0 10.2.2.0 10.1.4.9 1287 0x800000FC 0x008AF3 0 10.2.4.12 10.1.4.9 1287 0x800004B8 0x00664D 0 22.214.171.124 126.96.36.199 1693 0x80000536 0x004AB7 0 188.8.131.52 184.108.40.206 1697 0x80000536 0x00F319 65002
sh ip ospf statistics
Shows the last time SPF algorithm was run, how often and the reason.
R2#sh ip ospf statistics OSPF Router with ID (10.1.1.5) (Process ID 1) Area 0: SPF algorithm executed 34 times Area 12: SPF algorithm executed 25 times Summary OSPF SPF statistic SPF calculation time Delta T Intra D-Intra Summ D-Summ Ext D-Ext Total Reason 4w3d 0 0 0 0 0 0 0 R, SN, X 4w3d 0 0 0 0 0 0 0 X 4w3d 0 0 0 0 0 0 0 X 4w3d 0 0 0 0 0 0 0 R, X 4w3d 0 0 0 0 0 0 0 R, N, SN, SA, X 4w3d 0 0 0 0 0 0 0 R, 4w3d 0 0 0 0 0 0 0 R, 4w3d 0 0 0 0 0 0 0 R, N, SN, SA, X 4w3d 0 0 0 0 0 0 0 R, 4w3d 0 0 0 0 0 0 0 R, X RIB manipulation time during SPF (in msec): Delta T RIB Update RIB Delete 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0 4w3d 0 0
sh ip ospf border-routers
Who is sending what type of LSA?
R2#sh ip ospf border-routers OSPF Process 1 internal Routing Table Codes: i - Intra-area route, I - Inter-area route i 10.1.1.9  via 10.1.1.6, Serial0/0/0.23, ABR, Area 0, SPF 34 i 220.127.116.11  via 10.1.1.1, Serial0/0/0.12, ASBR, Area 12, SPF 25 I 10.1.4.9  via 10.1.1.6, Serial0/0/0.23, ASBR, Area 0, SPF 34
sh ip route ospf
Shows what routes are being advertised through OSPF.
R2#sh ip route ospf 18.104.22.168/24 is variably subnetted, 2 subnets, 2 masks O E2 22.214.171.124/29 [110/1] via 10.1.1.1, 4w3d, Serial0/0/0.12 O E2 126.96.36.199/30 [110/1] via 10.1.1.1, 4w3d, Serial0/0/0.12 10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks O E2 10.2.4.12/30 [110/20] via 10.1.1.6, 4w0d, Serial0/0/0.23 O IA 10.1.1.8/30 [110/128] via 10.1.1.6, 4w3d, Serial0/0/0.23 O E2 10.1.4.8/30 [110/20] via 10.1.1.6, 5d20h, Serial0/0/0.23 O E2 10.2.1.0/24 [110/20] via 10.1.1.6, 3w6d, Serial0/0/0.23 O E2 10.2.2.0/24 [110/20] via 10.1.1.6, 5d20h, Serial0/0/0.23 O E2 10.1.4.4/30 [110/20] via 10.1.1.6, 3w6d, Serial0/0/0.23
Commands to debug OSPF:
debug ip packet
debug ip ospf events
Watch the OSPF process in real time.
R2#debug ip ospf events OSPF events debugging is on R2# *Apr 12 19:19:50.000: OSPF: Rcv hello from 10.1.1.9 area 0 from Serial0/0/0.23 10.1.1.6 *Apr 12 19:19:50.000: OSPF: End of hello processing *Apr 12 19:19:50.388: OSPF: Send hello to 188.8.131.52 area 0 on Serial0/0/0.23 from 10.1.1.5 *Apr 12 19:19:50.528: OSPF: Send hello to 184.108.40.206 area 12 on Serial0/0/0.12 from 10.1.1.2