Skip to main content
  1. Router and Switch Articles/
  2. IOS-XR/

IOS XR OSPF DR/BDR Priority Configuration

Table of Contents

How to Configure OSPF Priority on Cisco IOS XR

This is the command for setting the OSPF DR/BDR priority on Cisco IOS XR. You specify it in the interface submode under router ospf. For the roles of DR and BDR and how the election works, see OSPF DR and BDR.

IOS XR OSPF Priority Configuration
router ospf [PROCESS_NAME]
 area [AREA_ID]
  interface [INTERFACE_NAME]
   priority [PRIORITY]
  !
 !
!
FieldValue
[PRIORITY]0 to 255. The default is 1. The higher the value, the more likely the router becomes the DR. A value of 0 means the router never becomes DR or BDR

Priority only matters on broadcast networks. Point-to-point links do not elect a DR or BDR, so setting it there has no effect.

Where the Setting Can Be Written

Priority can be written directly under router ospf, under area, or under interface. A value written at a higher level is inherited by the lower levels, and a value written at a lower level takes precedence. Write it under the interface when it differs per segment, and directly under the process when it should be the same across the device.

IOS XR OSPF Priority for an Entire Area
router ospf [PROCESS_NAME]
 area [AREA_ID]
  priority [PRIORITY]
  interface [INTERFACE_NAME]
  !
 !
!
On IOS XE you write ip ospf priority <value> under interface. The range (0 to 255) and the default (1) are the same as IOS XR, but IOS XR differs in that the value can also be written at the process and area levels and is inherited downwards.

Cisco IOS XR Priority Verification Commands

CommandWhat it shows
show ospf interface briefThe state of each interface (DR / BDR / DROTHER) and its neighbor count. A one-line-per-interface view of the roles
show ospf interface [INTERFACE_NAME]The priority of that interface, the router ID and address of the DR and BDR, and the Wait timer
show ospf neighborThe priority of each neighbor (the Pri column) and its state (FULL/DR, FULL/BDR, 2WAY/DROTHER)
show ospf neighbor detailPer-neighbor priority and DR/BDR details
show running-config router ospfThe configured priority values

DROTHERs do not form adjacencies with each other, so show ospf neighbor shows them as 2WAY/DROTHER. That is not a fault.

Changing the priority does not replace a DR that has already been elected. The DR changes only when the current DR goes down. To apply the change you have to restart OSPF on that segment. On IOS XR, clear ospf <process-name> process does this but prompts with Reset OSPF process? [no]:. process restart ospf achieves the same thing without a prompt.

Verification on Real Devices

We connected four routers, XR1 to XR4, to a single Ethernet segment (10.0.0.0/24) and varied the priority to observe the election result.

RouterRouter IDPriorityExpected role
XR11.1.1.1100DR
XR22.2.2.250BDR
XR33.3.3.30DROTHER (excluded from the election)
XR44.4.4.4default 1DROTHER

XR4 has the highest router ID but the lowest priority, so it becomes a DROTHER. The layout shows that priority takes precedence over the router ID.

Configuring the Priority

XR1 OSPF Priority Configuration
router ospf 1
 router-id 1.1.1.1
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   priority 100
  !
 !
!
XR2 OSPF Priority Configuration
router ospf 1
 router-id 2.2.2.2
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   priority 50
  !
 !
!
XR3 OSPF Priority Configuration
router ospf 1
 router-id 3.3.3.3
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   priority 0
  !
 !
!
XR4 OSPF Priority Configuration
router ospf 1
 router-id 4.4.4.4
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
!

XR4 has no priority configured. It runs with the default of 1.

Here is the configuration being entered on XR1.

XR1 Priority Configuration Example
RP/0/RP0/CPU0:XR1#configure
Thu Sep 10 07:14:19.388 UTC
RP/0/RP0/CPU0:XR1(config)#router ospf 1
RP/0/RP0/CPU0:XR1(config-ospf)#router-id 1.1.1.1
RP/0/RP0/CPU0:XR1(config-ospf)#area 0
RP/0/RP0/CPU0:XR1(config-ospf-ar)#interface Loopback0
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#passive enable
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR1(config-ospf-ar)#interface GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#priority 100
RP/0/RP0/CPU0:XR1(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR1(config-ospf-ar)#commit
Thu Sep 10 07:14:20.556 UTC
RP/0/RP0/CPU0:XR1(config-ospf-ar)#end
RP/0/RP0/CPU0:XR1#show running-config router ospf
Thu Sep 10 07:14:23.091 UTC
router ospf 1
 router-id 1.1.1.1
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   priority 100
  !
 !
!

Verifying the Configuration

show ospf interface brief shows the roles. XR1 has the highest priority, so it becomes the DR and is adjacent to all three other routers on the segment.

XR1 show ospf interface brief
RP/0/RP0/CPU0:XR1#show ospf interface brief
Thu Sep 10 07:17:19.803 UTC

* Indicates MADJ interface, (P) Indicates fast detect hold down state

Interfaces for OSPF 1

Interface          PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0                1     0               1.1.1.1/32         1     LOOP  0/0
Gi0/0/0/0          1     0               10.0.0.1/24        1     DR    3/3

The Pri column of show ospf neighbor shows each router’s priority. Seen from XR1, the DR, all three routers are FULL.

XR1 show ospf neighbor
RP/0/RP0/CPU0:XR1#show ospf neighbor
Thu Sep 10 07:17:20.527 UTC

* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up

Neighbors for OSPF 1

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2         50    FULL/BDR        00:00:31    10.0.0.2        GigabitEthernet0/0/0/0
    Neighbor is up for 00:01:05
3.3.3.3         0     FULL/DROTHER    00:00:32    10.0.0.3        GigabitEthernet0/0/0/0
    Neighbor is up for 00:01:03
4.4.4.4         1     FULL/DROTHER    00:00:35    10.0.0.4        GigabitEthernet0/0/0/0
    Neighbor is up for 00:01:00

Total neighbor count: 3

The view from XR4, a DROTHER, is different. It is FULL with XR1 (the DR) and XR2 (the BDR), but stays at 2WAY/DROTHER with XR3, the other DROTHER. DROTHERs do not form adjacencies with each other, so this is not a fault.

XR4 show ospf neighbor
RP/0/RP0/CPU0:XR4#show ospf neighbor
Thu Sep 10 07:18:16.904 UTC

* Indicates MADJ interface
# Indicates Neighbor awaiting BFD session up

Neighbors for OSPF 1

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1         100   FULL/DR         00:00:38    10.0.0.1        GigabitEthernet0/0/0/0
    Neighbor is up for 00:02:04
2.2.2.2         50    FULL/BDR        00:00:30    10.0.0.2        GigabitEthernet0/0/0/0
    Neighbor is up for 00:02:02
3.3.3.3         0     2WAY/DROTHER    00:00:32    10.0.0.3        GigabitEthernet0/0/0/0
    Neighbor is up for 00:02:00

Total neighbor count: 3

Looking at the interface on XR3, which is set to priority 0, it reports State DROTHER, Priority 0. It does not become the BDR despite having a higher router ID than XR2, because priority 0 is excluded from the election. It is adjacent only to the DR and the BDR.

XR3 show ospf interface GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:XR3#show ospf interface GigabitEthernet0/0/0/0
Thu Sep 10 07:18:32.459 UTC

GigabitEthernet0/0/0/0 is up, line protocol is up 
  Internet Address 10.0.0.3/24, Area 0, SID 0, Strict-SPF SID 0
  Label stack Primary label 0 Backup label 0 SRTE label 0
  Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State DROTHER, Priority 0, MTU 1500, MaxPktSz 1500
  Forward reference No, Unnumbered no,  Bandwidth 1000000 
  RIB LC sync Yes
  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
    Hello due in 00:00:04:559
  Index 2/2, flood queue length 0
  Next 0(0)/0(0)
  Last flood scan length is 0, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  LS Ack List: current length 0, high water mark 3
  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)
  Multi-area interface Count is 0
  Segment Routing Forwarding MPLS enabled: Yes
  Adjacency hold timer expired last : Never
  Exchange timer expired last : Never

Test Configuration and show Output

The following three kinds of output were collected from all four routers, split per router. The test configuration is these ..._run.txt files.

FileContents
..._show.txtshow version / show interface description / show route / show route ospf / show ospf / show ospf interface / show ospf interface brief / show ospf neighbor / show ospf neighbor detail / show ospf database / show ospf database router / show ospf database network / show ospf statistics interface / show ospf routes / show ospf statistics / show router-id / show ospf trace events
..._log.txtshow logging, taken by inserting a marker with logmsg just before configuring OSPF and passing its timestamp to show logging start
..._run.txtshow running-config (that is, the test configuration)
Routershow outputsyslogrunning-config
XR1showlogrun
XR2showlogrun
XR3showlogrun
XR4showlogrun

Related Articles

For how DR and BDR work, see OSPF DR and BDR. For basic OSPF configuration, see IOS XR OSPF Basic Configuration.