HSRP(Hot standby router protocol)理解

来源:互联网 发布:淘宝减肥药排行榜十强 编辑:程序博客网 时间:2024/06/05 09:42
 HSRP(Hot standby router protocol)热备份路由协议为IP网络提供了容错和增强的路由选择功能。
思科专有协议
多层交换机配置如下
----- switch1的交换引擎配置------
switch1>(enable)set vtp server           设置vtp vlan中继协议模式为server模式
switch1>(enable)set vtp domain core_net   //设置vtp域名
switch1>(enable)set vlan 10 name pippo  //创建vlan10,并重命名
switch1>(enable)set vlan 20 name super   //
switch1>(enable)set trunk 1/1 on dot1q 1-1005  //设置端口1/1为干道,并采用dot1q协议封装,只允许vlan1 - vlan1005数据通过
switch1>(enable)set spantree root 1-40 dia 4   //将当前交换机设置为spantree的根
switch1>(enable)set spantree portfast 1/1-2 enable  //设置spantree端口快速启动
switch1>(enable)set spantree uplinkfast enable  //设置spantree端口快速切换




-----switch1的路由引擎配置-------
switch1(config)#enable secret test
switch1(config)#line vty 0 4  //允许同时有5个终端远程登录   虚拟终端
switch1(config-line)#login
switch1(config-line)#password test
----
switch1(config-if)#interface vlan 10  //进入虚拟接口vlan 10
switch1(config-if)#ip address 192.168.180.60 255.255.255.192


switch1(config-if)#no shutdown
switch1(config-if)#standby 10 ip 192.168.180.62    //启用HSRP,创建HSRP组1并设置虚拟网关ip地址
switch1(config-if)#standby 10 priority 110   //设置HSRP优先级
switch1(config-if)#standby 10 preempt //设置HSRP切换许可,即备份抢先权
switch1(config-if)#interface vlan 20  //进入虚拟接口vlan20
switch1(config-if)ip address 192.168.180.124 255.255.255.192 //vlan端口设定ip地址


switch1(config-if)#no shutdown  //开启端口
switch1(config-if)#standby 20 ip 192.168.180.126
switch1(config-if)#standby 20 priority 110
switch1(config-if)#standby 20 preempt


---------switch2的交换引擎配置-------------
 switch2>(enable)set vtp mode server
switch2>(enable)set vtp domain core
switch2>(enable)set vlan 10 name cai
switch2>(enable)set valn 20 name xing
switch2>(enable)set trunk 1/1 on dot1q 1-1005
switch2>(enable)set spantree secondary root 1-40 dia 4 //配置当前交换机为spantree的辅助根
 


-------switch2的路由引擎设置-------------------
switch2(config)#enable secert test




-------------------------


switch2(config-if)#interface vlan 10 
switch2(config-if)#ip address 192.168.180.61 255.255.255.192




switch2(config0if)#no shutdown
switch2(config-if) #standby 10 ip 192.168.180.62
switch2(config-if)standby 10 priority 100
switch2(config-if)#standby 10 preempt
switch2(config-if)#interface vlan 20
-----------------------




若pc1与pc2不是在同一个vlan内,他们之间的通信需要通过HSRP的虚拟路由器:pc1以虚拟路由器的MAC地址为目的地址封装数据包,虚拟路由器在接收到数据包之后,更换数据包的源MAC地址为其自身MAC地址,而目的MAC地址为PC2的MAC地址,最后送达到PC2,如果PC1与PC3是在同一个VLAN内,则他们之间可以直接通信


 在vtp中,交换机有三种运行模式,服务器,客户机以及透明模式,当交换机是处在vtp服务器或者透明模式下,可以再交换机上配置vlan,通过使用CLI,MIB修改VLAN配置;而VTP的客户机模式只能传送广播信息,并不能从广播中学习新的信息。不能修改vtp
0 0
原创粉丝点击