拓扑图

 

HSRP基础实验_第1张图片

实验过程

1.       pc的配置

Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host pc

pc(config)#no ip routing

pc(config)#int f0/0

pc(config-if)#no shut

pc(config-if)#ip add 192.168.1.1 255.255.255.0

pc(config-if)#exit

pc(config)#ip default-gateway 192.168.1.254

pc(config)#end

2.       R1的配置

Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R1

R1(config)#int f0/0

R1(config-if)#no shut

R1(config-if)#ip add 192.168.1.10 255.255.255.0

R1(config-if)#standby 10 ip 192.168.1.254  //配置hsrp10IP

3.       R2的配置

Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host R2

R2(config)#int f0/0

R2(config-if)#no shut

R2(config-if)#ip add 192.168.1.20 255.255.255.0

R2(config-if)#standby 10 ip 192.168.1.254

R2(config-if)#end

4.       查看HSRP信息

R1#show standby brief

                     P indicates configured to preempt.

                     |

Interface   Grp Prio P State    Active          Standby         Virtual IP    

Fa0/0       10  100  P Active   local           192.168.1.20    192.168.1.254

R2#show standby brief

                     P indicates configured to preempt.

                     |

Interface   Grp Prio P State    Active          Standby         Virtual IP    

Fa0/0       10  100  P Standby  192.168.1.10    local           192.168.1.254

说明:现在R1Active RouterR2Standby Router

 

5.       测试连通性

pc#ping 192.168.1.254

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 4/224/1064 ms

pc#traceroute 192.168.1.254

 

Type escape sequence to abort.

Tracing the route to 192.168.1.254

 

  1 192.168.1.10 28 msec *  20 msec  //pc走的是R1

6.       关闭R1f0/0口,模拟故障

R1(config)#int f0/0

R1(config-if)#shut

R2#show standby bri

                     P indicates configured to preempt.

                     |

Interface   Grp Prio P State    Active          Standby         Virtual IP    

Fa0/0       10  100  P Active   local       unknown         192.168.1.254

说明:现在R2Active Router

 

7.       测试连通性

pc#ping 192.168.1.254     

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 16/52/100 ms

pc#traceroute 192.168.1.254

*Mar  1 00:21:50.615: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on FastEthernet0/0 (not half duplex), with R2 FastEthernet0/0 (half duplex).

pc#traceroute 192.168.1.254

 

Type escape sequence to abort.

Tracing the route to 192.168.1.254

 

  1 192.168.1.20 56 msec *  52 msec  //pcR2路由器