23-2 MSTP+VRRP实验
拓扑
配置VRRP+MSTP,使得PC1和PC2通信始终通过最优路径
基础配置(VLAN+IP)
LSW1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 8 to 9
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 8 to 9
#
interface GigabitEthernet0/0/4
port link-type access
#
interface Vlanif1
ip address 12.1.1.1 255.255.255.0
#
interface Vlanif8
ip address 192.168.1.1 255.255.255.0
#
interface Vlanif9
ip address 192.168.2.1 255.255.255.0
LSW2
#
interface Vlanif1
ip address 12.1.2.1 255.255.255.0
#
interface Vlanif8
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif9
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 8 to 9
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 8 to 9
#
interface GigabitEthernet0/0/4
port link-type access
LSW3
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 8 to 9
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 8 to 9
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 8
#
interface GigabitEthernet0/0/5
port link-type access
port default vlan 9
AR2
#
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 12.1.2.2 255.255.255.0
#
interface LoopBack1
ip address 8.8.8.8 255.255.255.255
路由配置
LSW1
[LSW1]ip route-static 0.0.0.0 0 12.1.1.2
LSW2
[LSW2]ip route-static 0.0.0.0 0 12.1.2.2
AR2
[AR2]ip route-static 192.168.1.0 24 12.1.1.1 preference 50
[AR2]ip route-static 192.168.1.0 24 12.1.2.1
[AR2]ip route-static 192.168.2.0 24 12.1.2.1 preference 50
[AR2]ip route-static 192.168.2.0 24 12.1.1.1
MSTP配置
LSW1
#
stp region-configuration
region-name gls.com
revision-level 1
instance 1 vlan 8
instance 2 vlan 9
active region-configuration
#
stp instance 1 priority 0
stp instance 2 priority 4096
LSW2
#
stp region-configuration
region-name gls.com
revision-level 1
instance 1 vlan 8
instance 2 vlan 9
active region-configuration
#
stp instance 1 priority 4096
stp instance 2 priority 0
LSW3
#
stp region-configuration
region-name gls.com
revision-level 1
instance 1 vlan 8
instance 2 vlan 9
active region-configuration
MSTP配置认证
[LSW3]dis stp instance 1 brief
MSTID Port Role STP State Protection
1 GigabitEthernet0/0/2 ROOT FORWARDING NONE
1 GigabitEthernet0/0/3 ALTE DISCARDING NONE
1 GigabitEthernet0/0/4 DESI FORWARDING NONE
[LSW3]dis stp instance 2 brief
MSTID Port Role STP State Protection
2 GigabitEthernet0/0/2 ALTE DISCARDING NONE
2 GigabitEthernet0/0/3 ROOT FORWARDING NONE
2 GigabitEthernet0/0/5 DESI FORWARDING NONE
VRRP配置
LSW1
#
interface Vlanif8
ip address 192.168.1.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 200
#
interface Vlanif9
ip address 192.168.2.1 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.254
LSW2
#
interface Vlanif8
ip address 192.168.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
#
interface Vlanif9
ip address 192.168.2.2 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.254
vrrp vrid 2 priority 200
VRRP配置验证
[LSW1]dis vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master Vlanif8 Normal 192.168.1.254
2 Backup Vlanif9 Normal 192.168.2.254
----------------------------------------------------------------
Total:2 Master:1 Backup:1 Non-active:0
[LSW2]dis vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Backup Vlanif8 Normal 192.168.1.254
2 Master Vlanif9 Normal 192.168.2.254
----------------------------------------------------------------
Total:2 Master:1 Backup:1 Non-active:0
连通测试
PC1 ping AR2
PC>ping 8.8.8.8
Ping 8.8.8.8: 32 data bytes, Press Ctrl_C to break
From 8.8.8.8: bytes=32 seq=1 ttl=254 time=63 ms
--- 8.8.8.8 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 63/63/63 ms
路径
PC2 ping AR2
PC>ping 8.8.8.8
Ping 8.8.8.8: 32 data bytes, Press Ctrl_C to break
From 8.8.8.8: bytes=32 seq=1 ttl=254 time=141 ms
--- 8.8.8.8 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 141/141/141 ms
路径
当VRRP主和MSTP根交换机不在同一交换机上PC1到AR2,PC2到AR2路径如下
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现