OSPF+MSTP+VRRP+DHCP networking experiment

Experimental requirements:

pc1-pc4 requires obtaining the dhcp specified ip from r4

sw1-sw4 uses mstp + vrrp protocol to achieve load sharing

ar1-ar2-s1-s2 uses ospf to implement three-layer communication

ar4 is set as dhcp server

s1-s2 acts as a relay for the dhcp server

SW1
<sw1>display current-configuration
#
sysname sw1
#
undo info-center enable
#
vlan batch 10 to 11 20 30 33 40
#
stp instance 1 root primary
stp instance 2 root secondary
#
dhcp enable
#
stp region-configuration
 region-name huawei
 revision-level 1
 instance 1 vlan 10 20
 instance 2 vlan 30 40
 active region-configuration
#
interfaceVlanif10
 IP address 192.168.10.251 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 vrrp vrid 10 priority 120
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interfaceVlanif11
 IP address 11.1.1.2 255.255.255.0
#
interfaceVlanif20
 IP address 192.168.20.251 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 vrrp vrid 20 priority 120
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interfaceVlanif30
 IP address 192.168.30.251 255.255.255.0
 vrrp vrid 30 virtual-ip 192.168.30.254
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interfaceVlanif33
 IP address 33.1.1.4 255.255.255.0
#
interfaceVlanif40
 IP address 192.168.40.251 255.255.255.0
 vrrp vrid 40 virtual-ip 192.168.40.254
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interface MEth0/0/1
#
interface Eth-Trunk12
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
 mode lacp-static
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 11
#
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 33
#
interface GigabitEthernet0/0/5
 eth-trunk 12
#
interface GigabitEthernet0/0/6
 eth-trunk 12
#
ospf 1 router-id 11.11.11.11
 import-route direct
 area 0.0.0.0
  network 11.1.1.2 0.0.0.0
  network 33.1.1.4 0.0.0.0
-------------------------------------------------- ----
sw2
#
sysname sw2
#
undo info-center enable
#
vlan batch 10 20 22 30 40 44
#
stp instance 1 root secondary
stp instance 2 root primary
#
dhcp enable
#
stp region-configuration
 region-name huawei
 revision-level 1
 instance 1 vlan 10 20
 instance 2 vlan 30 40
 active region-configuration
#
interfaceVlanif10
 IP address 192.168.10.252 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interfaceVlanif20
 IP address 192.168.20.252 255.255.255.0
 vrrp vrid 20 virtual-ip 192.168.20.254
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interface Vlanif22
 IP address 22.1.1.2 255.255.255.0
#
interfaceVlanif30
 IP address 192.168.30.252 255.255.255.0
 vrrp vrid 30 virtual-ip 192.168.30.254
 vrrp vrid 30 priority 120
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interfaceVlanif40
 IP address 192.168.40.252 255.255.255.0
 vrrp vrid 40 virtual-ip 192.168.40.254
 vrrp vrid 40 priority 120
 dhcp select relay
 dhcp relay server-ip 14.1.1.4
#
interface Vlanif44
 IP address 44.1.1.2 255.255.255.0
#
interface MEth0/0/1
#
interface Eth-Trunk12
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
 mode lacp-static
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 22
#
interface GigabitEthernet0/0/4
 eth-trunk 12
#
interface GigabitEthernet0/0/5
 eth-trunk 12
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
 port link-type access
 port default vlan 44
#
ospf 1 router-id 22.22.22.22
 import-route direct
 area 0.0.0.0
  network 22.1.1.2 0.0.0.0
  network 44.1.1.2 0.0.0.0
-------------------------------------------------- ----
SW3
#
sysname sw3
#
vlan batch 10 20 30 40
#
stp region-configuration
 region-name huawei
 revision-level 1
 instance 1 vlan 10 20
 instance 2 vlan 30 40
 active region-configuration
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 10
 stp edged-port enable
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 20
 stp edged-port enable
#
interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/5
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
-------------------------------------------------- ----
SW4
#
sysname sw4
#
vlan batch 10 20 30 40
#
stp region-configuration
 region-name huawei
 revision-level 1
 instance 1 vlan 10 20
 instance 2 vlan 30 40
 active region-configuration
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 30
 stp edged-port enable
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 40
 stp edged-port enable
#
interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/5
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
-------------------------------------------------- ----
AR1
#
 sysname ar1
#
interface Ethernet3/0/1
 IP address 44.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/0
 IP address 11.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 IP address 14.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
 IP address 12.1.1.1 255.255.255.0
#
ospf 1 router-id 1.1.1.1
 area 0.0.0.0
  network 11.1.1.1 0.0.0.0
  network 12.1.1.1 0.0.0.0
  network 14.1.1.1 0.0.0.0
  network 44.1.1.1 0.0.0.0
-------------------------------------------------- ----
AR2
#
 sysname ar2
#
interface GigabitEthernet0/0/0
 IP address 33.1.1.3 255.255.255.0
#
interface GigabitEthernet0/0/1
 IP address 22.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
 IP address 12.1.1.2 255.255.255.0
#
ospf 1 router-id 2.2.2.2
 area 0.0.0.0
  network 12.1.1.2 0.0.0.0
  network 22.1.1.1 0.0.0.0
  network 33.1.1.3 0.0.0.0
-------------------------------------------------- ----