1.四个交换机上分别配置VLAN10,20,30
[S1]vlan batch 10 20 30
[S2]vlan batch 10 20 30
[S3]vlan batch 10 20 30
[S4]vlan batch 10 20 30
2.配置trunk接口和access接口
LSW1:
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
LSW2:
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
LSW3:
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/3
port link-type access
port default vlan 30
LSW4:
interface Ethernet0/0/1
port link-type access
port default vlan 10
#
interface Ethernet0/0/2
port link-type access
port default vlan 20
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
3.配置VLAN间的路由
LSW1:
#
interface Vlanif10
ip address 192.168.10.251 255.255.255.0
#
interface Vlanif20
ip address 192.168.20.251 255.255.255.0
LSW2:
#
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
#
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
LSW3:
#
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
#
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
#
interface Vlanif30
ip address 192.168.30.253 255.255.255.0
4.配置路由协议
LSW1:
#
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
LSW2:
#
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
LSW3:
#
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
5.配置VRRP
LSW1:
interface Vlanif10
ip address 192.168.10.251 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 120
#
interface Vlanif20
ip address 192.168.20.251 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.20.254
LSW2:
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
#
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.20.254
vrrp vrid 1 priority 120
6.配置端口跟踪
LSW1:
interface Vlanif10
ip address 192.168.10.251 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 120
vrrp vrid 1 track interface Ethernet0/0/3 reduced 15
vrrp vrid 1 track interface Ethernet0/0/1 reduced 15
LSW2:
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.20.254
vrrp vrid 1 priority 120
vrrp vrid 1 track interface Ethernet0/0/3 reduced 15
vrrp vrid 1 track interface Ethernet0/0/2 reduced 15
7.四个交换机上分别配置MSTP
LSW1:
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
instance 3 vlan 30
active region-configuration
LSW2:
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
instance 3 vlan 30
active region-configuration
LSW3:
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
instance 3 vlan 30
active region-configuration
LSW4:
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
instance 3 vlan 30
active region-configuration
8.LSW3上配置实例0-3为root
LSW3:
stp instance 0 root primary
stp instance 1 root primary
stp instance 2 root primary
stp instance 3 root primary
9.配置LSW1上的instance 1优先级为8192,instance 2 的优先级为16384
LSW1:
stp instance 1 priority 8192
stp instance 2 priority 16384
10.配置LSW2上的instance 1 优先级为16384,instance 2优先级为8192
LSW2:
stp instance 1 priority 16384
stp instance 2 priority 8192
配置完成