Example for Configuring OSPFv3 DR Election
Networking Requirements
In Figure 6-12, RouterA has a DR priority of 100, which is the highest in the network, so it is elected as the DR. RouterC has the second highest priority, so it is elected as the BDR. The priority of RouterB is 0 so that it cannot be elected as the DR and BDR. RouterD does not have a priority and the priority is 1 by default.
Configuration Roadmap
The configuration roadmap is as follows:
Configure the router ID on each router, enable OSPFv3, and specify the network segment.
Check the DR/BDR status with the default priority.
Configure the DR priority on the interface and check the DR/BDR status.
Procedure
- Assign an IPv6 address for each interface.
# Configure IPv6 addresses for interfaces on RouterA.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] ipv6
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ipv6 enable
[RouterA-GigabitEthernet1/0/0] ipv6 address 1001::1/64
The configurations of RouterB, RouterC and RouterD are similar to the configuration of RouterA, and are not mentioned here.
- Configure basic OSPFv3 functions.
# Configure RouterA, enable OSPFv3, and set its router ID to 1.1.1.1.
[RouterA] ipv6
[RouterA] ospfv3
[RouterA-ospfv3-1] router-id 1.1.1.1
[RouterA-ospfv3-1] quit
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ospfv3 1 area 0
[RouterA-GigabitEthernet1/0/0] quit
# Configure RouterB, enable OSPFv3, and set its Router ID to 2.2.2.2.
[RouterB] ipv6
[RouterB] ospfv3
[RouterB-ospfv3-1] router-id 2.2.2.2
[RouterB-ospfv3-1] quit
[RouterB] interface gigabitethernet 1/0/0
[RouterB-GigabitEthernet1/0/0] ospfv3 1 area 0
[RouterB-GigabitEthernet1/0/0] quit
# Configure RouterC, enable OSPFv3, and set its Router ID to 3.3.3.3.
[RouterC] ipv6
[RouterC] ospfv3
[RouterC-ospfv3-1] router-id 3.3.3.3
[RouterC-ospfv3-1] quit
[RouterC] interface gigabitethernet 1/0/0
[RouterC-GigabitEthernet1/0/0] ospfv3 1 area 0
[RouterC-GigabitEthernet1/0/0] quit
# Configure RouterD, enable OSPFv3, and set its Router ID to 4.4.4.4.
[RouterD] ipv6
[RouterD] ospfv3
[RouterD-ospfv3-1] router-id 4.4.4.4
[RouterD-ospfv3-1] quit
[RouterD] interface gigabitethernet 1/0/0
[RouterD-GigabitEthernet1/0/0] ospfv3 1 area 0
[RouterD-GigabitEthernet1/0/0] quit
# Display the neighbors of RouterA. You can view the DR priority (its default value is 1) and the neighbor status. RouterD is the DR and RouterC is the BDR.
The router with the greater router ID is the DR when routers have the same priority. If a certain Ethernet interface of a router becomes a DR, the other broadcast interfaces of the router have the highest priority in DR election. That is, the DR router is elected as the DR.
[RouterA] display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
2.2.2.2 1 2-Way/DROther 00:00:32 GE1/0/0 0
3.3.3.3 1 Full/Backup 00:00:36 GE1/0/0 0
4.4.4.4 1 Full/DR 00:00:38 GE1/0/0 0
# Display the neighbors of RouterD, and you can view that all neighbors of RouterD are in the Full state.
[RouterD] display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
1.1.1.1 1 Full/DROther 00:00:32 GE1/0/0 0
2.2.2.2 1 Full/DROther 00:00:35 GE1/0/0 0
3.3.3.3 1 Full/Backup 00:00:30 GE1/0/0 0
- Set the DR priority of the interface.
# Set the DR priority of RouterA to 100.
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ospfv3 dr-priority 100
[RouterA-GigabitEthernet1/0/0] quit
# Set the DR priority of RouterB to 0.
[RouterB] interface gigabitethernet 1/0/0
[RouterB-GigabitEthernet1/0/0] ospfv3 dr-priority 0
[RouterB-GigabitEthernet1/0/0] quit
# Set the DR priority of RouterC to 2.
[RouterC] interface gigabitethernet 1/0/0
[RouterC-GigabitEthernet1/0/0] ospfv3 dr-priority 2
[RouterC-GigabitEthernet1/0/0] quit
# Display the neighbors of RouterA, and you can view that the DR priority is updated and the DR and BDR remain unchanged.
[RouterA] display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
2.2.2.2 0 2-Way/DROther 00:00:34 GE1/0/0 0
3.3.3.3 2 Full/Backup 00:00:38 GE1/0/0 0
4.4.4.4 1 Full/DR 00:00:31 GE1/0/0 0
# Display the neighbors of RouterD, and you can view that RouterD remains as the DR.
[RouterD] display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
1.1.1.1 100 Full/DROther 00:00:36 GE1/0/0 0
2.2.2.2 0 Full/DROther 00:00:30 GE1/0/0 0
3.3.3.3 2 Full/Backup 00:00:36 GE1/0/0 0
- Re-elect the DR/BDR.
# Restart all routers (or run the shutdown and undo shutdown commands on the interface that establishes the OSPFv3 neighbor relationship), and make OSPFv3 re-elect the DR/BDR.
- Verify the configuration.
# Display the neighbors of RouterA, and you can view that RouterC is the BDR.
[RouterA] display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
2.2.2.2 0 Full/DROther 00:00:31 GE1/0/0 0
3.3.3.3 2 Full/Backup 00:00:36 GE1/0/0 0
4.4.4.4 1 Full/DROther 00:00:39 GE1/0/0 0
# Display the neighbors of RouterD, and you can view that RouterA is the DR.
[RouterD] display ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
1.1.1.1 100 Full/DR 00:00:39 GE1/0/0 0
2.2.2.2 0 2-Way/DROther 00:00:35 GE1/0/0 0
3.3.3.3 2 Full/Backup 00:00:39 GE1/0/0 0
Configuration Files
Configuration file of RouterA
#
sysname RouterA
#
ipv6
#
interface GigabitEthernet1/0/0
ipv6 enable
ipv6 address 1001::1/64
ospfv3 1 area 0.0.0.0
ospfv3 dr-priority 100
#
ospfv3 1
router-id 1.1.1.1
#
return
Configuration file of RouterB
#
sysname RouterB
#
ipv6
#
interface GigabitEthernet1/0/0
ipv6 enable
ipv6 address 1001::2/64
ospfv3 1 area 0.0.0.0
ospfv3 dr-priority 0
#
ospfv3 1
router-id 2.2.2.2
#
return
Configuration file of RouterC
#
sysname RouterC
#
ipv6
#
interface GigabitEthernet1/0/0
ipv6 enable
ipv6 address 1001::3/64
ospfv3 1 area 0.0.0.0
ospfv3 dr-priority 2
#
ospfv3 1
router-id 3.3.3.3
#
return
Configuration file of RouterD
#
sysname RouterD
#
ipv6
#
interface GigabitEthernet1/0/0
ipv6 enable
ipv6 address 1001::4/64
ospfv3 1 area 0.0.0.0
#
ospfv3 1
router-id 4.4.4.4
#
return