In previous versions of the CCNA exam, you were expected to have only a cursory understanding of OSPF. The latest version now requires you to have a very good grounding in this subject. You must now understand how OSPF establishes adjacencies with neighbors as well as LSA types.
Much of this chapter is actually included in the CCNP syllabus, so if you find that the material is difficult, it’s understandable. But, as with anything, stick with it, type out any IOS commands you see, go through the labs, and it will all start to make sense.
Advanced OSPF Concepts
OSPF is designed to quickly locate changes in the network topology and calculate the best path available for network traffic to then take. The entire OSPF network is divided into areas. Within these areas, specific link state advertisements (LSAs) are flooded to neighbor routers. This ensures that routers in other OSPF areas will not be affected by changes or problems such as links flapping.
Unlike RIP, OSPF operates within a hierarchy of areas (which is explained below). At the highest level is the autonomous system (AS), which is a logical construct for a collection of networks under a common administration. OSPF is an intra-AS (interior gateway) routing protocol. An exterior routing protocol exchanges routing information between autonomous systems. An example of this is BGP, which is outside the CCNA syllabus but is covered in detail in the CCNP ENCOR exam.
An AS can be divided into a number of areas with continuous network addressing, depending on the customer’s requirements. Routers with multiple interfaces can participate in multiple areas if required per design. These routers are called area border routers, and they maintain separate topological databases for each area. We will cover OSPF router types shortly.
Because OSPF uses flooding to advertise LSAs, areas are introduced to limit how far the LSAs are flooded across the network (some LSAs are only flooded within an area). Every router within the same area will hold the same routing database. A router with all of its interfaces in the same area is known as an internal router.
OSPF will only function on a router with at least one active interface (i.e., an interface showing as up/up). OSPF will send out Hello packets from the interface using multicast address 224.0.0.5, which is also called the AllSPFRouter address. If the OSPF link is on an NBMA link (such as Frame Relay), the OSPF packet will be unicast rather than multicast.
When the OSPF packet is verified by the other router, a neighbor relationship is formed between the two routers. Each router floods its link state database to every other OSPF router, and in this way, a loop-free path to every route is built.
A topological database is essentially an overall picture of the network, and it contains the collection of LSAs received from all routers in the same area ONLY. Because routers within the same area share the same information, they have identical topological databases.
When multiple areas are created, two different types of OSPF routes can be seen, depending on whether the source and the destination are in the same or different areas. Intra-area routing occurs when the source and destination networks (or subnets) are in the same area, and inter-area routing occurs when they are in different areas.
An OSPF backbone (also known as area 0) is responsible for distributing routing information between other non-zero areas. All routers with at least one interface in area 0 are known as backbone routers.
Any router with all of its interfaces within the same area is known as an internal router (IR). Any router acting as a connection between routers running other routing protocols or instances of OSPF is known as an autonomous system boundary router (ASBR). Any router with interfaces in more than one area (area 0 and another area) is known as an area border router (ABR). More details on OSPF router types are provided in the following sections.
Designated Router and Backup Designated Router
On broadcast networks such as Ethernet (known as multi-access), it would not be efficient for OSPF to flood the links with advertisements to every one of its neighbors. Neither would it be efficient for every router to become adjacent. This is because each router in the network would need to send LSAs to all the other routers, and this consumes resources like memory, CPU, and bandwidth.
Without a designated router (DR) (and an optional backup designated router, or BDR) in a broadcast network, you would have the situation you see in Figure 16.1 below:
FIG 16.1 – Broadcast network without a DR
The formula for adjacency formation is n(n-1)/2, so in the network in Figure 16.1 above, it will require six. If you had a small business using only eight routers, you would require 28. Each of these routers will be exchanging n-1 LSAs, leading to a large amount of your bandwidth being used purely for OSPF traffic. Once you add a DR, you have the situation you see in Figure 16.2 below:
FIG 16.2 – Broadcast network with a DR
In this instance, OSPF will elect one router as the DR, which will listen to LSAs on multicast address 224.0.0.6 and flood them on 224.0.0.5. In addition to the DR, a BDR is usually elected, which will take over the role of the DR should the DR fail for any reason. Any new OSPF routers will form an adjacency only with the DR and the BDR, which creates redundancy.
The DR and BDR are elected when the OSPF process starts. The router with the highest OSPF priority is selected. If the OSPF priority is the same, then the router with the highest router ID (RID) is elected. Once they have been elected, even if a router with a higher priority joins the network, a replacement will not be selected. They will only be replaced in the event that the DR and the BDR routers fail.
Once elected, OSPF uses the DR and the BDR routers as follows:
- To reduce the number of adjacencies required on the segment
- To advertise the routers on the multi-access segment
- To ensure that updates are sent to all routers on the segment
Any router not elected DR or BDR is listed as DRother, and these routers will establish an adjacency only with the DR and BDR.
This all takes place per multi-access network, so in the network below, you have two DRs and two BDRs (one for each broadcast domain).
FIG 16.3 – A DR/BDR for each multi-access segment
Establishing Adjacencies
When routers are configured for OSPF, they transition through various states before an adjacency is established. The routers exchange different information at each state, and different criteria have to be met before they advance to the next state. The different states include Down, Attempt, Init, 2-Way, Exstart, Exchange, Loading, and Full, as described below:
- Down – The Down state is the first OSPF state; Hello packets haven’t been received from a neighbor on that interface.
- Attempt – The Attempt state is valid only in non-broadcast networks. In this state, Hello packets have been sent, but no information has been received from the configured neighbor.
- Init – The Init state is reached when the OSPF Hello packets are received from a neighbor. To proceed beyond this state, some parameters such as the OSPF area, timer values, and authentication must match.
- 2-Way – The 2-Way state indicates that bidirectional communication has been established between the OSPF neighbors. A router transitions to this state when it has received a Hello packet with its own RID in the Neighbor field, and the Hello packet parameters match on the two routers. In multi-access networks, the DR and BDR routers are elected during this phase. OSPF neighbors between non-DR/BDR routers (two DRothers) do not proceed beyond this state.
- Exstart – The initialization of database synchronization happens in the Exstart state. The neighbors elect a Master and a Slave. OSPF routers exchange database descriptor (DBD) packets. Database descriptors contain only the headers of the LSA. They describe the contents of the entire link state database.
- Exchange – The Exchange state is where routers describe their link state databases using DBD packets. Each DBD packet must be explicitly acknowledged, and the sending router allows only one outstanding DBD at a time. Routers also use LSR (link state request) packets to request an instance of the LSA. When requesting missing information, the M (More) bit is set to indicate that there is some missing information. When the database exchange is completed, the M bit is set to 0.
- Loading – In the Loading state, OSPF routers send LSR packets to request more recent instances of LSAs that have not been received during the Exchange state. The updates sent are placed in a link state retransmission link until acknowledgments are received. When OSPF routers receive LSRs, they respond with an LSU (link state update) containing the required information.
- Full – The Full state shows that the databases are fully exchanged, and both neighbors have the same view of the network. At this point, the relationships are added to the local database and advertised in an LSU packet. Also, the best routes are calculated using Dijkstra’s algorithm and added to the routing table.
FIG 16.4 – The adjacency process
You can debug the OSPF adjacency process with the debug ip ospf adj command, but be cautious because it can generate a huge amount of traffic. Note how I turned off all debugs at the bottom of the following output:
R1#debug ip ospf adj
OSPF adjacency events debugging is on
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
*Mar 1 01:24:22.687: OSPF: Interface FastEthernet0/0 going Down
*Mar 1 01:24:22.687: OSPF: 1.1.1.1 address 192.168.1.1 on FastEthernet0/0 is dead, state DOWN
[output truncated]
*Mar 1 01:24:24.243: OSPF: Neighbor change Event on interface FastEthernet0/0
*Mar 1 01:24:24.243: OSPF: DR/BDR election on FastEthernet0/0
*Mar 1 01:24:24.243: OSPF: Elect BDR 1.1.1.1
*Mar 1 01:24:24.247: OSPF: Elect DR 192.168.1.2
*Mar 1 01:24:24.247: DR: 192.168.1.2 (Id) BDR: 1.1.1.1 (Id)
*Mar 1 01:24:27.755: OSPF: Rcv LS UPD from 192.168.1.2 on FastEthernet0/0 length 64 LSA count 1
*Mar 1 01:24:27.795: OSPF: Rcv LS UPD from 192.168.1.2 on FastEthernet0/0 length 64 LSA count 1
R1#
*Mar 1 01:24:29.747: OSPF: Build router LSA for area 0, router ID 1.1.1.1, seq 0x80000004, process 1
R1#un all
All possible debugging has been turned off
R1#
OSPF Priority
Although you can force the DR/BDR election with the router-id command or by setting a high Loopback address, the preferred method is to use the interface command ip ospf priority. Please refer back to the previous chapter on OSPF if you need to refresh your understanding of the router ID.
R1(config)#int f0/0
R1(config-if)#ip ospf priority ?
[0-255] Priority
The command above will have no effect if the DR/BDR election has already taken place. The default priority is 1, and if you don’t want the interface to take part in the DR/BDR election, you can set it to 0. If you wanted it to be the DR, you would set it to a high priority on the segment, such as 200, and leave the others as default.
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
You can actually force a DR/BDR election on a segment using the clear ip ospf process command. Of course, you would never use this command on a live network, unless you have the necessary permission and a network outage is scheduled.
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
*Mar 1 01:19:26.711: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar 1 01:19:26.831: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
OSPF Router Types
OSPF routers are described by their location and function in the hierarchical OSPF network. Some of the common OSPF router types include:
- Area border routers
- Autonomous system boundary routers
- Internal routers
- Backbone routers
Figure 16.5 below shows a basic OSPF network with two areas, the OSPF backbone area 0 and another normal OSPF area (area 2). R2 has an external BGP (Border Gateway Protocol) neighbor relationship with R1. This diagram illustrates the different OSPF router types in a network. BGP isn’t actually covered in the CCNA exam, but it’s useful to refer to it to illustrate an example of router types.
FIG 16.5 – Additional OSPF router types
The ABR connects one or more area(s) to the OSPF backbone area (i.e., area 0). An ABR must have at least one interface in area 0 and another interface in a different area. Because ABRs are members of different areas, they keep a separate SPF database for each of the areas they connect to, and summarize the link state information between the areas. An ABR should be a high-end model for this reason. In Figure 16.5 above, R3 is an ABR that connects area 0 and area 2.
The ASBR defines the boundary of an OSPF autonomous system. In the context of OSPF, this would be any router that is injecting routes from a different route source into OSPF. A different route source can be another routing protocol or even a different OSPF process. In Figure 16.5, R2 is an ASBR because it has interfaces in both OSPF and BGP.
Internal routers have all their interfaces in a single OSPF area, but it doesn’t have to be in area 0. R4 in Figure 16.5 is an internal router because its only interface resides in area 2.
Backbone routers have at least one interface in area 0. In Figure 16.5, R2 and R3 are backbone routers.
As shown in Figure 16.5, OSPF routers can have multiple roles. For instance, R2 is both an ASBR and a backbone router, while R3 is both an ABR and a backbone router.
OSPF Link State Advertisements
OSPF uses link state advertisements to notify its neighbors about changes in the network. LSAs are used to build the OSPF database. There are many kinds of OSPF LSAs, but we will only focus on the ones required for the CCNA exam. For reference, Figure 16.6 below shows OSPF in three areas, which are already populated with network addresses.
FIG 16.6 – Understanding OSPF LSAs
You can view the contents of the link state database using the show ip ospf database command. This command prints out a summary of the LSAs. You can further specify the level of detail by adding specific keywords, which can be viewed using a question mark (?), as shown below:
R1#show ip ospf database ?
adv-router Advertising Router link states
asbr-summary ASBR Summary link states
database-summary Summary of database
external External link states
network Network link states
nssa-external NSSA External link states
opaque-area Opaque Area link states
opaque-as Opaque AS link states
opaque-link Opaque Link-Local link states
router Router link states
self-originate Self-originated link states
summary Network Summary link states
| Output modifiers
[cr]
Some of the common OSPF LSA types include:
- LSA Type 1 (Router LSA)
- LSA Type 2 (Network LSA)
- LSA Type 3 (Summary LSA)
- LSA Type 4 (ASBR Summary LSA)
- LSA Type 5 (External Summary LSA)
When you issue the show ip ospf database command, you won’t see the LSA number, but you will see the type, such as “Router link states” for LSA Type 1 or “Summary net link states” for LSA Type 3.
Router Link State Advertisements (Type 1)
Type 1 LSAs are generated by each router type, from backbone and stub to NSSA and non-stub. The LSAs list the originating router’s RID. This LSA contains the directly connected links in that area. For each link type, the LSA contains a link ID and an ADV router, which is the advertising RID. Each router in an area floods Type 1 LSAs throughout the area. If a router is in multiple areas, it will generate a Type 1 LSA for each area that it is connected to.
For example, R2 and R3 would generate Type 1 LSAs for area 0, as shown below:
R3#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 3)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link Count
2.2.2.2 2.2.2.2 704 0x80000005 0x0048A2 2
3.3.3.3 3.3.3.3 424 0x80000004 0x003AA4 2
[output truncated]In the output above, Age is the maximum age of the link, and Seq# and Checksum verifies the link state integrity. The flooding scope of a Type 1 LSA is within the area, so Type 1 LSAs generated in an area are not flooded to the next area. To view Type 1 LSAs, you can use the show ip ospf database router command. There are more in-depth details on Type 1 LSAs, but those are beyond the scope of the CCNA exam.
Network Link State Advertisements (Type 2)
Type 2 LSAs are used to advertise routers on a multi-access segment, such as an Ethernet network. The LSA is originated by the DR and flooded within the area (the flooding scope is within the area, just like for Type 1). The network allows the routers in an area to know about all the routers on a multi-access segment.
The Type 2 LSA is generated by the DR and includes the link ID, which is the DR address, the mask, and the RIDs of the routers in that network (attached routers). Type 2 information can be viewed using the show ip ospf database network command. The output of the command on R3 is shown below:
R3#show ip ospf database network
OSPF Router with ID (3.3.3.3) (Process ID 3)
Net Link States (Area 0)
Routing Bit Set on this LSA
LS age: 248
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 10.0.1.2 (address of Designated Router)
Advertising Router: 2.2.2.2
LS Seq Number: 80000008
Checksum: 0x8E7B
Length: 32
Network Mask: /24
Attached Router: 2.2.2.2
Attached Router: 3.3.3.3
Summary Link State Advertisements (Type 3)
Type 3 Summary LSAs provide information about destinations outside the local area (i.e., inter-area routing information). Unlike Type 1 LSAs, Type 3 LSAs do not provide topological information; instead, they summarize the topological information received in Type 1 and Type 2 LSAs into a prefix and its associated cost. Type 3 LSAs are generated by the ABR, and the flooding is described as follows:
- Type 3 LSAs are advertised from a non-backbone area to area 0 for each intra-area route (LSA Type 1 and Type 2)
- Type 3 LSAs are flooded from OSPF area 0 to other non-backbone areas for both intra-area routes within area 0 and inter-area routes (Type 2 LSAs that are received from other areas)
We will explore Type 3 LSAs with the same topology used in previous examples:
FIG 16.7 – Understanding OSPF LSAs
The show ip ospf database summary [options] command can be used to display the Summary LSAs in the link state database (LSDB). The show ip ospf database summary command provides detailed information on each Type 3 LSA. The outputs include the link ID, the network mask, and the cost. A sample output is shown below:
R4#show ip ospf database summary
OSPF Router with ID (4.4.4.4) (Process ID 4)
Summary Net Link States (Area 2)
Routing Bit Set on this LSA
LS age: 1612
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 1.1.1.1 (summary Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0x9753
Length: 28
Network Mask: /32
TOS: 0 Metric: 66
Routing Bit Set on this LSA
LS age: 1612
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 2.2.2.2 (summary Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0xE640
Length: 28
Network Mask: /32
TOS: 0 Metric: 2
Routing Bit Set on this LSA
LS age: 1677
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 3.3.3.3 (summary Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0xAE75
Length: 28
Network Mask: /32
TOS: 0 Metric: 1
Routing Bit Set on this LSA
LS age: 1487
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.0.0.0 (summary Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000003
Checksum: 0x35AE
Length: 28
Network Mask: /24
TOS: 0 Metric: 65
[output truncated]NOTE: The metric of the route shown in the output of the command is the distance from the ABR. The receiving router would then add its own interface metric to determine the overall metric of the route. You should keep this in mind to prevent confusion when viewing the LSDB.
You can zoom in on a particular link state ID using the show ip ospf database summary [Link State ID] command, as shown below:
R4#show ip ospf database summary 172.16.1.0
OSPF Router with ID (4.4.4.4) (Process ID 4)
Summary Net Link States (Area 2)
Routing Bit Set on this LSA
LS age: 76
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 172.16.1.0 (Summary Network Number)
Advertising Router: 3.3.3.3
LS Seq Number: 80000002
Checksum: 0x8D99
Length: 28
Network Mask: /24
TOS: 0 Metric: 75
ASBR Summary Link State Advertisements (Type 4)
Type 4 LSAs are generated by the ABR and are used to provide information on how to reach an ASBR. This is different from Type 3, which provides information on how to reach prefixes in an area to another area.
To generate a Type 4 LSA, there must be an ASBR in the area. An ASBR usually injects routes from another domain into OSPF via redistribution. Route redistribution is beyond the scope of the CCNA exam.
External Summary Link State Advertisements (Type 5)
Type 5 LSAs provide information about destinations outside the OSPF domain. This means that they provide information about routes learned from other routing sources outside OSPF. Type 5 LSAs are generated by the ASBR (the router that connects the OSPF domain to another routing source), and they are flooded across the entire domain by default.
As mentioned earlier, routes are injected from other routing sources into OSPF through a process known as redistribution, which is beyond the scope of the CCNA exam. In fact, LSA types have been removed from the exam syllabus, but it’s important that you at least know what they are and what they do, so I left the above information in the book because it only takes up a couple of pages. Please disregard for the exam.
OSPF Areas
OSPF can burden router CPUs due to flooding and database maintenance requirements. Flooding also has a big impact on bandwidth. For this reason, OSPF has been designed to allow router interfaces to be placed into logical groups called areas. Routers within an area will not maintain detailed information about routers outside their specific area.
The advantages of grouping OSPF interfaces into logical areas include:
- Reduced size of the link state database, resulting in less impact on router memory
- Less impact on a router’s CPU because of the smaller database
- LSA flooding is limited within an area, reducing bandwidth usage
OSPF specification defines special OSPF areas based on the types of LSAs that are allowed in the areas:
- Backbone (area 0)
- Stub areas
- Totally stubby areas
- Not-so-stubby areas
- Totally not-so-stubby areas
- Non-backbone, non-stub areas
You will cover the above in detail if you study for the CCNP exams.
Backbone
All traffic must pass through the backbone, and all areas must be connected to area 0. Area 0 cannot be partitioned (i.e., it must be continuous). You can extend area 0 with the use of virtual links (also removed from the exam syllabus).
Mini-lab – Configuring Multi-area OSPF
We have already examined how to configure single area OSPF. Configuring multi-area OSPF leverages on the same concept. As mentioned earlier, when you are configuring multi-area OSPF, one of the areas must be area 0 and non-zero areas should connect to area 0.
This lab is optional because only single-area OSPF is covered in the CCNA exam (according to the syllabus), it does, however, illustrate some of the topics we have previously discussed.
The steps to configure multi-area OSPF are as follow:
- Plan the network using Cisco OSPF design principles and establish which routers will be the DR/BDR, if required.
- Assign RIDs using Loopback interfaces or the router-id [ip address] This step is optional but is strongly encouraged.
- Enable OSPF with the router ospf [process ID]
- Configure the interfaces you want to participate in OSPF with the network x.x.x.x [wildcard] [area #]
- Configure neighbor support commands, if required (e.g., for NBMA), with the neighbor [ip address]
- Optionally, add any special area types, such as NSSA, stub, etc., with the following command:
R1(config-router)#area 1 ?
nssa Specify a NSSA area
stub Specify a stub area
virtual-link Define a virtual link and its parameters
[output truncated]- Optionally, add any authentication, summarization, or fine-tuning of Hellos, etc.
Figure 16.8 below shows a simple OSPF network with three non-zero areas attached to Loopback interfaces on the routers:
FIG 16.8 – Simple OSPF four-area network
As a small test for you, I’ll add the configuration for Router 1 only. You can copy my commands but replace the correct networks and areas as per Figure 16.8 above. Please note that I ping R2 and R3 after I’ve added the IP addresses to their F0/0 interfaces.
Router 1 configuration:
R1(config-if)#ip address 192.168.1.1 255.255.255.248
R1(config-if)#no shut
R1(config-if)#end
R1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 12/22/32 ms
R1#ping 192.168.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 12/27/56 ms
R1#
Next, I’ll add the Loopback 0 IP address and the OSPF configuration. If I wanted to force this router to be the DR, I would have had to add a high Loopback address or a high router ID, or the ip ospf priority command.
R1(config)#int lo0
R1(config-if)#ip add 10.10.10.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#router-id 200.200.200.200
R1(config-router)#network 192.168.1.0 0.0.0.7 area 0
R1(config-router)#network 10.10.10.0 0.0.0.255 area 10
R1(config-router)#end
As you configure R2 and R3, you should see the messages below appear on the console of R1. Go ahead and configure the other two routers.
*Mar 1 00:08:56.439: %OSPF-5-ADJCHG: Process 1, Nbr 10.20.20.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1#
*Mar 1 00:09:57.299: %OSPF-5-ADJCHG: Process 1, Nbr 10.30.30.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
You can now explore what has taken place with a few OSPF commands. You should usually start with the show ip protocols command:
R1#show ip protocols
Routing Protocol is “ospf 1” Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 200.200.200.200
It is an area border router
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.10.0 0.0.0.255 area 10
192.168.1.0 0.0.0.7 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
200.200.200.200 110 00:07:25
10.30.30.1 110 00:04:07
10.20.20.1 110 00:04:57
Distance: (default is 110)
In the output above, you can see the router ID, which networks you are advertising for which areas, and the routing information sources. The show ip ospf neighbor command should reveal the two neighbors:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.20.20.1 1 FULL/BDR 00:00:30 192.168.1.2 FE0/0
10.30.30.1 1 FULL/DROTHER 00:00:36 192.168.1.3 FE0/0
A show ip route command will reveal the networks learned:
R1#show ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP,
D – EIGRP, EX – EIGRP external, O – OSPF,
IA – OSPF inter area, N1 – OSPF NSSA external type 1,
N2 – OSPF NSSA external type 2, E1 – OSPF external type 1,
E2 – OSPF external type 2
[output truncated]Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.10.10.0/24 is directly connected, Loopback0
O IA 10.30.30.1/32 [110/11] via 192.168.1.3, 00:08:18, FastEthernet0/0
O IA 10.20.20.1/32 [110/11] via 192.168.1.2, 00:09:08, FastEthernet0/0
192.168.1.0/29 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, FastEthernet0/0
The show ip ospf interface command will tell you if you are advertising the correct IP address and wildcard mask. You can also confirm timers, neighbors, process ID, network type, and cost. In addition, you can establish whether the router is the DR for the segment.
R1#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.1/29, Area 0
Process ID 1, Router ID 200.200.200.200, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 200.200.200.200, Interface address 192.168.1.1
Backup Designated router (ID) 10.20.20.1, Interface address 192.168.1.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 10.20.20.1 (Backup Designated Router)
Adjacent with neighbor 10.30.30.1
[output truncated]The show ip ospf database command will produce a lot of information, even though you are working with a very small network in this lab. Rather than referring to the link state as Type1, Type 2, and so on, the database uses RIDs to identify the advertising routers.
R1#show ip ospf database
OSPF Router with ID (200.200.200.200) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.20.20.1 10.20.20.1 1308 0x80000002 0x009E4B 1
10.30.30.1 10.30.30.1 1253 0x80000002 0x002F91 1
200.200.200.200 200.200.200.200 1317 0x80000003 0x00DA2F 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.1 200.200.200.200 1256 0x80000002 0x00D43B
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.10.10.1 200.200.200.200 1450 0x80000001 0x009861
10.20.20.1 10.20.20.1 1304 0x80000001 0x00AB2A
10.30.30.1 10.30.30.1 1263 0x80000001 0x002E7F
Router Link States (Area 10)
Link ID ADV Router Age Seq# Checksum Link count
200.200.200.200 200.200.200.200 1454 0x80000001 0x005D6E 1
Summary Net Link States (Area 10)
Link ID ADV Router Age Seq# Checksum
10.20.20.1 200.200.200.200 1304 0x80000001 0x0016C5
10.30.30.1 200.200.200.200 1254 0x80000001 0x002F98
192.168.1.0 200.200.200.200 1457 0x80000001 0x007F2D
You can also run debugs in the network if you want, but these are generally run as part of the troubleshooting process. Common debugs for OSPF include debug ip ospf adj and debug ip ospf events:
R1#debug ip ospf ?
adj OSPF adjacency events
database-timer OSPF database timer
events OSPF events
flood OSPF flooding
hello OSPF Hello events
lsa-generation OSPF LSA generation
mpls OSPF MPLS
nsf OSPF non-stop forwarding events
packet OSPF packets
retransmission OSPF retransmission events
rib OSPF RIB
spf OSPF spf
tree OSPF database tree
As you can imagine, there is far more to OSPF theory, configuration, and troubleshooting than we have covered here, but our first priority must be to cover the CCNA-level subjects. You could add authentication, tune the Hello/Dead/Retransmit intervals, and add route filtering, redistribution summarization, virtual links, and network types, as well as configure the same network using NBMA.
I recommend that, for completeness, you repeat the mini-lab above but configure OSPF under the interface, which is the second configuration method but achieves the same result. You need to know both methods for the exam.
[END OF MINI-LAB]End of Chapter Questions
Please visit https://www.howtonetwork.com/ccnasimplified to take the free Chapter 16 exam.
Chapter 16 Labs
You would normally never use OSPF on two routers and would certainly not use three different areas on two routers. However, we’ve done so here just so you understand how they operate and how to configure areas for the exam. Please note that you only need to understand single-area OSPF for the CCNA exam, so you can consider this lab as optional.
Lab 1: Multi-area OSPF
The physical topology is shown in Figure 16.9 below:
FIG 16.9 – Multi-area OSPF lab
Lab Exercise
Your task is to configure the network in Figure 16.9 to allow full connectivity using the OSPF routing protocol. Place the point-to-point link into area 0, the Loopback interface of Router A into area 1, and the Loopback interface of Router B into area 2. This lab is optional because only single-area OSPF is tested in the exam.
Purpose
OSPF is a very popular routing protocol and is in wide use today. You will need to have a good working knowledge of it for the CCNA exam and as a Cisco engineer.
Lab Objectives
- Configure IP addresses on the router interfaces.
- Configure OSPF as per the description in the previous section.
- Verify correct OSPF multi-area functionality.
- Verify the routing table.
Lab Walk-through
- Configure all the IP addresses in the topology above. Make sure that you can ping across the Serial link.
RouterA(config)# interface s0/1/0
RouterA(config-if)#ip address 10.0.0.1 255.255.255.252
RouterA(config)# interface lo0
RouterA(config-if)#ip address 172.20.1.1 255.255.255.0
RouterB(config)# interface s0/1/0
RouterB(config-if)#ip address 10.0.0.2 255.255.255.252
RouterB(config)# interface lo0
RouterB(config-if)#ip address 192.168.1.1 255.255.255.192
- Add OSPF to Router A. Put the network on Loopback 0 in area 1 and the 10 network in area 0.
RouterA(config)#router ospf 4
RouterA(config-router)#network 172.20.1.0 0.0.0.255 area 1
RouterA(config-router)#network 10.0.0.0 0.0.0.3 area 0
RouterA(config-router)#^Z
RouterA#
%SYS-5-CONFIG_I: Configured from console by console
RouterA#show ip protocols
Routing Protocol is ospf 4
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 172.20.1.1
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
172.20.1.0 0.0.0.255 area 1
10.0.0.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
172.20.1.1 110 00:00:09
Distance: (default is 110)
- Add OSPF on Router B. Put the Serial interface network in area 0 and the Loopback network in OSPF area 2.
RouterB(config)#router ospf 2
RouterB(config-router)#net 10.0.0.0 0.0.0.3 area 0
00:22:35: %OSPF-5-ADJCHG: Process 2, Nbr 172.20.1.1 on Serial0/1/0 from LOADING to FULL, Loading Done
RouterB(config-router)#net 192.168.1.0 0.0.0.63 area 2
RouterB(config-router)# ^Z
RouterB#show ip protocols
Routing Protocol is ospf 2
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.1.1
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.0.0.0 0.0.0.3 area 0
192.168.1.0 0.0.0.63 area 2
Routing Information Sources:
Gateway Distance Last Update
172.20.1.1 110 00:01:18
192.168.1.1 110 00:00:44
Distance: (default is 110)
- Check the routing table on your routers. Look for the OSPF-advertised network. You will see an IA, which means IA – OSPF inter-area. You will also see the AD for OSPF, which is 110.
RouterA#sh ip route
[output truncated]
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0/1/0
172.20.0.0/24 is subnetted, 1 subnets
C 172.20.1.0 is directly connected, Loopback0
192.168.1.0/32 is subnetted, 1 subnets
O IA 192.168.1.1 [110/65] via 10.0.0.2, 00:01:36, Serial0/1/0
- Issue some of the available OSPF commands on either router.
RouterA#sh ip ospf ?
[1-65535] Process ID number
border-routers Border and Boundary Router Information
database Database summary
interface Interface information
neighbor Neighbor list
- Now redo this lab but put the OSPF configuration under each interface directly. Make sure that you reload all the routers first or at least remove all the current OSPF configurations. Here is a hint for one interface:
RouterA(config)#interface s0/0
RouterA(config-if)#ip ospf 1 area 0