How to Configure OSPF Priority on Cisco IOS XE
This is the command for setting the OSPF DR/BDR priority on Cisco IOS XE. It is specified in interface configuration mode. For the roles of the DR and BDR and how they are elected, see OSPF DR and BDR.
interface [INTERFACE_NAME]
ip ospf priority [PRIORITY]| Field | Value |
|---|---|
| [INTERFACE_NAME] | The target interface (e.g. GigabitEthernet1) |
| [PRIORITY] | 0 to 255. The default is 1. A higher value is more likely to become the DR. A value of 0 makes the router ineligible to become either the DR or the BDR |
Priority is only meaningful on broadcast networks. No DR or BDR is elected on point-to-point links, so configuring it there has no effect.
The Interface Is the Only Place to Configure It
On IOS XE, the DR/BDR priority can only be set with ip ospf priority under the interface. There is no way to set it for the whole device or a whole area at once, so it is configured per interface for each segment.
priority command under router ospf, but it is not the DR/BDR priority. Its help text is <0-127> OSPF topology priority, the topology priority for MTR (Multi-Topology Routing), and its range differs from the DR/BDR priority (0-255). Configuring priority 77 under router ospf leaves the priority in show ip ospf interface at its default of 1.On IOS XR the priority can be written under router ospf, under area, or under interface, and the value at a higher level is inherited by the lower ones (IOS XR OSPF DR/BDR Priority Configuration). The range (0-255) and the default (1) are the same on both.
Cisco IOS XE Priority Verification Commands
| Command | What it shows |
|---|---|
show ip ospf interface brief | The state of each interface (DR / BDR / DROTHER) and the neighbor count. Use it to see the roles at a glance |
show ip ospf interface [INTERFACE_NAME] | The priority of that interface, the router ID and address of the DR and BDR, and the Wait timer |
show ip ospf neighbor | The priority of each neighbor (the Pri column) and its state (FULL/DR, FULL/BDR, 2WAY/DROTHER) |
show ip ospf neighbor detail | The priority and DR/BDR details for each neighbor |
show running-config interface [INTERFACE_NAME] | The configured priority value |
Two DROTHERs do not form an adjacency with each other, so show ip ospf neighbor stops at 2WAY/DROTHER between them. This is not a fault.
clear ip ospf process, which asks Reset ALL OSPF processes? [no]:.Verification on Real Devices
Four routers, XE1 to XE4, are connected to a single Ethernet segment (10.0.0.0/24), and the election result is checked with different priorities.
| Router | Router ID | Priority | Expected role |
|---|---|---|---|
| XE1 | 1.1.1.1 | 100 | DR |
| XE2 | 2.2.2.2 | 50 | BDR |
| XE3 | 3.3.3.3 | 0 | DROTHER (ineligible because the priority is 0) |
| XE4 | 4.4.4.4 | default 1 | DROTHER |
XE4 has the highest router ID but the lowest priority, so it becomes a DROTHER. This arrangement shows that the priority is considered before the router ID. The devices are Catalyst 8000V (IOS XE 17.18.02).
Configuring the Priority
A priority of 100 is configured on XE1. The priority goes under the interface while OSPF is enabled under router ospf, so the two are configured in different places.
XE1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
XE1(config)#interface GigabitEthernet1
XE1(config-if)# ip ospf priority 100
XE1(config-if)# exit
XE1(config)#router ospf 1
XE1(config-router)# router-id 1.1.1.1
XE1(config-router)# network 1.1.1.1 0.0.0.0 area 0
XE1(config-router)# network 10.0.0.0 0.0.0.255 area 0
XE1(config-router)# passive-interface Loopback0
XE1(config-router)#end
XE1#show running-config interface GigabitEthernet1
Building configuration...
Current configuration : 142 bytes
!
interface GigabitEthernet1
description to SW (10.0.0.0/24)
ip address 10.0.0.1 255.255.255.0
ip ospf priority 100
negotiation auto
endThe configuration of the four routers is as follows. Only XE4 has no priority configured and keeps the default of 1.
interface GigabitEthernet1
ip address 10.0.0.1 255.255.255.0
ip ospf priority 100
!
router ospf 1
router-id 1.1.1.1
passive-interface Loopback0
network 1.1.1.1 0.0.0.0 area 0
network 10.0.0.0 0.0.0.255 area 0interface GigabitEthernet1
ip address 10.0.0.2 255.255.255.0
ip ospf priority 50
!
router ospf 1
router-id 2.2.2.2
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 10.0.0.0 0.0.0.255 area 0interface GigabitEthernet1
ip address 10.0.0.3 255.255.255.0
ip ospf priority 0
!
router ospf 1
router-id 3.3.3.3
passive-interface Loopback0
network 3.3.3.3 0.0.0.0 area 0
network 10.0.0.0 0.0.0.255 area 0interface GigabitEthernet1
ip address 10.0.0.4 255.255.255.0
!
router ospf 1
router-id 4.4.4.4
passive-interface Loopback0
network 4.4.4.4 0.0.0.0 area 0
network 10.0.0.0 0.0.0.255 area 0Verifying the Configuration
The State column of show ip ospf interface brief shows the router’s own role. XE1 has the highest priority, so it becomes the DR and is adjacent with all three other routers (Nbrs F/C is 3/3).
XE1#show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 0 1.1.1.1/32 1 LOOP 0/0
Gi1 1 0 10.0.0.1/24 1 DR 3/3Seen from XE1, the DR, the priorities of the other three routers appear in the Pri column. The 0 on XE3 and the 1 on XE4 are the configured value and the default.
XE1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 50 FULL/BDR 00:00:32 10.0.0.2 GigabitEthernet1
3.3.3.3 0 FULL/DROTHER 00:00:34 10.0.0.3 GigabitEthernet1
4.4.4.4 1 FULL/DROTHER 00:00:37 10.0.0.4 GigabitEthernet1XE2, with a priority of 50, is the BDR, and the remaining two are DROTHERs. XE4 has the highest router ID (4.4.4.4) yet is a DROTHER, which shows that the priority is examined before the router ID.
The view from XE4, a DROTHER, is different.
XE4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 100 FULL/DR 00:00:36 10.0.0.1 GigabitEthernet1
2.2.2.2 50 FULL/BDR 00:00:36 10.0.0.2 GigabitEthernet1
3.3.3.3 0 2WAY/DROTHER 00:00:38 10.0.0.3 GigabitEthernet1It is FULL with the DR and the BDR, but it stops at 2WAY/DROTHER with XE3, the other DROTHER. Two DROTHERs do not synchronize their LSDBs, so this is not a fault. In show ip ospf interface brief the Nbrs F/C of XE4 is 2/3 (three neighbors detected, two of them adjacent).
Here is the interface of XE3, which was configured with a priority of 0.
XE3#show ip ospf interface GigabitEthernet1
GigabitEthernet1 is up, line protocol is up
Internet Address 10.0.0.3/24, Interface ID 5, Area 0
Attached via Network Statement
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1
Topology-MTID Cost Disabled Shutdown Topology Name
0 1 no no Base
Transmit Delay is 1 sec, State DROTHER, Priority 0
Designated Router (ID) 1.1.1.1, Interface address 10.0.0.1
Backup Designated router (ID) 2.2.2.2, Interface address 10.0.0.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:07
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/2/2, flood queue length 0
Next 0x0(0)/0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 3, Adjacent neighbor count is 2
Adjacent with neighbor 1.1.1.1 (Designated Router)
Adjacent with neighbor 2.2.2.2 (Backup Designated Router)
Suppress hello for 0 neighbor(s)It reads State DROTHER, Priority 0, and it is adjacent only with the DR and the BDR. A priority of 0 makes a router ineligible for both roles, so it does not become the DR even if no other router is present on the segment.
Verification Configuration and show Output
The following three kinds of output were collected from all four routers, in separate files per router. The verification configuration is the ..._run.txt file.
| File | Contents |
|---|---|
..._show.txt | show version / show interfaces description / show ip interface brief / show ip route / show ip protocols / show ip ospf / show ip ospf interface / show ip ospf interface brief / show ip ospf neighbor / show ip ospf neighbor detail / show ip ospf database / show ip ospf database router / show ip ospf database network / show ip route ospf / show ip ospf statistics |
..._log.txt | show logging narrowed down from a send log marker that was inserted just before OSPF was configured. It contains the %OSPF-5-ADJCHG messages where the adjacencies reach FULL |
..._run.txt | show running-config (that is, the verification configuration) |
| Router | show output | syslog | running-config |
|---|---|---|---|
| XE1 | show | log | run |
| XE2 | show | log | run |
| XE3 | show | log | run |
| XE4 | show | log | run |
Related Articles
For how the DR and BDR work, see OSPF DR and BDR. The configuration on IOS XR is covered in IOS XR OSPF DR/BDR Priority Configuration.