show ip ospf neighbor
A quick favor: If you like this new series, +1 it in Google and share it any way you can! You're the only advertising TBA has!
Boy, this is a pretty innocent little command, right?
After all, most OSPF commands give us a TON of information. (So much information that I had to use all caps to express the unit of measurement!)
show ip ospf neighbor gives us just a few lines of info...
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
18.104.22.168 1 FULL/DR 00:01:53 22.214.171.124 Serial0
126.96.36.199 1 FULL/ - 00:00:38 188.8.131.52 Serial1
... and these are some of the most important lines you'll ever deal with when it comes to OSPF, both for your exams and real-world networking. There's a lot of obvious and not-so-obvious info about your OSPF neighbors and your local router in this output.
Let's go through this command field by field, and by doing so, you'll learn and review other important OSPF concepts related to the output we see here.
(A lot of other concepts!)
If OSPF study is relatively or completely new to you, you might have several questions about that output already....
1. Why do we see two adjacencies with the same Neighbor ID?
2. The "Pri" is probably for "Priority", but is this one of those Cisco router priority values where the higher value is the strongest, or where the lowest value is the most powerful?
3. Why does the answer to question 2 even matter?
4. Why is there a "DR" in the "State" field for the first adjacency, but a dash for the second one?
5. Why are the Neighbor IDs the same for both adjacencies, but the addresses listed are different?
All good questions! They'll all be answered, along with some others, as we delve into this command. Let's get started with the Neighbor ID field!
The Neighbor ID is that neighbor's OSPF RID. The reason we see that particular Neighbor ID first is that R3 has two adjacencies to R1, one over an NBMA network and the other via a point-to-point Serial link. (I've left R2 on the NBMA network, but we're not using the config of that router in this CCNA / CCNP command reference.
OSPF Tip: Despite what you may have read elsewhere, a router can have multiple OSPF adjacencies with another router.
Time for a practice exam question (and the answer's posted immediately after that!)
If R1 has OSPF adjacencies with R3 via both 184.108.40.206 and 220.127.116.11, why does the OSPF RID appear as 18.104.22.168 for both adjacencies? Assume the RID has not been hardcoded with the ospf router-id command and that both Serial interfaces had their IP addresses when I created the lab.
You could have several different adjacencies between R1 and R3, and no matter the OSPF network type, the RID of an OSPF-speaking router doesn't change. That OSPF-speaking router is going to have one RID and one RID only.
That's great, but how did the router arrive at that RID? By this process....
1. If there's a loopback interface present on an OSPF speaker, the IP address of that interface will be used as the RID, even if that loopback isn't OSPF-enabled. If there are multiple loopback interfaces, the highest address is used as the RID.
2. If there are no loopback interfaces on the router, the highest IP address assigned to a physical interface is used as the OSPF RID. That physical interface does not have to be OSPF-enabled.
In this lab, though, only S1 had its IP address assigned when I brought OSPF up, so the only RID the router could have was 22.214.171.124. I did that to illustrate a very important point:
When a router has an OSPF RID and you then add an IP address to another interface that is higher than that address used for the current RID, the new address does NOT take over as the OSPF RID automatically. You'd need to do some rebooting or use the ospf router-id command to statically change the RID.
In this lab, R1 had 126.96.36.199 as its RID, and then I added 188.8.131.52 to the router. 184.108.40.206 is still the RID.
3. You might be thinking "Well, what if there are no IP addresses on the router to use as the OSPF RID?" In that case, you wouldn't even be able to start an OSPF config -- the Cisco router won't let you do that.
That's it for the OSPF Neighbor ID field. We'll continue this discussion right after this important message about your CCNA success!
R3#show ip ospf neighbor
Neighbor ID Pri
It's this OSPF priority that is used for the Designated Router / Backup Designated Router election. The router with the highest priority is the DR, the next highest is the BDR, and the others are DROthers.
(As in many facets of networking, there are exceptions to this rule, and we'll run into one of those exceptions later in our discussion.)
Want to see the OSPF priority of the local router's interface(s)? Run this very helpful command -- show ip ospf interface.
We'll be spending a lot of time with this command in upcoming Bulldog Command References; for now, I'll share the first few lines of the output with you:
R3#show ip ospf int serial0
Serial0 is up, line protocol is up
Internet Address 220.127.116.11/24, Area 0
Process ID 1, Router ID 18.104.22.168, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State DROTHER, Priority 0
Note the priority here is 0. Obviously, that means the default was changed, and I did that by running ip ospf priority 0 on that interface's config.
R3(config-if)#ip ospf priority 0
As often happens in our networking studies, an answer leads to another question, and the next question is "Chris, why did you do that?"
In short, I did that because R1 and R3 are part of an OSPF NBMA network, and we need two things in this situation:
The hub router should be the DR
There should be no BDR
I needed to effectively disqualify both of the spoke routers (R2 and R3) from the DR / BDR election, and I did it with one simple command -- ip ospf priority 0.
A handy command for studies and for the real world!
Another important DR / BDR election note: It's vital to remember that there is a DR/BDR election on each physical network segment, not just one for the entire network as a whole. In this lab, there will be one election for the NBMA network (the one over the frame relay cloud), and an election for the point-to-point link between R1 and R3.
"Or..... is there?" (Delivered in my best Keith Morrison NBC Dateline voice) After all, in the very next field, there's an odd result in the "State" section of our show ip ospf neighbor command...
R3#show ip ospf neighbor
Neighbor ID Pri State
22.214.171.124 1 FULL/DR
126.96.36.199 1 FULL/ -
... that dash looks a little odd. We'll see exactly what's going on with that -- and much more -- in the second part of this CCNA and CCNP Success discussion!
Now I just ask that you do us both a favor.
(Okay, the first one's for me.)
If you like this series, be sure to +1 it in Google and share it out any other way you like. All of us here at TBA truly appreciate it.
And right now, head over to Udemy and check out the list of paid and free CCNA, CCNP, and CCNP Security Video Boot Camps I've created for you.
We're contributing 20 meals to the Central Virginia Food Bank for every paid signup in April to any single-exam course, and a whopping 100 meals for every CCNP All-In-One Video Boot Camp.
Ignore the prices you see in the banners -- every single-exam course is only $44, and the CCNP All-In-One Video Boot Camp is only $99!
See you in class!
From all of us at TBA and everyone at the Central Virginia Food Bank -- thank you!