This section describes how to set the DR priority on an interface for DR election on a broadcast network.
On the network shown in Figure 1, the interface of Device A has the highest priority of 100 on the network and is elected as the DR; Device C has the second highest priority and is elected as the BDR. Device B has the priority of 0 and cannot be elected as a DR or a BDR; no priority is configured for Device D and therefore, Device D uses the default value (1).
Reconfiguring the DR priority for a router does not change the DR or BDR on a network. You can use either of the following methods to re-elect a DR or BDR. However, the following methods will disconnect OSPF neighbors. Therefore, use the following methods only when necessary.
Restart the OSPF processes on all routers.
Configure the shutdown and undo shutdown commands on the interfaces where the OSPF neighboring relationships are established.
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
Use the default DR priorities and check whether the router is the DR or BDR.
Configure the DR priority on an interface and check whether the device is the DR or BDR.
To complete the configuration, you need the following data:
Router ID (1.1.1.1) and priority (100) of Device A
Router ID (2.2.2.2) and priority (0) of Device B
Router ID (3.3.3.3) and priority (2) of Device C
Router ID (4.4.4.4) and priority (1) of Device D
# Configure DeviceA.
<HUAWEI> system-view [~DeviceA] router id 1.1.1.1 [~DeviceA] ospf 1 [*DeviceA-ospf-1] area 0 [*DeviceA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [*DeviceA-ospf-1-area-0.0.0.0] commit [~DeviceA-ospf-1-area-0.0.0.0] quit
# Configure DeviceB.
<HUAWEI> system-view [~DeviceB] router id 2.2.2.2 [~DeviceB] ospf 1 [*DeviceB-ospf-1] area 0 [*DeviceB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [*DeviceB-ospf-1-area-0.0.0.0] commit [~DeviceB-ospf-1-area-0.0.0.0] quit
# Configure DeviceC.
<HUAWEI> system-view [~DeviceC] router id 3.3.3.3 [~DeviceC] ospf 1 [*DeviceC-ospf-1] area 0 [*DeviceC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [*DeviceC-ospf-1-area-0.0.0.0] commit [~DeviceC-ospf-1-area-0.0.0.0] quit
# Configure DeviceD.
<HUAWEI> system-view [~DeviceD] router id 4.4.4.4 [~DeviceD] ospf 1 [*DeviceD-ospf-1] area 0 [*DeviceD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [*DeviceD-ospf-1-area-0.0.0.0] commit [~DeviceD-ospf-1-area-0.0.0.0] quit
# Display the status of the DR or BDR.
[~DeviceA] display ospf peer OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface 192.168.1.1 ( GE0/1/0 )'s neighbors Router ID: 2.2.2.2 Address: 192.168.1.2 State: 2-Way Mode:Nbr is Slave Priority: 1 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 32 sec Retrans timer interval: 0 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.1 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.3 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 34 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.1 ( GE0/1/0 )'s neighbors Router ID: 4.4.4.4 Address: 192.168.1.4 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 32 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
Check the neighbor information of DeviceA. You can view the DR priority and the neighbor status. By default, the DR priority is 1. Now DeviceD functions as the DR and DeviceC functions as the BDR.
# Configure Device A.
[~DeviceA] interface gigabitethernet 0/1/0 [~DeviceA-GigabitEthernet0/1/0] ospf dr-priority 100 [*DeviceA-GigabitEthernet0/1/0] commit [~DeviceA-GigabitEthernet0/1/0] quit
# Configure Device B.
[~DeviceB] interface gigabitethernet 0/1/0 [~DeviceB-GigabitEthernet0/1/0] ospf dr-priority 0 [*DeviceB-GigabitEthernet0/1/0] commit [~DeviceB-GigabitEthernet0/1/0] quit
# Configure Device C.
[~DeviceC] interface gigabitethernet 0/1/0 [~DeviceC-GigabitEthernet0/1/0] ospf dr-priority 2 [*DeviceC-GigabitEthernet0/1/0] commit [~DeviceC-GigabitEthernet0/1/0] quit
# Display the status of the DR or BDR.
[~DeviceD] display ospf peer OSPF Process 1 with Router ID 4.4.4.4 Neighbors Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 1.1.1.1 Address: 192.168.1.1 State: Full Mode:Nbr is Slave Priority: 100 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 38 sec Retrans timer interval: 5 Neighbor is up for 2h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 2.2.2.2 Address: 192.168.1.2 State: Full Mode:Nbr is Slave Priority: 0 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 38 sec Retrans timer interval: 5 Neighbor is up for 2h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.3 State: Full Mode:Nbr is Slave Priority: 2 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 30 sec Retrans timer interval: 5 Neighbor is up for 2h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
In the user view of each router, run the reset ospf 1 process command to restart the OSPF process.
# Display the status of OSPF neighbors.
[~DeviceD] display ospf peer OSPF Process 1 with Router ID 4.4.4.4 Neighbors Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 1.1.1.1 Address: 192.168.1.1 State: Full Mode:Nbr is Slave Priority: 100 DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 5 Neighbor is up for 3h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 2.2.2.2 Address: 192.168.1.2 State: 2-Way Mode:Nbr is Slave Priority: 0 DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 0 Neighbor is up for 3h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.3 State: Full Mode:Nbr is Slave Priority: 2 DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0 Dead timer due in 37 sec Retrans timer interval: 5 Neighbor is up for 3h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
# Display the status of OSPF interfaces.
[~DeviceA] display ospf interface 2020-11-21 15:55:20.606 (M) Indicates MADJ interface OSPF Process 1 with Router ID 1.1.1.1 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) Interface IP Address Type State Cost Pri GigabitEthernet0/1/0 192.168.1.1 Broadcast DR 1 100 [~DeviceB] display ospf interface 2020-11-21 15:55:20.606 (M) Indicates MADJ interface OSPF Process 1 with Router ID 2.2.2.2 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) Interface IP Address Type State Cost Pri GigabitEthernet0/1/0 192.168.1.2 Broadcast DROther 1 100
If the neighbor is in the Full state, the device has established a neighbor relationship with its neighbor. If the neighbor remains in the 2-Way state, neither of them is the DR or BDR. In this case, they do not need to exchange LSAs.
If the status of the OSPF interface is DROther, the interface is neither DR nor BDR.
Device A configuration file
# sysname DeviceA # router id 1.1.1.1 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.1.1 255.255.255.0 ospf dr-priority 100 # ospf 1 area 0.0.0.0 network 192.168.1.0 0.0.0.255 # return
Device B configuration file
# sysname DeviceB # router id 2.2.2.2 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.1.2 255.255.255.0 ospf dr-priority 0 # ospf 1 area 0.0.0.0 network 192.168.1.0 0.0.0.255 # return
Device C configuration file
# sysname DeviceC # router id 3.3.3.3 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.1.3 255.255.255.0 ospf dr-priority 2 # ospf 1 area 0.0.0.0 network 192.168.1.0 0.0.0.255 # return
Device D configuration file
# sysname DeviceD # router id 4.4.4.4 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.1.4 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.1.0 0.0.0.255 # return