Example for Configuring DR Election Through OSPFv3
Networking Requirements
As shown in Figure 6-15, the priority of SwitchA is 100, which is the highest priority on the network; therefore, SwitchA is elected as the DR. SwitchC, which has the second highest priority 2, is elected as the BDR. The priority of SwitchB is 0, which means that it cannot become the DR. SwitchD is not configured with a priority, that is, SwitchD uses the default priority, namely, 1.
Configuration Roadmap
The configuration roadmap is as follows:
Configure IPv6 addresses for interfaces.
Configure the router ID of each Switch, enable OSPFv3, and specify the network segments.
Check the DR/BDR status of each Switch when the default priority is used.
Set the DR priority of the interface on each Switch and check whether the Switch becomes the DR or BDR.
Procedure
- Add interfaces to VLANs.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] vlan 10 [*SwitchA-vlan10] quit [*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10 [*SwitchA-10GE1/0/1] quit [*SwitchA] commit
The configurations of SwitchB, SwitchC, SwitchD are similar to the configuration of SwitchA and are not provided here.
- Assign IPv6 addresses to the VLANIF interfaces.
[~SwitchA] interface vlanif 10 [*SwitchA-Vlanif10] ipv6 enable [*SwitchA-Vlanif10] ipv6 address fc00:0:0:1001::1/64 [*SwitchA-Vlanif10] quit [*SwitchA] commit
The configurations of SwitchB, SwitchC, SwitchD are similar to the configuration of SwitchA and are not provided here.
- Configure the basic OSPFv3 functions.
# On SwitchA, enable OSPFv3 and set the router ID to 10.10.10.1.
[~SwitchA] ospfv3
[*SwitchA-ospfv3-1] router-id 10.10.10.1
[*SwitchA-ospfv3-1] quit
[*SwitchA] interface vlanif 10
[*SwitchA-Vlanif10] ospfv3 1 area 0
[*SwitchA-Vlanif10] quit
[*SwitchA] commit
# On SwitchB, enable OSPFv3 and set the router ID to 10.10.10.2.
[~SwitchB] ospfv3
[*SwitchB-ospfv3-1] router-id 10.10.10.2
[*SwitchB-ospfv3-1] quit
[*SwitchB] interface vlanif 10
[*SwitchB-Vlanif10] ospfv3 1 area 0
[*SwitchB-Vlanif10] quit
[*SwitchB] commit
# On SwitchC, enable OSPFv3 and set the router ID to 10.10.10.3.
[~SwitchC] ospfv3
[*SwitchC-ospfv3-1] router-id 10.10.10.3
[*SwitchC-ospfv3-1] quit
[*SwitchC] interface vlanif 10
[*SwitchC-Vlanif10] ospfv3 1 area 0
[*SwitchC-Vlanif10] quit
[*SwitchC] commit
# On SwitchD, enable OSPFv3 and set the router ID to 10.10.10.4.
[~SwitchD] ospfv3
[*SwitchD-ospfv3-1] router-id 10.10.10.4
[*SwitchD-ospfv3-1] quit
[*SwitchD] interface vlanif 10
[*SwitchD-Vlanif10] ospfv3 1 area 0
[*SwitchD-Vlanif10] quit
[*SwitchD] commit
Check the neighbors of SwitchA. You can view the DR priority and the neighbor status. By default, the DR priority is 1. Now SwitchD functions as the DR and SwitchC functions as the BDR.
When the priorities of two Switches are the same, the Switch that has a greater router ID is elected as the DR. If the VLANIF interface of a Switch becomes the DR, the other broadcast interfaces of this Switch have a high priority in the future DR election. That is, the Switch still functions as the DR. The DR cannot be preempted.
[~SwitchA] display ospfv3 peer OSPFv3 Process (1) Total number of peer(s): 3 Peer(s) in full state: 2 OSPFv3 Area (0.0.0.0) Neighbor ID Pri State Dead Time Interface Instance ID 10.10.10.2 1 2-Way/DROther 00:00:32 Vlanif10 0 10.10.10.3 1 Full/Backup 00:00:36 Vlanif10 0 10.10.10.4 1 Full/DR 00:00:38 Vlanif10 0
# View the neighbors of SwitchD, and you can see that the status of the neighbor relationship between SwitchD and other devices is Full.
[~SwitchD] display ospfv3 peer OSPFv3 Process (1) Total number of peer(s): 3 Peer(s) in full state: 3 OSPFv3 Area (0.0.0.0) Neighbor ID Pri State Dead Time Interface Instance ID 10.10.10.1 1 Full/DROther 00:00:32 Vlanif10 0 10.10.10.2 1 Full/DROther 00:00:35 Vlanif10 0 10.10.10.3 1 Full/Backup 00:00:30 Vlanif10 0
- Configure the DR priorities of interfaces.
# Configure the DR priority of SwitchA to 100.
[~SwitchA] interface vlanif 10
[~SwitchA-Vlanif10] ospfv3 dr-priority 100
[*SwitchA-Vlanif10] quit
[*SwitchA] commit
# Configure the DR priority of SwitchB to 0.
[~SwitchB] interface vlanif 10
[~SwitchB-Vlanif10] ospfv3 dr-priority 0
[*SwitchB-Vlanif10] quit
[*SwitchB] commit
# Configure the DR priority of SwitchC to 2.
[~SwitchC] interface vlanif 10
[~SwitchC-Vlanif10] ospfv3 dr-priority 2
[*SwitchC-Vlanif10] quit
[*SwitchC] commit
# View the neighbors of SwitchA, and you can see that the other DR priority is updated but the DR and BDR are unchanged.
[~SwitchA] display ospfv3 peer OSPFv3 Process (1) Total number of peer(s): 3 Peer(s) in full state: 2 OSPFv3 Area (0.0.0.0) Neighbor ID Pri State Dead Time Interface Instance ID 10.10.10.2 0 2-Way/DROther 00:00:34 Vlanif10 0 10.10.10.3 2 Full/Backup 00:00:38 Vlanif10 0 10.10.10.4 1 Full/DR 00:00:31 Vlanif10 0
# View the neighbors of SwitchD, and you can see that the other DR priority is updated.
[~SwitchD] display ospfv3 peer OSPFv3 Process (1) Total number of peer(s): 3 Peer(s) in full state: 3 OSPFv3 Area (0.0.0.0) Neighbor ID Pri State Dead Time Interface Instance ID 10.10.10.1 100 Full/DROther 00:00:36 Vlanif10 0 10.10.10.2 0 Full/DROther 00:00:30 Vlanif10 0 10.10.10.3 2 Full/Backup 00:00:36 Vlanif10 0
- Perform DR/BDR election again.
# Restart OSPFv3 processes to re-elect the DR and BDR.
- Verify the configuration.
# View the neighbors of SwitchA, and you can see that SwitchC is the BDR.
[~SwitchA] display ospfv3 peer OSPFv3 Process (1) Total number of peer(s): 3 Peer(s) in full state: 3 OSPFv3 Area (0.0.0.0) Neighbor ID Pri State Dead Time Interface Instance ID 10.10.10.2 0 Full/DROther 00:00:31 Vlanif10 0 10.10.10.3 2 Full/Backup 00:00:36 Vlanif10 0 10.10.10.4 1 Full/DROther 00:00:39 Vlanif10 0
# View the neighbors of SwitchD, and you can see that SwitchA is the DR.
[~SwitchD] display ospfv3 peer OSPFv3 Process (1) Total number of peer(s): 3 Peer(s) in full state: 2 OSPFv3 Area (0.0.0.0) Neighbor ID Pri State Dead Time Interface Instance ID 10.10.10.1 100 Full/DR 00:00:39 Vlanif10 0 10.10.10.2 0 2-Way/DROther 00:00:35 Vlanif10 0 10.10.10.3 2 Full/Backup 00:00:39 Vlanif10 0
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # vlan batch 10 # ospfv3 1 router-id 10.10.10.1 area 0.0.0.0 # interface Vlanif10 ipv6 enable ipv6 address FC00:0:0:1001::1/64 ospfv3 1 area 0.0.0.0 ospfv3 dr-priority 100 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # return
Configuration file of SwitchB
# sysname SwitchB # vlan batch 10 # ospfv3 1 router-id 10.10.10.2 area 0.0.0.0 # interface Vlanif10 ipv6 enable ipv6 address FC00:0:0:1001::2/64 ospfv3 1 area 0.0.0.0 ospfv3 dr-priority 0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # return
Configuration file of SwitchC
# sysname SwitchC # vlan batch 10 # ospfv3 1 router-id 10.10.10.3 area 0.0.0.0 # interface Vlanif10 ipv6 enable ipv6 address FC00:0:0:1001::3/64 ospfv3 1 area 0.0.0.0 ospfv3 dr-priority 2 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # return
Configuration file of SwitchD
# sysname SwitchD # vlan batch 10 # ospfv3 1 router-id 10.10.10.4 area 0.0.0.0 # interface Vlanif10 ipv6 enable ipv6 address FC00:0:0:1001::4/64 ospfv3 1 area 0.0.0.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # return