MSTP VRRP多备份网络项目实验

拓扑图

image.png

JR

创建vlan及更改设备名

HOSTNAME mamu-CORE-01  
vlan 10
name jwc
vlan 20
name xzc
vlan 30
name xsc
vlan 40
name cwc

HJ-01

创建vlan及更改设备名,开启三层交换机路由功能

HOSTNAME mamu-hj-01

ip routing

vlan 10
name jwc
vlan 20
name xzc
vlan 30
name xsc
vlan 40
name cwc

HJ-02

创建vlan及更改设备名,开启三层交换机路由功能

HOSTNAME mamu-hj-02
ip routing
vlan 10
name jwc
vlan 20
name xzc
vlan 30
name xsc
vlan 40
name cwc

JR将端口封装dot1q协议并设置为trunk口

int range e0/0
switchport trunk encapsulation dot1q 
switchport mode trunk
no sh
int range e0/1
switchport trunk encapsulation dot1q 
switchport mode trunk
no sh

HJ-1

将端口封装dot1q协议并设置为trunk口

将e1/1-2加入聚合组

int range e1/1-2
switchport trunk encapsulation dot1q 
switchport mode trunk
channel-group 1 mode on 
no sh
int port-channel 1
switchport trunk encapsulation dot1q 
switchport mode trunk
no sh

HJ-2

将端口封装dot1q协议并设置为trunk口

将e1/1-2加入聚合组

int range e1/1-2
switchport trunk encapsulation dot1q 
switchport mode trunk
channel-group 1 mode on 
no sh
int port-channel 1
switchport trunk encapsulation dot1q 
switchport mode trunk
no sh

JR

将e1/0-3分别划分vlan到vlan10-40

并设置该端口为快速端口 把一个port设置了portfast,就是让那个port不再使用STP的算法

启用BPDU防护功能,在此端口不接受BPDU

int e1/0
switchport access vlan 10
description con-to-jwc-1 
spanning-tree portfast       //设置该端口为快速端口 把一个port设置了portfast,就是让那个port不再使用STP的算法
spanning-tree bpduguard enable           //启用BPDU防护功能,在此端口不接受BPDU
no sh
int e1/1                 
switchport access vlan 20
description con-to-xzc-1 
spanning-tree portfast
spanning-tree bpduguard enable 
int e1/2
switchport access vlan 30
description con-to-xsc-1 
no sh
spanning-tree portfast
spanning-tree bpduguard enable 
int e1/3              
switchport access vlan 40
description con-to-cwc-1
no sh
spanning-tree portfast
spanning-tree bpduguard enable

HJ-1

配置instance 1(实例1)并关联 vlan 10,30

 

配置instance 2(实例2)并关联 vlan 20,40

spanning-tree mode mst   //启用多生成树协议
spanning-tree mst configuration    //进入MST配置模式
name ruijile
revision 1
instance 1 vlan 10,30
instance 2 vlan 20,40
spanning-tree mst 1 priority 4096   //配置三层交换机在instance 1中的优先级为4096
spanning-tree mst 2 priority 8192    //配置三层交换机在instance 2中的优先级为8192

HJ-2

instance1:包括vlan10,30

instance2:包括:vlan 20,40

spanning-tree mode mst   //启用多生成树协议
spanning-tree mst configuration   //进入MST配置模式
revision 1
instance 1 vlan 10,30
instance 2 vlan 20,40
spanning-tree mst 1 priority 8192
spanning-tree mst 2 priority 4096

H1-1

创建监听端口并配置vlan svi接口IP充当各部门网关

配置VRRPip及优先级等信息

track 1 int e3/0 line-protocol //创建E3/0为监听端口 
!
int vlan 10
ip address 192.168.10.252 255.255.255.0
vrrp 10 ip 192.168.10.254
vrrp 10 track 1 decrement 10  //调用跟踪事件1,发现上行链路down后优先级会减10
vrrp 10 priority 105
no sh
!
int vlan 20
ip address 192.168.20.252 255.255.255.0
vrrp 20 ip 192.168.20.254
no sh
!
int vlan 30
ip address 192.168.30.252 255.255.255.0
vrrp 30 ip 192.168.30.254
vrrp 10 track 1 decrement 10    //调用跟踪事件1,发现上行链路down后优先级会减10
vrrp 30 priority 105
no sh
!
int vlan 40
ip address 192.168.40.252 255.255.255.0
vrrp 40 ip 192.168.40.254
no sh
!

优先级调整后 

HJ-1作为VLAN 10,VLAN30的主,VLAN20,VLAN40的备,HJ-2作为VLAN20,VLAN40的主,VLAN 10,VLAN30的备,2台设备上联口设置Track跟踪,若主设备故障,主动降级为备设备)

show vrrp brief命令查看VRRP

image.png

image.png

HJ-2

创建监听端口并配置vlan svi接口IP充当各部门网关

配置VRRPip及优先级等信息

 

HJ-1作为VLAN 10,VLAN30的主,VLAN20,VLAN40的备,HJ-2作为VLAN20,VLAN40的主,VLAN 10,VLAN30的备,2台设备上联口设置Track跟踪,若主设备故障,主动降级为备设备)

track 1 int e3/0 line-protocol    //创建E3/0为监听端口
!
int vlan 10
ip address 192.168.10.253 255.255.255.0
vrrp 10 ip 192.168.10.254
no sh
!
int vlan 20
ip address 192.168.20.253 255.255.255.0
vrrp 20 ip 192.168.20.254
vrrp 20 track 1 decrement 10   //调用跟踪事件1,发现上行链路down后优先级会减10
vrrp 20 priority 105
no sh
!
int vlan 30
ip address 192.168.30.253 255.255.255.0
vrrp 30 ip 192.168.30.254
no sh
!
int vlan 40
ip address 192.168.40.253 255.255.255.0
vrrp 40 ip 192.168.40.254
vrrp 40 track 1 decrement 10   //调用跟踪事件1,发现上行链路down后优先级会减10
vrrp 40 priority 105
no sh
!

HJ-1

配置e0/1端口ip

interface e0/1
no switchport    //开启三层功能
ip address 192.168.99.2 255.255.255.252
no sh

如果是三层交换机的话,可以用到此命令。

三层交换机是带有三层路由功能的交换机,也就是这台交换机的端口既有三层路由功能,也具有二层交换功能。三层交换机端口默认为二层口,如果需要启用三层功能就需要在此端口输入no switchport命令。如果是二层交换机就不会用到no switchport命令.

 

HJ-2

配置e0/1端口ip

interface e0/1
no switchport     //开启三层功能
ip address 192.168.99.6 255.255.255.252
no sh

 

core

ip routing   //开启路由功能
!
interface e0/0
no switchport     //开启三层功能
ip address 192.168.99.1 255.255.255.252
no sh
interface e0/1    
no switchport
ip address 192.168.99.5 255.255.255.252
no sh
! 
int loopback 0   //配置环回口
ip add 1.1.1.1 255.255.255.0
no sh

配置充当PC的四台路由器IP及ospf

pc1

interface e0/0
ip address 192.168.10.10 255.255.255.0
no sh
exit
ip default-gateway 192.168.10.252   //设置默认网关
!
router ospf 100         //配置ospf
network 192.168.10.0 0.0.0.255 area 0

-------------------------------------
pc2
interface e0/0
ip address 192.168.20.20 255.255.255.0
no sh
exit 
ip default-gateway 192.168.20.252    //设置默认网关
!
router ospf 100            //配置ospf
network 192.168.20.0 0.0.0.255 area 0

---------------------------------------------
pc3
interface e0/0
ip address 192.168.30.30 255.255.255.0
no sh
exit
ip default-gateway 192.168.30.252   //设置默认网关
!
router ospf 100                 //配置ospf
network 192.168.30.0 0.0.0.255 area 0
-------------------------------------------

pc4
interface e0/0
ip address 192.168.40.40 255.255.255.0
no sh
exit
ip default-gateway 192.168.40.252    //设置默认网关
!
router ospf 100                     //配置ospf
network 192.168.40.0 0.0.0.255 area 0

HJ-1

配置HJ-1的OSPf

router ospf 100
network 192.168.10.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 0
network 192.168.99.0 0.0.0.3 area 0

HJ-2

配置HJ-2的OSPf

router ospf 100
network 192.168.10.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0
network 192.168.40.0 0.0.0.255 area 0
network 192.168.99.0 0.0.0.3 area 0

core

配置core的OSPf

router ospf 100
network 1.1.1.0 0.0.0.255 area 0
network 192.168.99.0 0.0.0.3 area 0

show ip route查看路由表

core

image.png

HJ-1 

image.png

HJ-2

image.png

 

core核心连通ping测试

ping各个部门测试

image.png

测试主备切换功能

当vlan20 master VRRP2(HJ-2) down机后,网络出现一定延时丢包,但很快恢复

将vlan 20down掉

image.png

快速切换查看,发现五个包丢了一个包,不过后面就马上切换正常

image.png

 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

麻木博客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值