HSRP R1172网段的活跃路由,是10网段的备份路由。 R2172网段的备份路由,是10网段的活跃路由。
HSRP_HSRP
R1
en
conf t
int f0/0
ip add 10.10.10.1 255.255.255.0
standby 10 ip 10.10.10.254   组号是10,虚拟ip是10.10.10.254
standby 10 priority 110     组号是10,优先级是110. 
no shut
exit
int f1/0
ip add 172.16.10.1 255.255.255.0
standby172 ip 172.16.10.254   组号是172,虚拟ip172.16.10.254
standby 172 priority 120      组号是172,优先级是120
no shut
exit
Router#show standby brief    显示HSRP的详细状态
                     P indicates configured to preempt|
Interface  Grp  Prio P  State    Active addr     Standby addr    Group addr    
Fa0/0     10   110   Standby  10.10.10.2      local           10.10.10.254  
Fa1/0     72   120    Active   local          172.16.10.2     172.16.10.254
conf t
int f0/0
standby 10 preempt       占先权
exit
int f1/0
standby 172 preempt     占先权
exit
Router#show standby
FastEthernet0/0 - Group 10
  Local state is Standby, priority 110, may preempt
  Hellotime 3 sec, holdtime 10 sec
  Next hello sent in 0.204
  Virtual IP address is 10.10.10.254 configured
  Active router is 10.10.10.2, priority 120 expires in 7.652
  Standby router is local
  1 state changes, last state change 00:02:52
  IP redundancy name is "hsrp-Fa0/0-10" (default)
FastEthernet1/0 - Group 72
  Local state is Active, priority 120
  Hellotime 3 sec, holdtime 10 sec
  Next hello sent in 1.384
  Virtual IP address is 172.16.10.254 configured
  Active router is local
  Standby router is 172.16.10.2, priority 110 expires in 7.532
  Virtual mac address is 0000.0c07.ac48
  2 state changes, last state change 00:03:12
  IP redundancy name is "hsrp-Fa1/0-72" (default)
conf t
int f1/0
standby 172 track f0/0 50     端口跟踪
exit
int f0/0
shut      关闭出口
配置占先权的时候,两边都要配置。
R2
en
conf t
int f0/0
ip add 10.10.10.2 255.255.255.0
standby 10 ip 10.10.10.254   组号是10,虚拟ip10.10.10.254
standby 10 priority 120     组号是10,优先级是120. 
no shut
exit
int f1/0
ip add 172.16.10.2 255.255.255.0
standby 172 ip 172.16.10.254  组号是172,虚拟ip172.16.10.254
standby 172 priority 110      组号是172,优先级是110
no shut
exit
Router#show standby brief
                     P indicates configured to preempt|
Interface  Grp  Prio P State     Active addr     Standby addr       Group addr    
Fa0/0     10  120    Active   local          10.10.10.1      10.10.10.254  
Fa1/0     72  110    Standby  172.16.10.1     local           172.16.10.254
conf t
int f0/0
standby 10 preempt     占先权
exit
int f1/0
standby 172 preempt    占先权
exit
Router#show standby
FastEthernet0/0 - Group 10
  Local state is Active, priority 120, may preempt 占先权
  Hellotime 3 sec, holdtime 10 sec
  Next hello sent in 2.646
  Virtual IP address is 10.10.10.254 configured
  Active router is local
  Standby router is 10.10.10.1, priority 110 expires in 9.468
  Virtual mac address is 0000.0c07.ac0a
  2 state changes, last state change 00:03:16
  IP redundancy name is "hsrp-Fa0/0-10" (default)
FastEthernet1/0 - Group 72
  Local state is Standby, priority 110
  Hellotime 3 sec, holdtime 10 sec
  Next hello sent in 2.576
  Virtual IP address is 172.16.10.254 configured
  Active router is 172.16.10.1, priority 120 expires in 7.640
  Standby router is local
  1 state changes, last state change 00:02:56
  IP redundancy name is "hsrp-Fa1/0-72" (default)
Router#show standby brief
                    P indicates configured to preempt
Interface  Grp  Prio P State        Active addr    Standby addr      Group addr    
Fa0/0     10   120  P Active     local          unknown         10.10.10.254  
Fa1/0     172  110  P Speak    172.16.10.1     unknown         172.16.10.254 
Router#show standby brief
                     P indicates configured to preempt
Interface  Grp  Prio  P  State     Active addr     Standby addr    Group addr    
Fa0/0     10   120  P  Active    local          unknown        10.10.10.254  
Fa1/0     172  110  P  Standby  172.16.10.1     local           172.16.10.254 
   PC1的操作
因为R1172网段的活跃路由,由于端口F0/0被关闭了,R2则成为活跃路由,从10.10.10.2过。当端口激活后从10.10.10.1过。
VPCS 1 >tracert 172.16.10.10
traceroute to 172.16.10.10, 64 hops max
  1 10.10.10.2     266.000 ms
  2 10.10.10.2     375.000 ms
VPCS 1 >tracert 172.16.10.10
traceroute to 172.16.10.10, 64 hops max
  1 10.10.10.1     203.000 ms
  2 10.10.10.1     406.000 ms
然后激活接口,则效果是
Router#show standby brief
                     P indicates configured to preempt.
Interface  Grp  Prio  P  State    Active addr     Standby addr    Group addr    
Fa0/0     10  120   P  Active   local          unknown        10.10.10.254  
Fa1/0     172  110  P  Init 初始化    172.16.10.1     unknown        172.16.10.254 
Router#show standby brief
                     P indicates configured to preempt.
Interface  Grp  Prio  P  State    Active addr     Standby addr    Group addr    
Fa0/0     10   120  P  Active   local          10.10.10.1      10.10.10.254  
Fa1/0     172  110  P  Speak   172.16.10.1     unknown      172.16.10.254 
Router#show standby brief
                     P indicates configured to preempt.|
Interface  Grp  Prio  P  State    Active addr     Standby addr    Group addr    
Fa0/0    10   120   P  Active   local          10.10.10.1      10.10.10.254  
Fa1/0    172  110   P  Standby  172.16.10.1     local          172.16.10.254