LoginSignup
0
0

久しぶりにGNS(その28:HSRP)

Posted at

HSRP(Hot Standby Router Protocol)

デフォルトゲートウェイを冗長化する、HSRP(Hot Standby Router Protocol)をGNS3上で動作確認した時のメモ。

ネットワーク

topology.png
上図を参照。

  • 対象ネットワーク:172.16.1.0/24
    • HSRPの対象ルーター:3台(Router1,2,3)
      • IPアドレス:末尾が1,2,3
    • デフォルトゲートウェイのIPアドレス:172.16.1.254
    • 対象ネットワーク内のクライアントPCのIPアドレス:172.16.1.11
  • HSRPの対象ルーターに接続ルーターRouter4のネットワーク
    • 192.168.10.0/24, 192.168.20.0/24, 192.168.30.0/24
  • Router4に接続ルーターRouter5のネットワーク
    • 192.168.0.0/24
  • EIGRPでルーティング

設定

関連部分のみ記載。

Router1

interface Ethernet0/0
 ip address 172.16.1.1 255.255.255.0
 standby 1 ip 172.16.1.254

interface Ethernet0/1
 ip address 192.168.10.2 255.255.255.0

router eigrp 10
 network 172.16.1.0 0.0.0.255
 network 192.168.10.0
  • IPアドレス設定
  • EIGRP設定
  • HSRP設定(standby 1 ip 172.16.1.254)
    • 優先度などの設定無し

Router2

interface Ethernet0/0
 ip address 172.16.1.2 255.255.255.0
 standby 1 ip 172.16.1.254

interface Ethernet0/2
 ip address 192.168.20.2 255.255.255.0

router eigrp 10
 network 172.16.1.0 0.0.0.255
 network 192.168.20.0

Router1と設定は同じ。

Router3

interface Ethernet0/0
 ip address 172.16.1.3 255.255.255.0
 standby 1 ip 172.16.1.254

interface Ethernet0/3
 ip address 192.168.30.2 255.255.255.0

router eigrp 10
 network 172.16.1.0 0.0.0.255
 network 192.168.30.0 

こちらもRouter1と設定は同じ。

Router4

interface Ethernet0/0
 ip address 192.168.0.1 255.255.255.0

interface Ethernet0/1
 ip address 192.168.10.1 255.255.255.0

interface Ethernet0/2
 ip address 192.168.20.1 255.255.255.0

interface Ethernet0/3
 ip address 192.168.30.1 255.255.255.0

router eigrp 10
 network 192.168.0.0
 network 192.168.10.0
 network 192.168.20.0
 network 192.168.30.0

IPアドレス設定とEIGRP設定のみ。

Router5

interface Ethernet0/0
 ip address 192.168.0.11 255.255.255.0

router eigrp 10
 network 192.168.0.0

こちらもIPアドレス設定とEIGRP設定のみ。

PC1

自明のため省略。

検証

HSRPの優先度が同じのため、大きなIPアドレスを持つ順番に優先度は高くなる。

  1. 172.168.1.3: Router3
  2. 172.168.1.2: Router2
  3. 172.168.1.1: Router1

これが基本。

起動時

各ルーターの状況は下記となる。

Router1

#show standby
Ethernet0/0 - Group 1
  State is Listen
  Virtual IP address is 172.16.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
  Preemption disabled
  Active router is 172.16.1.3, priority 100 (expires in 8.976 sec)
  Standby router is 172.16.1.2, priority 100 (expires in 9.392 sec)
  Priority 100 (default 100)
  Group name is "hsrp-Et0/0-1" (default)

Router2

#show standby
Ethernet0/0 - Group 1
  State is Standby
    1 state change, last state change 00:38:31
  Virtual IP address is 172.16.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 0.144 secs
  Preemption disabled
  Active router is 172.16.1.3, priority 100 (expires in 8.640 sec)
  Standby router is local
  Priority 100 (default 100)
  Group name is "hsrp-Et0/0-1" (default)

Router3

#show standby
Ethernet0/0 - Group 1
  State is Active
    2 state changes, last state change 00:39:05
  Virtual IP address is 172.16.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.440 secs
  Preemption disabled
  Active router is local
  Standby router is 172.16.1.2, priority 100 (expires in 8.800 sec)
  Priority 100 (default 100)
  Group name is "hsrp-Et0/0-1" (default)

優先度とおり

  • Router3(172.16.1.3): Active
  • Router2(172.16.1.2): Standby
  • Router1(172.16.1.1): Listen

この時、PC1からRouter5へのtracerouteの結果は下記となる。

PC1> trace 192.168.0.11
trace to 192.168.0.11, 8 hops max, press Ctrl+C to stop
 1   172.16.1.3   1.409 ms  0.648 ms  0.433 ms
 2   192.168.30.1   2.012 ms  0.889 ms  1.857 ms
 3   *192.168.0.11   1.718 ms (ICMP type:3, code:3, Destination port unreachable)

Router3とRouter4とを結ぶ経路(ネットワーク:192.168.30.0/24)が見える。Router3のARPテーブルには、PC1のデータが見える(下記)。

#show arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  172.16.1.1              1   aabb.cc00.0100  ARPA   Ethernet0/0
Internet  172.16.1.2              1   aabb.cc00.0200  ARPA   Ethernet0/0
Internet  172.16.1.3              -   aabb.cc00.0300  ARPA   Ethernet0/0
Internet  172.16.1.11             1   0050.7966.6800  ARPA   Ethernet0/0
Internet  172.16.1.254            -   0000.0c07.ac01  ARPA   Ethernet0/0
Internet  192.168.30.1           44   aabb.cc00.0430  ARPA   Ethernet0/3
Internet  192.168.30.2            -   aabb.cc00.0330  ARPA   Ethernet0/3

HSRPのMacアドレス”0000.0c07.ac01”が見える。WiresharkのARPデータでも確認できる。
ARPのコピー.png

Router1の”Shutdown”および”No Shutdown”

ここから、Router1の”Shutdown”を実行。Router1の状況。

#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Init    unknown         unknown         172.16.1.254

単にStateが”Init”になるのみ。最も優先度が低く、”Standby”でもないため、他Routerへの影響もなし。次にもとに戻す(”No Shutdown”)。なお、EIGRPのログは省略している(以降、同様)。

Router2の”Shutdown”および”No Shutdown”

続いて、Router2の”Shutdown”を実行。

Router2の状況

(config)#interface ethernet 0/0
(config-if)#shut
*Nov 11 06:57:59.638: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Init
*Nov 11 06:58:01.641: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Nov 11 06:58:02.645: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down
(config-if)#do show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Init    unknown         unknown         172.16.1.254

”Init”に移行する。

Router1の状況

*Nov 11 06:58:18.590: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby
#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Standby 172.16.1.3      local           172.16.1.254

”Standby”に移行していることがわかる。

Router3の状況

#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Active  local           172.16.1.1      172.16.1.254

”Standby”が”172.16.1.1(Router1)”に変更されているのがわかる。

Router2にて元に戻す(”No Shutdown”)

(config-if)#no shut
*Nov 11 07:01:19.963: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Nov 11 07:01:20.970: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
(config-if)#
*Nov 11 07:01:30.745: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby
(config-if)#do show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Standby 172.16.1.3      local           172.16.1.254

”Standby”に復帰していることがわかる。

Router1の状況

*Nov 11 07:01:19.912: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Listen
#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Listen  172.16.1.3      172.16.1.2      172.16.1.254

”Listen”に移行している(優先度が最も低いため)。

Router3の状況

#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Active  local           172.16.1.2      172.16.1.254

”Standby”が”172.16.1.2(Router2)”に戻っている。

Router3の”Shutdown”および”No Shutdown”

続いて、Router3の”Shutdown”を実行。

Router3の状況

(config)#interface ethernet 0/0
(config-if)#shut
*Nov 11 07:04:33.860: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Active -> Init
(config-if)#
*Nov 11 07:04:35.861: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Nov 11 07:04:36.868: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down
(config-if)#do show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Init    unknown         unknown         172.16.1.254

”Init”に移行している。

Router2の状況

*Nov 11 07:04:33.856: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Active
#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Active  local           172.16.1.1      172.16.1.254

”Active”に昇格し、”172.16.1.1(Router1)”が”Active”になっていることが見える。

Router1の状況

*Nov 11 07:04:43.911: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby
#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Standby 172.16.1.2      local           172.16.1.254

”Standby”に移行している。

Router3にてもとに戻す(”No Shutdown”)。

(config-if)#no shut
*Nov 11 07:06:40.187: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Nov 11 07:06:41.194: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
(config-if)#do show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Speak   172.16.1.2      172.16.1.1      172.16.1.254
*Nov 11 07:06:52.104: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Speak -> Standby
(config-if)#do show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Standby 172.16.1.2      local           172.16.1.254

”Speak”、”Standby”と移行していることがわかる。ただし、”Active”までには移行しない。IPアドレスは最も大きいとは言っても、”Active”のルーターが他のStateに移行しない限り、そこまで移行できない。

Router2の状況

#show standby brief
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Active  local           172.16.1.3      172.16.1.254

みずからは”Active”のまま、Standbyが”172.16.1.3(Router3)”であることが見える。

Router1の状況

*Nov 11 07:06:40.325: %HSRP-5-STATECHANGE: Ethernet0/0 Grp 1 state Standby -> Listen
#show standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State   Active          Standby         Virtual IP
Et0/0       1    100   Listen  172.16.1.2      172.16.1.3      172.16.1.254

”Listen”に移行していることがわかる。

この時、PC1からRouter5へのtracerouteの結果は下記となる。

PC1> trace 192.168.0.11
trace to 192.168.0.11, 8 hops max, press Ctrl+C to stop
 1   172.16.1.2   0.858 ms  1.177 ms  0.553 ms
 2   192.168.20.1   1.448 ms  0.618 ms  0.570 ms
 3   *192.168.0.11   1.058 ms (ICMP type:3, code:3, Destination port unreachable)

Router2とRouter4とを結ぶ経路(ネットワーク:192.168.20.0/24)が見える。

期待どおりの動作となった。

EOF

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0