例によってccstudyさんのブログを参考にHSRPの動作を実際にためしてみることにします。今回はGNS3を使って再現してみました。
構成は下記の通りです。
■設定
[RouterA]
interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 full-duplex standby 1 ip 192.168.1.254 :仮想IPアドレスを設定 standby 1 priority 255 :プライオリティを設定、設定しなければデフォルトは100 ! interface Ethernet0/1 ip address 192.168.2.1 255.255.255.0 full-duplex ! router ospf 1 log-adjacency-changes passive-interface Ethernet0/0 :PC側にはOSPFパケットを流さない
[RouterB]
interface Ethernet0/0
ip address 192.168.1.2 255.255.255.0
full-duplex
standby 1 ip 192.168.1.254
!
interface Ethernet0/1
ip address 192.168.3.1 255.255.255.0
full-duplex
!
router ospf 1
log-adjacency-changes
passive-interface Ethernet0/0 :PC側にはOSPFパケットを流さない
network 0.0.0.0 255.255.255.255 area 0
[RouterC]
interface Loopback0 ip address 192.168.4.1 255.255.255.0 ip ospf network point-to-point ! interface Ethernet0/0 ip address 192.168.2.2 255.255.255.0 full-duplex ! interface Ethernet0/1 ip address 192.168.3.2 255.255.255.0 full-duplex ! router ospf 1 log-adjacency-changes network 0.0.0.0 255.255.255.255 area 0 !
■確認
WinXPのゲートウェイを192.168.1.254に設定しゲートウェイへのPing,RouterCのループバックアドレスへの疎通を確認。
RouterA、RouterBでhsrpの状態を確認してみます。
[RouterA]
RouterA#sh standby
Ethernet0/0 - Group 1
State is Active
8 state changes, last state change 00:49:55
Virtual IP address is 192.168.1.254
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.604 secs
Preemption disabled
Active router is local :自身をアクティブとして認識
Standby router is 192.168.1.2, priority 100 (expires in 9.468 sec)
Priority 255 (configured 255)
IP redundancy name is "hsrp-Et0/0-1" (default)
RouterA#
[RouterB]
RouterB#sh standby
Ethernet0/0 - Group 1
State is Standby
19 state changes, last state change 00:12:58
Virtual IP address is 192.168.1.254
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.516 secs
Preemption disabled
Active router is 192.168.1.1, priority 255 (expires in 7.692 sec)
Standby router is local :自身をスタンバイとして認識
Priority 100 (default 100)
IP redundancy name is "hsrp-Et0/0-1" (default)
RouterB#
ここでGNS3上でrouterAとSW1間のケーブルを削除してみます。(なおGNSではリンクを削除してもRouterAではなぜかEthernet0/0 is up, line protocol is upで認識される。)
Helloパケットを受け取れずスタンバイがアクティブへ昇格。
SW1のMACアドレステーブルを更新させるため、GrotuitiusARPを発行。仮想MACアドレスとポートの紐付けを変更させています。
(※仮想MACでは無く機器の物理MACを利用するuse-biaコマンドというコマンドもある模様)