HSRP
R1是172網段的活躍路由,是10網段的備份路由。
R2是172網段的備份路由,是10網段的活躍路由。
●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,虛擬ip是172.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.0c 07.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,虛擬ip是10.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,虛擬ip是172.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.0c 07.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的操作
因爲R1是172網段的活躍路由,由於端口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