VTP、STP、Port-channel、HSRP


VTP、STP、Port-channel、HSRP



实验拓扑图

 

实验要求

一、 VTP设置
在交换机上启用VTP协议,三层交换机为Server模式,二层交换机为Client模式,并创建四个Vlan,vlan 10,vlan 20 valan 30,vlan 40
二、 STP设置
MSW1 设为vlan 10和vlan20的根网桥,MSW2设为vlan 30和vlan 40的根网桥
三、 以太网通道Port-channel设置 :

MSW1 和MSW2交换机上的端口f0/1-2加入channel-group 1成为Port-channel,并把 Port-channel1 设为 trunk 模式
四、 HSRP热备份路由协议
在两台三层交换机上配置 HSRP VRRP 协议,为了实现冗余备份和负载均衡,在 MSW1 上, vlan 10 vlan 20 Active vlan30 vlan 40 Standby ;在 MSW2 上, vlan 10 vlan 20 Standby vlan 30 vlan 40 Active


实验步骤:
一、
基本配置,配置各端口IP地址,

路由器R1
interfaceLoopback0
ip address 1.1.1.1255.255.255.0
no shutdown 

interfaceEthernet0/1

ip address 192.168.0.1 255.255.255.252
full-duplex

interfaceEthernet0/2

ip address 192.168.0.5 255.255.255.252
full-duplex
交换机MSW1
interfaceFastEthernet0/0
no switchport
ip address 192.168.0.2 255.255.255.252
交换机MSW2
interfaceFastEthernet0/0
no switchport
ip address 192.168.0.6 255.255.255.252
二,在交换机上配置VTP协议
配置 VTP 协议前,需要将相连的交换机之间直连的端口设置为 trunk 模式,且 vtpdomain 必须相同,才可以交流 vtp  信息
MSW1(config)#interfacefastEthernet 0/3
MSW1(config-if)#switchporttrunk encapsulation dot1q
MSW1(config-if)#switchportmode trunk

交换机 MSW1

MSW1(config)#vtp domain test

MSW1(config)#vtp mode server
MSW1(config)#vtp pruning
MSW1(config)#vtp password 123456
MSW1(config)#vtp v2-mode

交换机 MSW2
MSW2#vlan database
MSW2(vlan)# vtpdomain test
MSW2(vlan)# vtpmode server
MSW2(vlan)# vtppruning
MSW2(vlan)# vtppassword 123456
MSW2(vlan)# vtpv2-mode

交换机 2SW1

2SW1(config)#vtp domain test

2SW1(config)#vtp mode client
2SW1(config)#vtp pruning
2SW1(config)#vtp password 123456
2SW1(config)#vtp v2-mode
其它二层交换机配置同 2SW1

验证 VTP
 

 

三, 在三层交换机上配置STP协议

MSW1 设为vlan 10和vlan 20的根网桥,
MSW2 设为vlan 30和vlan 40的根网桥
MSW1(config)#spanning-treevlan 10 root primary
MSW1(config)#spanning-treevlan 20 root primary
MSW1(config)#spanning-treevlan 30 root secondary
MSW1(config)#spanning-treevlan 40 root secondary

MSW2(config)#spanning-treevlan 10 root secondary
MSW2(config)#spanning-treevlan 20 root secondary
MSW2(config)#spanning-treevlan 30 root primary
MSW2(config)#spanning-treevlan 40 root primary
以上配置在 running-config  文件中的效果为:
 

在配置生成树协议时,也可以直接指定 vlan 的优先级 priority,进行配置

验证STP配置,在非根桥交换机上查看端口的转发或阻塞状态
 
 



四,在三层交换机之间配置Port-channel接口

MSW1(config)#intrange f0/1 -2
MSW1(config-if-range)#channel-group1 mode on

MSW1(config)#interfaceport-channel 1

MSW1(config-if)#switchporttrunk encapsulation dot1q
MSW1(config-if)#switchportmode trunk
在对端 MSW2 上也做相同的配置后,验证如下图:


 

五,在两三层交换机之上配置HRRP或协议
为了实现冗余备份和负载均衡,
MSW1 上,设置 vlan 10 vlan 20 Active vlan 30 vlan 40 Standby
int vlan 10
standby ip192.168.1.254
standby priority120
standby preempt
# 占先权,配置此命令后,当路由器发现本机优先级比现任同一 standby 组中的 Active 路由器高时,则本机将成为 ACTIVE ,当前 ACTIVE 路由顺则降为 Standby

standby track f0/050

# 端口跟踪,当发现跟踪端口 Down 时,本路由器 standby priority 自动降低 50
int vlan 20
standby ip192.168.2.254
standby priority120
standby preempt
standby track f0/050

int vlan 30
standby ip192.168.3.254
standby priority100
#
在交换机上默认优先级为 100, 此命令可省
standby preempt
# Standby 网段也需要配置占先权,目的是为了当 Active 路由器 Down 掉时,本路由器能够迅速由 Standby 成为 Active

int vlan 40

standby ip192.168.4.254
standby preempt

MSW2 上,设置 vlan 10 vlan 20 Standby vlan 30 vlan 40 Active
int vlan 10
standby ip 192.168.1.254
standby preempt
int vlan 20
standby ip 192.168.2.254
standby preempt

int vlan 30
standby ip 192.168.3.254
standby priority 120
standby preempt
standby track f0/0 50
int vlan 40
standby ip 192.168.4.254
standby priority 120
standby preempt
standby track f0/0 50
验证HSRP
 
 



故障验证,将MSW1交换机上的f0/0设为Down状态时

 



MSW1 交换机上的端口f0/0 恢复正常后



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值