实验需求:
pc1-pc4要求从r4获取dhcp指定ip
sw1-sw4使用mstp+vrrp协议实现负载分担
ar1-ar2-s1-s2使用ospf实现三层通信
ar4设置为dhcp服务器
s1-s2作为dhcp服务器的中继
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
#
interface Vlanif10
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
#
interface Vlanif11
ip address 11.1.1.2 255.255.255.0
#
interface Vlanif20
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
#
interface Vlanif30
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
#
interface Vlanif33
ip address 33.1.1.4 255.255.255.0
#
interface Vlanif40
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
#
interface Vlanif10
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
#
interface Vlanif20
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
#
interface Vlanif30
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
#
interface Vlanif40
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
------------------------------------------------------