VRRP+MSTP配置学习

拓扑如下:

环境结构:
VRRP:
根据IP地址,交换机之间运行OSPF达到VLAN间通讯,使用LSW2作为VLAN10的VRRP的Master使用虚拟IP192.168.10.254,作为VLAN20的BackUp使用虚拟IP192.168.20.254。同理LSW3相反即可。配置端口跟踪达到故障切换的目的。
MSTP:
LSW1作为MSTP根桥设立实例对应相应VLAN,修改LSW2对VLAN10和VLAN20的优先级,修改LSW3对VLAN10和VLAN20的优先级。使得VLAN10流量走LSW2交换机,VLAN20流量走LSW3交换机,达到负载均衡的目的。并给相应的PC配置上STP边缘接口,达到快速收敛的目的。

配置如下:
LSW1:

#
vlan batch 10 20 30
#
stp instance 0 root primary
stp instance 1 root primary
stp instance 2 root primary
stp instance 3 root primary
#
 region-configuration
 region-name Test
 revision-level 1
 instance 1 vlan 10
 instance 2 vlan 20
 instance 3 vlan 30
 active region-configuration
#
interface Vlanif10
 ip address 192.168.10.251 255.255.255.0
#
interface Vlanif20
 ip address 192.168.20.251 255.255.255.0
#
interface Vlanif30
 ip address 192.168.30.254 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 30
 stp edged-port enable
#
interface GigabitEthernet0/0/23
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
interface GigabitEthernet0/0/24
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
ospf 1
 area 0.0.0.0
  network 192.168.10.0 0.0.0.255
  network 192.168.20.0 0.0.0.255
  network 192.168.30.0 0.0.0.255
#

LSW2:

#
vlan batch 10 20 30
#
stp instance 1 priority 4096
stp instance 2 priority 8192
#
stp region-configuration
 region-name Test
 revision-level 1
 instance 1 vlan 10
 instance 2 vlan 20
 instance 3 vlan 30
 active region-configuration
#
interface Vlanif10
 ip address 192.168.10.252 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.10.254
 vrrp vrid 1 priority 120
 vrrp vrid 1 track interface GigabitEthernet0/0/24 reduced 15
 vrrp vrid 1 track interface GigabitEthernet0/0/22 reduced 15
#
interface Vlanif20
 ip address 192.168.20.252 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.20.254
#
interface GigabitEthernet0/0/22
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/23
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/24
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
ospf 1
 area 0.0.0.0
  network 192.168.10.0 0.0.0.255
  network 192.168.20.0 0.0.0.255
  network 192.168.30.0 0.0.0.255
#
return

LSW3:

#
vlan batch 10 20 30
#
stp instance 1 priority 8192
stp instance 2 priority 4096
#
stp region-configuration
 region-name Test
 revision-level 1
 instance 1 vlan 10
 instance 2 vlan 20
 instance 3 vlan 30
 active region-configuration
#
interface Vlanif10
 ip address 192.168.10.253 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.10.254
#
interface Vlanif20
 ip address 192.168.20.253 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.20.254
 vrrp vrid 1 priority 120
 vrrp vrid 1 track interface GigabitEthernet0/0/24 reduced 15
 vrrp vrid 1 track interface GigabitEthernet0/0/22 reduced 15
#
interface GigabitEthernet0/0/22
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
interface GigabitEthernet0/0/23
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
interface GigabitEthernet0/0/24
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
ospf 1
 area 0.0.0.0
  network 192.168.10.0 0.0.0.255
  network 192.168.20.0 0.0.0.255
  network 192.168.30.0 0.0.0.255
#
user-interface con 0
user-interface vty 0 4
#

LSW4:

#
vlan batch 10 20 30
#
stp region-configuration
 region-name Test
 revision-level 1
 instance 1 vlan 10
 instance 2 vlan 20
 instance 3 vlan 30
 active region-configuration
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 10
 stp edged-port enable
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 20
 stp edged-port enable
#
interface GigabitEthernet0/0/23
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
interface GigabitEthernet0/0/24
 port link-type trunk
 port trunk allow-pass vlan 10 20 30
#
return

验证:在LSW2、LSW3上使用disp vrrp brief可以查看不同vlan对应不同交换机。在LSW4上disp stp brief 可以查看不同实例对应的根端口,分别关闭LSW2 gi0/0/24和gi0/0/22后vrrp端口跟踪生效,可以进行Master和Backup切换,并且MSTP可以快速收敛。并且PC1-PC3对应端口不参加STP运算。

发表评论

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据