精品干货实验37交换机HSRP实验(收藏)
- 格式:docx
- 大小:229.76 KB
- 文档页数:9
VTP 、STP 、Port-channel 、HSRP 综合实验实验要求:一、VTP 设置在交换机上启用VTP 协议,三层交换机为Server 模式,二层交换机为Client 模式,并创建四个Vlan ,vlan 10,vlan 20 valan 30,vlan 40二、STP 设置:MSW1设为vlan 10和vlan 20的根网桥,MSW2设为vlan 30和vlan 40的根网桥三、以太网通道Port-channel 设置:MSW1和MSW2交换机上的端口f0/1-2加入channel-group 1成为Port-channel ,并把Port-channel 1设为trunk 模式四、HSRP 热备份路由协议:在两台三层交换机上配置HSRP 或VRRP 协议,为了实现冗余备份和负载均衡,在MSW1上,vlan 10和vlan 20为Active ,vlan 30和vlan 40为Standby ;在MSW2上,vlan 10和vlan 20为Standby ,vlan 30和vlan 40为Activeg ao sh an cn实验步骤:一、 基本配置,配置各端口IP 地址,路由器R1interface Loopback0ip address 1.1.1.1 255.255.255.0 no shutdowninterface Ethernet0/1ip address 192.168.0.1 255.255.255.252 full-duplexinterface Ethernet0/2ip address 192.168.0.5 255.255.255.252 full-duplex交换机MSW1:interface FastEthernet0/0 no switchportip address 192.168.0.2 255.255.255.252 交换机MSW2:interface FastEthernet0/0 no switchportip address 192.168.0.6 255.255.255.252 二,在交换机上配置VTP 协议配置VTP 协议前,需要将相连的交换机之间直连的端口设置为trunk 模式,且vtp domain 必须相同,才可以交流vtp 信息 MSW1(config)#interface fastEthernet 0/3MSW1(config-if)#switchport trunk encapsulation dot1q MSW1(config-if)#switchport mode trunk交换机MSW1:MSW1(config)#vtp domain test MSW1(config)#vtp mode server MSW1(config)#vtp pruningMSW1(config)#vtp password 123456 MSW1(config)#vtp v2-mode交换机MSW2MSW2#vlan databaseMSW2(vlan)# vtp domain test MSW2(vlan)# vtp mode server MSW2(vlan)# vtp pruningMSW2(vlan)# vtp password 123456 MSW2(vlan)# vtp v2-modeg ao sh an cn交换机2SW1:2SW1(config)#vtp domain test2SW1(config)#vtp mode client2SW1(config)#vtp pruning2SW1(config)#vtp password 1234562SW1(config)#vtp v2-mode其它二层交换机配置同2SW1验证VTP:ncnahsoag三,在三层交换机上配置STP 协议MSW1设为vlan 10和vlan 20的根网桥, MSW2设为vlan 30和vlan 40的根网桥MSW1(config)#spanning-tree vlan 10 root primary MSW1(config)#spanning-tree vlan 20 root primary MSW1(config)#spanning-tree vlan 30 root secondary MSW1(config)#spanning-tree vlan 40 root secondaryMSW2(config)#spanning-tree vlan 10 root secondary MSW2(config)#spanning-tree vlan 20 root secondary MSW2(config)#spanning-tree vlan 30 root primary MSW2(config)#spanning-tree vlan 40 root primary 以上配置在running-config 文件中的效果为:在配置生成树协议时,也可以直接指定vlan 的优先级priorityg ao sh an cn验证STP配置,在非根桥交换机上查看端口的转发或阻塞状态ncnahsoag四,在三层交换机之间配置Port-channel 接口MSW1(config)#int range f0/1 -2MSW1(config-if-range)#channel-group 1 mode onMSW1(config)#interface port-channel 1MSW1(config-if)#switchport trunk encapsulation dot1q MSW1(config-if)#switchport mode trunk在对端MSW2上也做相同的配置后,验证如下图:g ao sh an cn五,在两三层交换机之上配置HRRP 或协议 为了实现冗余备份和负载均衡,在MSW1上,设置vlan 10和vlan 20为Active ,vlan 30和vlan 40为Standby ; int vlan 10standby ip 192.168.1.254 standby priority 120 standby preempt#占先权,配置此命令后,当路由器发现本机优先级比现任同一standby 组中的Active 路由器高时,则本机将成为ACTIVE ,当前ACTIVE 路由顺则降为Standby standby track f0/0 50#端口跟踪,当发现跟踪端口Down 时,本路由器standby priority 自动降低50 int vlan 20standby ip 192.168.2.254 standby priority 120 standby preempt standby track f0/0 50 int vlan 30standby ip 192.168.3.254standby priority 100 #在交换机上默认优先级为100,此命令可省 standby preempt#在Standby 网段也需要配置占先权,目的是为了当Active 路由器Down 掉时,本路由器能够迅速由Standby 成为Active int vlan 40standby ip 192.168.4.254 standby preempt在MSW2上,设置vlan 10和vlan 20为Standby ,vlan 30和vlan 40为Activeint vlan 10standby ip 192.168.1.254 standby preempt int vlan 20standby ip 192.168.2.254 standby preempt int vlan 30standby ip 192.168.3.254 standby priority 120 standby preempt standby track f0/0 50 int vlan 40standby ip 192.168.4.254 standby priority 120 standby preempt standby track f0/0 50g ao sh an cn在三层交换机上查看HSRP 的配置结果在MSW1交换机上,vlan10 和vlan 20的虚拟网关为ACTIVE 状态, vlan30 和vlan 40的虚拟网关为STANDBY 状态在MSW2交换机上,vlan10 和vlan 20的虚拟网关为STANDBY 状态, vlan30 和vlan 40的虚拟网关为ACTIVE 状态g ao sh an cn故障验证,将MSW1交换机上的f0/0设为Down 状态时在三层交换MSW1上,当发现f0/0端口DOWN 掉时,由于配置了端口跟踪,vlan 10和vlan 20 的备份优先级自动降低50,由120降为70,低于MSW2上的默认优先级100,虚拟网关由ACTIVE 成为STANDBY 状态与此同时,MSW2交换机发现本机上vlan 10和vlan 20的备份组优先级100高于MSW1上的备份组优先级70,通过占先权抢夺,在MSW2上,vlan 10和vlan 20的备份组状态由STANDBY 变成ACTIVE 。
两台三层交换机HSRP综合实例Laird.ZhangVersion 1.0配置1.1详述1.1.1拓扑图1.1.2说明SW1和SW2是两台三层交换机,SW3和SW4是两台二层交换机,R1是一台路由器,PC1、PC2、PC3和PC4是用四台路由模拟的PC。
SW1和SW2是双核心,它们之间做HSRP,用做端口汇聚(聚合)的两条链路来连接。
R1用来模拟该网络出口,用loopback0来模拟外网接口,SW3和SW4为PC1、PC2、PC3和PC4提供接入。
创建有4个VLAN:VLAN10、VLAN20、VLAN30和VLAN40,PC1、PC2、PC3和PC4分别属于VLAN10、VLAN20、VLAN30和VLAN40。
SW1的地址:VLAN10为10.1.10.253,VLAN20为10.1.20.253,VLAN30为10.1.30.253,VLAN40为10.1.40.253。
SW2的地址:VLAN10为10.1.10.252,VLAN20为10.1.20.252,VLAN30为10.1.30.252,VLAN40为10.1.40.252。
PC的IP地址:VLAN10为10.1.10.1,VLAN20为10.1.20.1,VLAN30为10.1.30.1,VLAN40为10.1.40.1。
HSRP的虚拟IP地址:VLAN10为10.1.10.254,VLAN20为10.1.20.254,VLAN30为10.1.30.254,VLAN40为10.1.40.254。
R1与SW1和SW2通过三层接口连接:R1的Fa2/0的IP地址为10.1.1.2/30,SW1的F0/2的IP地址为10.1.1.1/30;R1的Fa3/0的IP地址为10.1.1.6/30,SW2的Fa0/3的IP地址为10.1.1.5/30;R1的Loopback0的IP地址为10.1.1.8/32SW1是HSRP10和HSRP30的活动路由器,也是VLAN10和VLAN30的跟桥;SW2分别是HSRP20和HSRP40的活动路由器,也是VLAN20和VLAN40的跟桥。
拓扑Switch1 F0/0 <----> Switch2 F0/0Switch1 F0/1 <----> Switch3 F0/0Switch2 F0/1 <----> Switch3 F0/1Switch1 F0/2 <----> VPCS V0/1Switch2 F0/2 <----> VPCS V0/2Switch3 F0/2 <----> VPCS V0/3Switch3 F0/3 <----> VPCS V0/4Switch3 F0/4 <----> VPCS V0/5(模拟为三层交换机)Switch1 F0/0 F0/2 为三层接口F0/1 为二层接口(属于VLAN10)(模拟为三层交换机)Switch2 F0/0 F0/2 为三层接口F0/1 为二层接口(属于VLAN10)(模拟为二层交换机)Switch3 F0/0 - 5 为二层接口(属于VLAN10)在S1和S2 VLAN10 接口配置如下:S1:ip address 192.168.10.10 255.255.255.0standby 10 ip 192.168.10.1standby 10 priority 200standby 10 preemptS2:ip address 192.168.10.10 255.255.255.0standby 10 ip 192.168.10.1standby 10 priority 150standby 10 preempt虚拟主机IP地址设置:VPCS V0/1 IP=192.168.2.2 192.168.2.1/24VPCS V0/2 IP=192.168.3.2 192.168.3.1/24VPCS V0/3 IP=192.168.10.2 192.168.10.1/24VPCS V0/4 IP=192.168.10.3 192.168.10.1/24VPCS V0/5 IP=192.168.10.4 192.168.10.1/24实验结论:三层接口没有生成树,即只有S1的F0/1,S2的F0/1,S3的F0/0 - 5 运行生成树;第一种情况:当主网关失效的时候,备用网关便马上进行抢占,切换时间速度快(3-5秒左右);当主网关链路恢复的时候,接口因需要考虑生成树状态,不能马上进入转发状态,通常需要30秒时间过后,才能引发网关抢占,这段时间内两个网关都无法使用(即从主网关链路状态恢复为UP,然后经过生成树状态30秒,再加3-5秒抢占时间),可以通过给S1的F0/1,S2的F0/2配置PORTFAST特性以提高切换速度,或者交换机使用其它能够快速会聚的生成树协议。
HSRP 一网络拓扑图二实验思路1.vlan trunk 的配置2.ip地址配置3.DHCP DHCP中继配置4.HSRP配置三实验步骤ESW3的基本步骤ESW3#vlan databaseESW3(vlan)#vlan 10VLAN 10 modified:ESW3(vlan)#vlan 20VLAN 20 modified:ESW3(vlan)#vlan 30VLAN 30 modified:ESW3(vlan)#vlan 40VLAN 40 modified:ESW3(vlan)#exitESW3#configESW3(config)#interface f1/0ESW3(config-if)#switchport mode access ESW3(config-if)#switchport access vlan 10 ESW3(config-if)#interface f1/1ESW3(config-if)#switchport mode access ESW3(config-if)#switchport access vlan 20 ESW3(config-if)#interface f1/2ESW3(config-if)#switchport mode access ESW3(config-if)#switchport access vlan 30 ESW3(config-if)#interface f1/3ESW3(config-if)#switchport mode accessESW3(config-if)#switchport access vlan 40ESW3(config-if)#exitESW3(config)#interface fastEthernet 1/4ESW3(config-if)#switchport trunk encapsulation dot1q ESW3(config-if)#switchport mode trunkESW3(config-if)#interface fastEthernet 1/5ESW3(config-if)#switchport trunk encapsulation dot1q ESW3(config-if)#switchport mode trunkESW1的基本配置ESW1#vlan databaseESW1(vlan)#vlan 10VLAN 10 modified:ESW1(vlan)#vlan 20VLAN 20 modified:ESW1(vlan)#vlan 30VLAN 30 modified:ESW1(vlan)#vlan 40VLAN 40 modified:ESW1(vlan)#exitESW1(config)#interface fastEthernet1/2ESW1(config-if)#ip address 192.168.100.1 255.255.255.0 ESW1(config)#interface fastEthernet 1/0ESW1(config-if)#switchport trunk encapsulation dot1q ESW1(config-if)#switchport mode trunkESW1(config-if)#interface fastEthernet 1/1ESW1(config-if)#switchport trunk encapsulation dot1q ESW1(config-if)#switchport mode trunkESW1(config-if)#exESW1(config)#interface vlan 10ESW1(config-if)#ip address 192.168.10.1 255.255.255.0 ESW1(config-if)#standby 10 ip 192.168.10.254ESW1(config-if)# standby 10 priority 200ESW1(config-if)#standby 10 preemptESW1(config)#interface vlan 20ESW1(config-if)#ip address 192.168.20.1 255.255.255.0 ESW1(config-if)#standby 20 ip 192.168.20.254ESW1(config-if)# standby 20 priority 200ESW1(config-if)#standby 20 preemptESW1(config)#interface vlan 30ESW1(config-if)#ip address 192.168.30.1 255.255.255.0 ESW1(config-if)#standby 30 ip 192.168.30.254ESW1(config-if)#standby 30 priority 150ESW1(config-if)#standby 30 preemptESW1(config)#interface vlan 40ESW1(config-if)#ip address 192.168.40.1 255.255.255.0ESW1(config-if)#standby 40 ip 192.168.40.254 ESW1(config-if)#standby 40 priority 150ESW1(config-if)#standby 40 preemptESW1(config-if)#exESW1(config)#interface vlan 10ESW1(config-if)#ip helper-address 192.168.100.2 ESW1(config)#interface vlan 20ESW1(config-if)#ip helper-address 192.168.100.2 ESW1(config)#interface vlan 30ESW1(config-if)#ip helper-address 192.168.100.2 ESW1(config)#interface vlan 40ESW1(config-if)#ip helper-address 192.168.100.2 ESW2的基本配置ESW2#vlan databaseESW2(vlan)#vlan 10VLAN 10 modified:ESW2(vlan)#vlan 20VLAN 20 modified:ESW2(vlan)#vlan 30VLAN 30 modified:ESW2(vlan)#vlan 40VLAN 40 modified:ESW2(vlan)#exitESW2(config)#interface fastEthernet1/2ESW2(config-if)#ip address 192.168.200.1 255.255.255.0 ESW2(config)#interface fastEthernet 1/0ESW2(config-if)#switchport trunk encapsulation dot1q ESW2(config-if)#switchport mode trunkESW2(config-if)#interface fastEthernet 1/1ESW2(config-if)#switchport trunk encapsulation dot1q ESW2(config-if)#switchport mode trunkESW2(config-if)#exESW2(config)#interface vlan 10ESW2(config-if)#ip address 192.168.10.2 255.255.255.0 ESW2(config-if)#standby 10 ip 192.168.10.254ESW2(config-if)#standby 10 priority 150ESW2(config-if)#standby 10 preemptESW2(config)#interface vlan 20ESW2(config-if)#ip address 192.168.20.2 255.255.255.0 ESW2(config-if)#standby 20 ip 192.168.20.254ESW2(config-if)# standby 20 priority 150ESW2(config-if)#standby 20 preemptESW2(config)#interface vlan 30ESW2(config-if)#ip address 192.168.30.2 255.255.255.0 ESW2(config-if)#standby 30 ip 192.168.30.254ESW2(config-if)#standby 30 priority 200ESW2(config-if)#standby 30 preemptESW2(config)#interface vlan 40ESW2(config-if)#ip address 192.168.40.2 255.255.255.0 ESW2(config-if)#standby 40 ip 192.168.40.254ESW2(config-if)#standby 40 priority 200ESW2(config-if)#standby 40 preemptESW2(config-if)#exESW2(config)#interface vlan 10ESW2(config-if)#ip helper-address 192.168.200.2ESW2(config)#interface vlan 20ESW2(config-if)#ip helper-address 192.168.200.2ESW2(config)#interface vlan 30ESW2(config-if)#ip helper-address 192.168.200.2ESW2(config)#interface vlan 40ESW2(config-if)#ip helper-address 192.168.200.2R1的基本配置R1#configureR1(config)#interface ethernet 0/1R1(config-if)#ip address 192.168.100.2 255.255.255.0 R1(config-if)#no shutdownR1(config-if)#interface ethernet 0/0R1(config-if)#ip address 192.168.200.2 255.255.255.0R1(config-if)#no shutdownR1(config-if)#exitR1(config)#service dhcpR1(config)#ip dhcp pool vlan10R1(dhcp-config)# network 192.168.10.0 255.255.255.0 R1(dhcp-config)#default-router 192.168.10.1R1(dhcp-config)#dns-server 3.3.3.3R1(dhcp-config)#exitR1(config)#ip dhcp pool vlan20R1(dhcp-config)# network 192.168.20.0 255.255.255.0 R1(dhcp-config)#default-router 192.168.20.1R1(dhcp-config)#dns-server 3.3.3.3R1(dhcp-config)#exitR1(config)#ip dhcp pool vlan30R1(dhcp-config)# network 192.168.30.0 255.255.255.0 R1(dhcp-config)#default-router 192.168.30.1R1(dhcp-config)#dns-server 3.3.3.3R1(dhcp-config)#exitR1(config)#ip dhcp pool vlan40R1(dhcp-config)# network 192.168.40.0 255.255.255.0 R1(dhcp-config)#default-router 192.168.40.1R1(dhcp-config)#dns-server 3.3.3.3R1(dhcp-config)#exitR1(config)#ip route 192.168.10.0 255.255.255.0 192.168.100.1 R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.200.1 R1(config)#ip route 192.168.20.0 255.255.255.0 192.168.100.1 R1(config)#ip route 192.168.20.0 255.255.255.0 192.168.200.1 R1(config)#ip route 192.168.30.0 255.255.255.0 192.168.100.1 R1(config)#ip route 192.168.30.0 255.255.255.0 192.168.200.1 R1(config)#ip route 192.168.40.0 255.255.255.0 192.168.100.1 R1(config)#ip route 192.168.40.0 255.255.255.0 192.168.200.1测试结果PC1 DHCP show ipPC1> dhcpDORA IP 192.168.10.2/24 GW 192.168.10.1PC1> show ipNAME : PC1[1]IP/MASK : 192.168.10.2/24GATEWAY : 192.168.10.1DNS : 3.3.3.3DHCP SERVER : 192.168.100.2DHCP LEASE : 86397, 86400/43200/75600MAC : 00:50:79:66:68:00LPORT : 10000RHOST:PORT : 127.0.0.1:10001MTU: : 1500PC2 DHCP show ipPC2> dhcpDORA IP 192.168.20.2/24 GW 192.168.20.1 PC2> show ipNAME : PC2[1]IP/MASK : 192.168.20.2/24 GATEWAY : 192.168.20.1DNS : 3.3.3.3DHCP SERVER : 192.168.100.2DHCP LEASE : 86394, 86400/43200/75600 MAC : 00:50:79:66:68:01LPORT : 10004RHOST:PORT : 127.0.0.1:10005MTU: : 1500PC3 DHCP show ipPC3> dhcpDORA IP 192.168.30.2/24 GW 192.168.30.1PC3> show ipNAME : PC3[1]IP/MASK : 192.168.30.2/24 GATEWAY : 192.168.30.1DNS : 3.3.3.3DHCP SERVER : 192.168.100.2DHCP LEASE : 86393, 86400/43200/75600 MAC : 00:50:79:66:68:02LPORT : 10002RHOST:PORT : 127.0.0.1:10003MTU: : 1500PC4 DHCP show ipPC4> dhcpDORA IP 192.168.40.2/24 GW 192.168.40.1 PC4> show ipNAME : PC4[1]IP/MASK : 192.168.40.2/24 GATEWAY : 192.168.40.1DNS : 3.3.3.3DHCP SERVER : 192.168.100.2DHCP LEASE : 86394, 86400/43200/75600MAC : 00:50:79:66:68:03LPORT : 10006RHOST:PORT : 127.0.0.1:10007MTU: : 1500PC1pingPC4PC1> ping 192.168.40.2 -t84 bytes from 192.168.40.2 icmp_seq=1 ttl=63 time=37.786 ms 84 bytes from 192.168.40.2 icmp_seq=2 ttl=63 time=31.251 ms 84 bytes from 192.168.40.2 icmp_seq=3 ttl=63 time=37.749 ms 84 bytes from 192.168.40.2 icmp_seq=4 ttl=63 time=15.626 ms 84 bytes from 192.168.40.2 icmp_seq=5 ttl=63 time=31.264 ms当f1/0接口关闭之后192.168.40.2 icmp_seq=6 timeout192.168.40.2 icmp_seq=7 timeout84 bytes from 192.168.40.2 icmp_seq=8 ttl=63 time=31.251 ms 84 bytes from 192.168.40.2 icmp_seq=9 ttl=63 time=37.282 ms 84 bytes from 192.168.40.2 icmp_seq=10 ttl=63 time=84.531 ms 84 bytes from 192.168.40.2 icmp_seq=11 ttl=63 time=31.253 ms84 bytes from 192.168.40.2 icmp_seq=12 ttl=63 time=31.250 ms 84 bytes from 192.168.40.2 icmp_seq=13 ttl=63 time=122.337 ms 84 bytes from 192.168.40.2 icmp_seq=14 ttl=63 time=31.248 ms五调试信息ESW1 show running-configESW1#show running-configBuilding configuration...Current configuration : 2971 bytes!version 12.3service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname ESW1!boot-start-markerboot-end-marker!!no aaa new-modelresource policy!memory-size iomem 5ip subnet-zerono ip icmp rate-limit unreachable ip tcp synwait-time 5!!ip cefno ip domain lookupno ip dhcp use vrf connected!!!!!!!!!!!!!!!vtp file nvram:vlan.dat!!no crypto isakmp ccm!!!!interface FastEthernet1/0 switchport mode trunkduplex fullspeed 100!interface FastEthernet1/1 switchport mode trunkduplex fullspeed 100interface FastEthernet1/2no switchportip address 192.168.100.1 255.255.255.0 duplex fullspeed 100!interface FastEthernet1/3duplex fullspeed 100!interface FastEthernet1/4duplex fullspeed 100!interface FastEthernet1/5duplex fullspeed 100!interface FastEthernet1/6duplex fullspeed 100!interface FastEthernet1/7 duplex fullspeed 100!interface FastEthernet1/8 duplex fullspeed 100!interface FastEthernet1/9 duplex fullspeed 100!interface FastEthernet1/10 duplex fullspeed 100!interface FastEthernet1/11 duplex fullspeed 100!interface FastEthernet1/12 duplex fullspeed 100interface FastEthernet1/13duplex fullspeed 100!interface FastEthernet1/14duplex fullspeed 100!interface FastEthernet1/15duplex fullspeed 100!interface Vlan1no ip addressshutdown!interface Vlan10ip address 192.168.10.1 255.255.255.0 ip helper-address 192.168.100.2standby 10 ip 192.168.10.254standby 10 priority 200standby 10 preemptinterface Vlan20ip address 192.168.20.1 255.255.255.0 ip helper-address 192.168.100.2standby 20 ip 192.168.20.254standby 20 priority 200standby 20 preempt!interface Vlan30ip address 192.168.30.1 255.255.255.0 ip helper-address 192.168.100.2standby 30 ip 192.168.30.254standby 30 priority 150standby 30 preempt!interface Vlan40ip address 192.168.40.1 255.255.255.0 ip helper-address 192.168.100.2standby preemptstandby 40 ip 192.168.40.254standby 40 priority 150!no ip http serverno ip http secure-serverip classless!!!no cdp log mismatch duplex!!!control-plane!!!!!!!!!banner exec ^C************************************************************* **This is a normal Router with a SW module inside (NM-16ESW)It has been preconfigured with hard coded speed and duplexTo create vlans use the command "vlan database" from exec mode After creating all desired vlans use "exit" to apply the configTo view existing vlans use the command "show vlan-switch brief"Warning: You are using an old IOS image for this router. Please update the IOS to enable the "macro" command!************************************************************* **^C!line con 0exec-timeout 0 0privilege level 15logging synchronousline aux 0exec-timeout 0 0privilege level 15logging synchronousline vty 0 4login!!endESW2 show running-configESW2#show running-configBuilding configuration...Current configuration : 3130 bytes!version 12.3service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption!hostname ESW2!boot-start-markerboot-end-marker!!no aaa new-modelresource policy!memory-size iomem 5ip subnet-zerono ip icmp rate-limit unreachable ip tcp synwait-time 5!!ip cefno ip domain lookupno ip dhcp use vrf connected!!!!!!!!!!!!!!!vtp file nvram:vlan.dat!!no crypto isakmp ccm!!!!interface FastEthernet1/0 switchport mode trunkduplex fullspeed 100!interface FastEthernet1/1 switchport mode trunkduplex fullspeed 100interface FastEthernet1/2no switchportip address 192.168.200.1 255.255.255.0 duplex fullspeed 100!interface FastEthernet1/3duplex fullspeed 100!interface FastEthernet1/4duplex fullspeed 100!interface FastEthernet1/5duplex fullspeed 100!interface FastEthernet1/6duplex fullspeed 100!interface FastEthernet1/7 duplex fullspeed 100!interface FastEthernet1/8 duplex fullspeed 100!interface FastEthernet1/9 duplex fullspeed 100!interface FastEthernet1/10 duplex fullspeed 100!interface FastEthernet1/11 duplex fullspeed 100!interface FastEthernet1/12 duplex fullspeed 100interface FastEthernet1/13duplex fullspeed 100!interface FastEthernet1/14duplex fullspeed 100!interface FastEthernet1/15duplex fullspeed 100!interface Vlan1no ip addressshutdown!interface Vlan10ip address 192.168.10.254 255.255.255.0 ip helper-address 192.168.200.2standby 10 ip 192.168.10.254standby 10 priority 150standby 10 preemptinterface Vlan20ip address 192.168.20.254 255.255.255.0 ip helper-address 192.168.200.2standby 20 ip 192.168.20.254standby 20 priority 150standby 20 preempt!interface Vlan30ip address 192.168.30.254 255.255.255.0 ip helper-address 192.168.200.2standby 30 ip 192.168.30.254standby 30 priority 200standby 30 preempt!interface Vlan40ip address 192.168.40.254 255.255.255.0 ip helper-address 192.168.200.2standby 40 ip 192.168.40.254standby 40 priority 200standby 40 preempt!no ip http serverno ip http secure-serverip classless!!!mac-address-table static 0000.0c07.ac1e interface FastEthernet1/1 vlan 30mac-address-table static 0000.0c07.ac28 interface FastEthernet1/1 vlan 40no cdp log mismatch duplex!!!control-plane!!!!!!!!!banner exec ^C************************************************************* **This is a normal Router with a SW module inside (NM-16ESW)It has been preconfigured with hard coded speed and duplexTo create vlans use the command "vlan database" from exec modeAfter creating all desired vlans use "exit" to apply the config To view existing vlans use the command "show vlan-switch brief"Warning: You are using an old IOS image for this router. Please update the IOS to enable the "macro" command!************************************************************* **^C!line con 0exec-timeout 0 0privilege level 15logging synchronousline aux 0exec-timeout 0 0privilege level 15logging synchronousline vty 0 4login!!endESW3 show running-configESW3#show running-configBuilding configuration...Current configuration : 2415 bytes!version 12.3service timestamps debug datetime msec service timestamps log datetime msec no service password-encryptionno service dhcp!hostname ESW3!boot-start-markerboot-end-marker!!no aaa new-model!resource policy!memory-size iomem 5ip subnet-zerono ip routingno ip icmp rate-limit unreachable ip tcp synwait-time 5!!no ip cefno ip domain lookupno ip dhcp use vrf connected!!!!!!!!!!!!!!!vtp file nvram:vlan.dat!!no crypto isakmp ccm!!!!interface FastEthernet1/0 switchport access vlan 10 duplex fullspeed 100interface FastEthernet1/1 switchport access vlan 20 duplex fullspeed 100!interface FastEthernet1/2 switchport access vlan 30 duplex fullspeed 100!interface FastEthernet1/3 switchport access vlan 40 duplex fullspeed 100!interface FastEthernet1/4 switchport mode trunkduplex fullspeed 100!interface FastEthernet1/5 switchport mode trunkduplex fullspeed 100!interface FastEthernet1/6 duplex fullspeed 100!interface FastEthernet1/7 duplex fullspeed 100!interface FastEthernet1/8 duplex fullspeed 100!interface FastEthernet1/9 duplex fullspeed 100!interface FastEthernet1/10 duplex fullspeed 100!interface FastEthernet1/11 duplex fullspeed 100!interface FastEthernet1/12 duplex fullspeed 100!interface FastEthernet1/13 duplex fullspeed 100!interface FastEthernet1/14 duplex fullspeed 100!interface FastEthernet1/15 duplex fullspeed 100!interface Vlan1no ip addressno ip route-cacheshutdown!no ip http serverno ip http secure-server ip classless!!!no cdp log mismatch duplex !!!control-plane!!!!!!!!!banner exec ^C************************************************************* **This is a normal Router with a SW module inside (NM-16ESW)It has been preconfigured with hard coded speed and duplexTo create vlans use the command "vlan database" from exec modeAfter creating all desired vlans use "exit" to apply the config To view existing vlans use the command "show vlan-switch brief"Warning: You are using an old IOS image for this router. Please update the IOS to enable the "macro" command!************************************************************* **^C!line con 0exec-timeout 0 0privilege level 15logging synchronousline aux 0exec-timeout 0 0privilege level 15logging synchronousline vty 0 4login!!endR1 show running-configR1#show running-configBuilding configuration...Current configuration : 2114 bytes!version 12.3service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption!hostname R1!boot-start-markerboot-end-marker!!no aaa new-model!resource policy!memory-size iomem 5ip subnet-zerono ip icmp rate-limit unreachableip tcp synwait-time 5!!ip cefno ip domain lookupno ip dhcp use vrf connected!ip dhcp pool vlan10network 192.168.10.0 255.255.255.0 default-router 192.168.10.1dns-server 3.3.3.3!ip dhcp pool vlan20network 192.168.20.0 255.255.255.0 default-router 192.168.20.1dns-server 3.3.3.3!ip dhcp pool vlan30network 192.168.30.0 255.255.255.0 default-router 192.168.30.1dns-server 3.3.3.3!ip dhcp pool vlan40network 192.168.40.0 255.255.255.0 default-router 192.168.40.1dns-server 3.3.3.3!!!!!!!!!!!!!!!!!no crypto isakmp ccm!!!!interface Ethernet0/0ip address 192.168.200.2 255.255.255.0 half-duplex!interface Ethernet0/1ip address 192.168.100.2 255.255.255.0 half-duplex!interface Ethernet0/2no ip addressshutdownhalf-duplexinterface Ethernet0/3 no ip addressshutdownhalf-duplex!interface Ethernet1/0 no ip addressshutdownhalf-duplex!interface Ethernet1/1 no ip addressshutdownhalf-duplex!interface Ethernet1/2 no ip addressshutdownhalf-duplex!interface Ethernet1/3 no ip addressshutdownhalf-duplex!no ip http serverno ip http secure-serverip classlessip route 192.168.10.0 255.255.255.0 192.168.100.1 ip route 192.168.10.0 255.255.255.0 192.168.200.1 ip route 192.168.20.0 255.255.255.0 192.168.100.1 ip route 192.168.20.0 255.255.255.0 192.168.200.1 ip route 192.168.30.0 255.255.255.0 192.168.100.1 ip route 192.168.30.0 255.255.255.0 192.168.200.1 ip route 192.168.40.0 255.255.255.0 192.168.100.1 ip route 192.168.40.0 255.255.255.0 192.168.200.1 !!!no cdp log mismatch duplex!!!control-plane!!!!!!!!!!line con 0exec-timeout 0 0privilege level 15 logging synchronous line aux 0exec-timeout 0 0privilege level 15 logging synchronous line vty 0 4login!!end六实验结论通过这系列实验,熟悉了HSRP的协议,加深了理解。
HSRP热备份实验小组成员:赵鹏飞、李阳、张业萌、文秀柱袁泽龙、谭璐、刘鉴滢、马振昊一、需求分析 (3)1. 应用背景 (3)2. 用户需求 (3)二、设计分析 (4)1.实验分析 (4)2.规划后的新的拓扑图如下: (4)三、 IP规划 (4)四、使用技术 (5)1. 热备份简介 (5)2. 本协议的特点 (5)五、设备选型 (6)1.设备选购 (6)2.设备清单 (7)六、配置步骤 (7)1.RS1配置如下: (7)2.RS2配置如下: (8)3.检查是否配置成功 (8)4.测试结果 (9)七、综述方案特点 (11)一、需求分析1. 应用背景随着Internet的日益普及,人们对网络的依赖性也越来越强。
这同时对网络的稳定性提出了更高的要求,人们自然想到了基于设备的备份结构,就像在服务器中为提高数据的安全性而采用双硬盘结构一样。
路由器是整个网络的核心和心脏,如果路由器发生致命性的故障,将导致本地网络的瘫痪,如果是骨干路由器,影响的范围将更大,所造成的损失也是难以估计的。
因此,对路由器采用热备份是提高网络可靠性的必然选择。
在一个路由器或交换机完全不能工作的情况下,它的全部功能便被系统中的另一个备份路由器或交换机完全接管,直至出现问题的路由器或交换机恢复正常,这就是热备份路由协议(HotStandbyRouterProtocal),HSR PRFC2281技术要解决的问题。
2. 用户需求拓扑图如下:要求:正常情况下S1下连的所有PC通过RS1连接Internet,S2下连的所有PC通过RS2连接Internet.当链路出现故障时,PC通过所连的另一线路连接Intenet二、 设计分析1.实验分析首先将23\24端口激活为三层端口,然后配上相应IP,然后,Group 10虚拟IP 为192.168.1.3, Group 20虚拟IP 为192.168.2.3,并把各端口设为抢占模式.对于RS1,将24端口加入Group 10,优先级为20, 将23端口加入Group 20, 优先级为10,; 对于RS2,将24端口加入Group 20, 优先级为20,将23端口加入Group 10,优先级为10.2.规划后的新的拓扑图如下:三、 IP 规划设备 IP 端口 与S1连接的端口 与S2连接的端口RS1 192.168.1.1 24 24192.168.2.1 23 23 RS2 192.168.1.2 23 23192.168.2.2 24 24 四、使用技术使用热备份协议完成需求1. 热备份简介HSRP:热备份路由器协议(HSRP:Hot Standby Router Protocol)热备份路由器协议(HSRP)的设计目标是支持特定情况下IP 流量失败转移不会引起混乱、并允许主机使用单路由器,以及即使在实际第一跳路由器使用失败的情形下仍能维护路由器间的连通性。
目录HSRP实验过程及报告 (2)实验环境: (2)实验拓扑: (2)实验目的: (2)实验过程: (3)1 配置交换机 (3)2 测试HSRP (5)3测试HSRP跟踪 (8)实验总结: (10)HSRP实验过程及报告实验环境:DynamipsGUI模拟器模拟出4台cisco3640三层交换机。
两台开启HSRP协议,设备之间使用Ethernetchannel绑定的两条线路互联。
其余两台交换机分别连接到这两台交换机。
实验拓扑:实验拓扑如图1实验目的:熟悉HSRP协议,验证HSRP网关冗余特性,测试HSRP抢占过程及HSRP接口跟踪。
实验过程:1 配置交换机在交换机SW1配置F0/0.F0/1接口加入channel-group 1 并将port-channel 1 配置为trunk模式。
SW1(config)#int range f0/0 - 1SW1(config-if-range)#channel-group 1 mode onCreating a port-channel interface Port-channel1SW1(config-if-range)#*Mar 1 01:23:58.639: %EC-5-BUNDLE: Interface Fa0/0 joined port-channel Po1 *Mar 1 01:23:58.935: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1 SW1(config-if-range)#*Mar 1 01:24:01.415: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to upSW1(config-if-range)#exitSW1(config)#int port-channel 1SW1(config-if)#switchport mode trunkSW1(config-if)#endSW1#sh etherchannel suFlags: D - down P - in port-channelI - stand-alone s - suspendedR - Layer3 S - Layer2U - in useGroup Port-channel Ports-----+------------+-----------------------------------------------------------1 Po1(SU) Fa0/0(P) Fa0/1(P)在交换机SW2上同样的配置。
HSRP热备份【实验名称】:HSRP (Hot Standby Routing Protocol)热备份路由协议【实验拓扑】:【实验原理】:HSRP 是Hot Standby Routing Protocol(热备份路由协议)的缩写。
它的作用是能够把一台或多台路由器用来做备份,所谓热备份是指当使用的路由器不能正常工作时,候补的路由器能够实现平滑的替换,尽量不被察觉。
HSRP概念:热备份路由协议 (Hot Standby Routing Protocol)当主机使用缺省网关实现容错备份功能适用于支持多播或广播的局域网如 Ethernet, Toking Ring, FDDI等HSRP 用于广播或多播局域网上的路由器热备份,并适于静态的路由配置,实际上HSRP 正是解决设备不能动态适应路由改变的问题。
【实验步骤】:1.按拓扑图将网络搭建好,配置好三个路由的信息,在三个路由器上启用rip协议。
2.将客户机A(网关:192.168.6.1、192.168.7.1)与路由桥接,并检测是否联通。
3.使用HSRP 协议,开始R6与R7路由HSRP 协议的配置@:其中R7的优先级比R6的优先级高4.断开R7的fa2/0接口,这时R6的优先级高,用客户机B在去ping 192.168.56.1 追踪经过的路由,查看数据包走的是那条断开R7的fa2/0接口,这时R6的优先级高,用客户机B在去ping 192.168.56.1 追踪经过的路由,查看数据包走的是那条1.按拓扑图将网络搭建好,配置好三个路由的信息,在三个路由器上启用rip协议。
R5配置信息:Router>enableRouter#config tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R5R5(config)#int s1/1R5(config-if)#ip add 192.168.56.1 255.255.255.0R5(config-if)#no shutR5(config-if)#exitR5(config)#int s1/2R5(config-if)#ip add 192.168.57.1 255.255.255.0R5(config-if)#no shutR5(config-if)#exitR5(config)#int lo5R5(config-if)#ip add 192.168.5.1 255.255.255.0R5(config-if)#no shutR5(config-if)#exitR5(config)#router ripR5(config-router)#net 192.168.56.0R5(config-router)#net 192.168.57.0R5(config-router)#net 192.168.5.0R5(config-router)#exitR5(config)#R6 配置信息:Router>enableRouter#config tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R6R6(config)#int s1/0R6(config-if)#ip add 192.168.56.2 255.255.255.0R6(config-if)#no shutR6(config-if)#exitR6(config)#int fa2/0R6(config-if)#ip add 192.168.6.1 255.255.255.0R6(config-if)#no shutR6(config-if)#exitR6(config)#router ripR6(config-router)#net 192.168.56.0R6(config-router)#net 192.168.6.0R6(config-router)#endR6#R7配置信息:R7(config)#int s1/4R7(config-if)#ip add 192.168.57.2 255.255.255.0R7(config-if)#no shutR7(config-if)#int fa2/0R7(config-if)#ip add 192.168.6.100 255.255.255.0R7(config-if)#no shutR7(config-if)#exitR7(config)#router ripR7(config-router)#net 192.168.57.0R7(config-router)#net 192.168.6.0R7(config-router)#endR7#2.将客户机A(网关:192.168.6.1、)与路由桥接,并检测是否联通。
HSRP协议原理及配置8.1 实验目的:1. 熟悉HSRP协议原理;2. 掌握HSRP的配置;3. 熟悉HSRP的应用。
8.2 实验环境:本实验至少需要三台路由器、一台交换机、两台主机。
实验中用交换机模拟局域网,其中局域网A有两台路由器与局域网B相连,所以为了安全可靠,我们在两台路由器之间进行备份。
这就是我们本实验要讨论的热备份路由协议。
具体的实验组网如下:8.3 实验步骤:8.3.1 实验准备本实验需要使用HSRP协议完成路由器之间的热备份,在HSRP中需要使用到虚拟IP 地址,用该IP地址用作主机的缺省网关,就可以在一台路由器故障时,不修改主机配置而仍然与主机PCC通信。
所以我们首先要规划IP地址。
本实验的IP地址规划如下:路由器的接口IP地址分配如下:RTA RTB RTCE0 10.110.32.11/21 10.110.32.10/21 10.110.10.100/24S0 1.0.0.1/24 1.0.0.2S1 2.0.0.1/24 2.0.0.2各主机的IP地址分配如下:PCA PCB PCCIP 10.110.32.20 10.110.10.30 10.110.10.1Gateway 10.110.32.1 10.110.10.1 10.110.10.1008.3.2 单备份组配置本实验需要路由器RTA与RTB实现热备份,并且正常时以RTA为活动路由器,并且在RTA由故障状态恢复正常时能继续担当活动路由器。
根据实验要求和HSRP协议原理可以设定RTA的优先级较高(默认值为100),同时置抢占标志,即可满足要求。
具体实验配置步骤很简单,不再赘述,下面列出各路由器的配置信息供您参考:RTA(config-if-Ethernet0)#show running-configNow create configuration...Current configuration!version 1.5.6hostname RTA!interface Aux0async mode interactiveencapsulation ppp!interface Ethernet0speed autoduplex autono loopbackip address 10.110.32.11 255.255.248.0standby 1 ip 10.110.32.1 //创建备份组并设定虚拟IP地址standby 1 preempt //设定抢占标志standby 1 priority 120 //设定优先级ip rip version 2 mcast //设定RIP协议版本!interface Serial0encapsulation pppip address 1.0.0.1 255.255.255.0ip rip version 2 mcast!interface Serial1encapsulation ppp!exitrouter ripno auto-summary //取消自动聚合功能network all!endRTB(config-if-Serial1)#show running-configNow create configuration...Current configuration!version 1.5.6hostname RTB!interface Aux0async mode interactiveencapsulation ppp!interface Ethernet0speed autoduplex autono loopbackip address 10.110.32.10 255.255.248.0standby 1 ip 10.110.32.1standby 1 preemptip rip version 2 mcast!interface Serial0encapsulation ppp!interface Serial1encapsulation pppip address 2.0.0.1 255.255.255.0ip rip version 2 mcast!exitrouter ripno auto-summarynetwork all!endRTC(config-if-Serial1)#show running-config Now create configuration...Current configuration!version 1.5.6logging consolehostname RTC!interface Aux0async mode interactiveencapsulation ppp!interface Ethernet0speed autoduplex autono loopbackip address 10.110.10.100 255.255.255.0ip rip version 2 mcast!interface Serial0clock-select DTECLK1encapsulation pppip address 1.0.0.2 255.255.255.0ip rip version 2 mcast!interface Serial1clock-select DTECLK1encapsulation pppip address 2.0.0.2 255.255.255.0ip rip version 2 mcast!exitrouter ripno auto-summarynetwork all!end注意:在配置动态路由协议时,由于使用的是RIP协议,该协议默认版本version 1不支持可变长子网掩码,而实验中设定的IP地址又是A类地址。
HSRP基本实验及其测试实验拓扑如下:(1)R1的基本配置SW1(config)#interface range f0/0 – 1SW1(config-if-range)#channel-group 1 mode onSW1(config)#interface port-channel 1SW1(config-if)#switchport mode trunk*****************************************************************R1中HSRP的配置****************************************************************** SW1(config-if)#standby 1 ip 192.168.1.254SW1(config-if)#standby 1 priority 120SW1(config-if)#standby preempt(2)R2的基本配置SW1(config)#interface range f0/0 – 1SW1(config-if-range)#channel-group 1 mode onSW1(config)#interface port-channel 1SW1(config-if)#switchport mode trunk*****************************************************************R2中HSRP的配置****************************************************************** SW2(config-if)#standby 1 ip 192.168.1.254SW2(config-if)#standby preempt注意,在SW2中没有指定priority,所以HSRP默认使用100(3)测试HSRP Active router和standby router之间的切换R1上show standby vlan 1显示结果如下:SW1#show standby vlan 1Vlan1 - Group 1State is Active2 state changes, last state change 00:07:18Virtual IP address is 192.168.1.254Active virtual MAC address is 0000.0c07.ac01Local virtual MAC address is 0000.0c07.ac01 (v1 default)Hello time 3 sec, hold time 10 secNext hello sent in 2.752 secsPreemption enabledActive router is localStandby router is 192.168.1.2, priority 100 (expires in 8.916 sec)Priority 120 (configured 120)IP redundancy name is "hsrp-Vl1-1" (default)SW2#show standby vlan 1Vlan1 - Group 1State is Standby1 state change, last state change 00:08:34Virtual IP address is 192.168.1.254Active virtual MAC address is 0000.0c07.ac01Local virtual MAC address is 0000.0c07.ac01 (v1 default)Hello time 3 sec, hold time 10 secNext hello sent in 1.396 secsPreemption enabledActive router is 192.168.1.1, priority 120 (expires in 9.372 sec)Standby router is localPriority 100 (default 100)IP redundancy name is "hsrp-Vl1-1" (default)******************************************************************************* 将SW1和SW3之间的链路中断,观察active router 和standby router的转换******************************************************************************* SW1(config)#interface vlan 1SW1(config-if)#shutdown*Mar 1 00:36:19.947: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Active -> Init Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.4, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 24/58/84 ms这个结果说明,当avtive router SW1出现故障时,standby router SW2开始运行,而用户的服务不会中断;因为这个时候已经配置了抢占,所以SW2这个时候成了avtive router*Mar 1 00:36:19.747: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Standby -> Active@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ SW1(config)#interface vlan 1SW1(config-if)#no shutdown*Mar 1 00:40:14.063: %HSRP-5-STATECHANGE: Vlan1 Grp 1 state Listen -> Active可见,当SW1的故障恢复的时候,它又称为了avtive router,因为配置的时候配置了抢占。
实验三十七、交换机HSRP 实验一、实验目的1、熟悉HSRP 协议的使用方式和配置方法;2、理解HSRP 协议的适用场合。
二、应用环境大部分网络中的PC 都是指定默认网关的,PC 通过默认网关达到上网的目的。
如果作为默认网关的交换机损坏,所有使用该网关为下一跳主机的通信必然要中断。
即便配置了多个默认网关,如不重新启动终端设备,也不能切换到新的网关。
HSRP 就是为了避免静态指定网关的缺陷而设计的。
在网络中有至少两台设备作为 PC 的网关存在,并且这两台设备可以虚拟出一个相同的IP 作为PC 的网关,也就是说一个IP 地址可以对应两台交换机设备,任何一台交换机失效,都不会影响下面PC 的通信。
HSRP,全称Hot Standby Routing Protocol,原理类似于服务器HA 群集,两台或更多的三层设备以同样的方式配置成Cluster,创建出单个的虚拟路由器,然后客户端将网关指向该虚拟路由器。
最后由HSRP 决定哪个设备扮演真正的默认网关。
三、实验设备1、DCRS-7604(或6804)交换机1 台2、DCRS-5526S 交换机1 台3、HUB 或交换机1 台4、PC机2-4台5、Console 线1-2 根6、直通网线若干根五、实验要求1、在交换机7604 和交换机5526S 上分别划分基于端口的VLAN:交换机VLAN 端口成员IPDCRS-7604 1 24 10.1.157.1/24100 1 192.168.100.2/2410 8-16 192.168.10.1/24DCRS-5526S 1 24 10.1.157.2/24100 1 192.168.100.3/2420 8-16 192.168.20.1/242、PC1-PC4 的网络设置为:设备IP 地址gateway MaskPC1 192.168.100.101 192.168.100.1 255.255.255.0PC2 192.168. 100.102 192.168.100.1 255.255.255.0PC3 192.168.10.2 192.168.10.1 255.255.255.0PC4 192.168.20.2 192.168.20.1 255.255.255.03、验证:无论拔掉192.168.100.1 的线还是192.168.100.2 的线,PC1 和PC2 不需要做网络设置的改变都可以与PC3 和PC4 通信。
则证明HSRP 正常工作。
第一步:交换机全部恢复出厂设置,配置交换机的VLAN信息交换机DCRS-7604:DCRS-7604#confDCRS-7604(Config)#vlan 100DCRS-7604(Config-Vlan100)#switchport interface ethernet 1/24DCRS-7604(Config-Vlan100)#exitDCRS-7604A(Config)#vlan 10DCRS-7604A(Config-Vlan10)#switchprt interface ethernet 1/8-16DCRS-7604A(Config-Vlan10)#exit交换机DCRS-5526S:DCRS-5526S(Config)#vlan 100DCRS-5526S(Config-Vlan100)#switchport interface ethernet 0/0/24DCRS-5526S(Config-Vlan100)#exitDCRS-5526S(Config)#vlan 20DCRS-5526S(Config-Vlan20)#switchport interface ethernet 0/0/8-16DCRS-5526S(Config-Vlan20)#exit第二步:配置交换机各vlan虚接口的IP地址交换机DCRS-7604:DCRS-7604(Config)#int vlan 1DCRS-7604(Config-If-Vlan1)#ip address 10.1.157.1 255.255.255.0DCRS-7604(Config-If-Vlan1)#no shutDCRS-7604(Config-If-Vlan1)#exitDCRS-7604(Config)#int vlan 100DCRS-7604(Config-If-Vlan100)#ip address 192.168.100.2 255.255.255.0 DCRS-7604(Config-If-Vlan100)#no shutDCRS-7604(Config-If-Vlan100)#exitDCRS-7604A(Config)#int vlan 10DCRS-7604A(Config-If-Vlan10)#ip address 192.168.10.1 255.255.255.0 DCRS-7604A(Config-If-Vlan10)#no shutDCRS-7604A(Config-If-Vlan10)#exit交换机DCRS-5526S:DCRS-5526S(Config)#int vlan 1DCRS-5526S(Config-If-Vlan1)#ip address 10.1.157.2 255.255.255.0DCRS-5526S(Config-If-Vlan1)#no shutDCRS-5526S(Config-If-Vlan1)#exitDCRS-5526S(Config)#int vlan 100DCRS-5526S(Config-If-Vlan100)#ip address 192.168.100.3 255.255.255.0 DCRS-5526S(Config-If-Vlan100)#exitDCRS-5526S(Config)#int vlan 20DCRS-5526S#由此可见:HSRP已经成功建立,并且master的机器是5526S,因为它的优先级是20,高于7604的优先级10。
第五步:验证实验1、使用PC1和PC2 ping 目的地址。
PC Ping 结果原因PC1、PC2 192.168.100.1 通PC1、PC2 PC3、PC4 通2、在PC1使用“ping192.168.100.1 -t”命令,并且在过程中拔掉192.168.100.3的网线,观察情况。
七、注意事项和排错在配置、使用HSRP 协议时,可能会由于物理连接、配置错误等原因导致HSRP 协议未能正常运行。
因此,用户应注意以下要点:首先应该保证物理连接的正确无误;其次,保证接口和链路协议是UP(使用show interface 命令);然后,确保在接口上已启动了HSRP 协议;检查同一备份组内的不同交换机认证是否相同;检查同一备份组内的不同交换机配置的timer 时间是否相同;检查虚拟IP 地址是否和接口真实IP 地址在同一网段内;八、配置序列Current configuration:!hostname DCRS-7604!Vlan 1vlan 1!Vlan 100vlan 100!Interface Ethernet1/1switchport access vlan 100!Interface Ethernet1/2……Interface Ethernet1/28!interface Vlan1interface vlan 1ip address 10.1.157.1 255.255.255.0!interface Vlan100interface vlan 100ip address 192.168.100.2 255.255.255.0standby 100 ip 192.168.100.1standby 100 priority 10standby 100 authentication xuxp!Interface Ethernet0!DCRS-7604#九、相关配置命令详解standby authentication命令:standby [<group>] authentication <string>no standby [<group>] authentication功能:配置HSRP 认证;本命令的no 操作为恢复HSRP 缺省认证方式。
参数:<group>为组序号,取值范围为0~255;<string>为认证字符串,长度为1~8 个字符。
缺省情况:缺省认证字符串为“DCN”;<group>如不指定,缺省为0。
命令模式:VLAN 接口配置模式使用指南:该命令用于避免HSRP 备份组受到非授权成员的干扰,同一备份组内的所有交换机应设为相同的字符串。
举例:配置组10 的认证授权字符串为“public”。
Switch(config)#interface vlan 1Switch(Config-If-Vlan1)#standby 10 authentication publicstandby ip命令:standby [<group>] ip [<A.B.C.D>]no standby [<group>] ip [<A.B.C.D>]功能:启动/关闭HSRP。
参数:<group>为组序号,取值范围为0~255;<A.B.C.D>为虚拟IP 地址。
缺省情况:缺省为不配置;<group>如不指定,缺省为0;<A.B.C.D>如不指定,缺省为0.0.0.0。
命令模式:VLAN 接口配置模式使用指南:启动HSRP,如果虚拟IP 地址不指定,交换机不会参与备份,直到从备份组中的活动交换机获得虚拟IP 地址。
虚拟IP 应该是接口所在的网段内的地址。
一旦退出HSRP 备份组,则交换机在该组上设置的其他属性都不再起作用。
举例:配置组10 的虚拟ip 地址为10.1.1.1Switch(config)#interface vlan 1Switch(Config-If-Vlan1)#standby 10 ip 10.1.1.1standby preempt命令:standby [<group>] preemptno standby [<group>] preempt功能:配置HSRP 为抢占模式;本命令的no 操作为取消抢占模式。
参数:<group>为组序号,取值范围为0~255。
命令模式:VLAN 接口配置模式缺省情况:缺省为不抢占;<group>缺省为0。