概要

HSRPの基本的な設定とルーティングテーブルのトラッキングの設定ミスの切り分けと修正を行います。

ネットワーク構成

図 HSRP 設定ミスと切り分け Part1 ネットワーク構成
図 HSRP 設定ミスと切り分け Part1 ネットワーク構成

上記のネットワーク構成で、R1をHSRPアクティブルータとして、デフォルトゲートウェイの冗長化を行なっています。仮想IPアドレスとして、192.168.12.254を利用しています。また、ルーティングプロトコルにはOSPFを利用しています。

設定概要

現在のR1~R3のHSRPおよびルーティングプロトコルに関する設定は次の通りです。これらの設定には一部設定ミスがあります。

R1

track 1 ip route 192.168.3.0 255.255.255.0 metric threshold
 threshold metric up 2 down 3
!
track 12 ip route 192.168.3.0 255.255.255.0 metric threshold
 threshold metric up 20 down 21
!
interface Ethernet0/0
 ip address 192.168.12.1 255.255.255.0
 standby 12 ip 192.168.12.253
 standby 12 priority 120
 standby 12 preempt
 standby 12 track 1 decrement 30
!
interface Ethernet0/1
 ip address 192.168.13.1 255.255.255.0
!
interface Ethernet0/2
 ip address 192.168.21.1 255.255.255.0
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0

R2

interface Ethernet0/0
 ip address 192.168.12.2 255.255.255.0
 standby 12 ip 192.168.12.254
 standby 12 preempt
 standby 12 track 12 decrement 30
!
interface Ethernet0/1
 ip address 192.168.23.2 255.255.255.0
!
interface Ethernet0/2
 ip address 192.168.21.2 255.255.255.0
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0

R3

interface Ethernet0/0
 ip address 192.168.13.3 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.23.3 255.255.255.0
!
interface Ethernet0/2
 ip address 192.168.3.3 255.255.255.0
!
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0

トラブルの症状

R1がアクティブルータなので、ホストから192.168.3.0/24への通信はR1を経由するはずです。ですが、現在の設定では、ホストから192.168.3.0/24への通信がR2を経由しています。ホストのデフォルトゲートウェイは、正しくHSRPの仮想ルータのIPアドレス192.168.12.254を設定しています。ホストから192.168.3.0/24へTracerouteすると、次のようになります。

HOST

HOST#show ip route 
Default gateway is 192.168.12.254
 
Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty
HOST#traceroute 192.168.3.3
 
Type escape sequence to abort.
Tracing the route to 192.168.3.3
 
  1 192.168.12.2 32 msec 8 msec 8 msec
  2 192.168.23.3 8 msec *  28 msec

つまり、R1が意図したようにHSRPアクティブルータとなっていません。その原因を調べるためにR1、R2で以下のshowコマンドを実行しました。

  • show standby
  • show track

R1

R1#show standby
Ethernet0/0 - Group 12
  State is Standby
    13 state changes, last state change 00:10:46
  Virtual IP address is 192.168.12.253
  Active virtual MAC address is 0000.0c07.ac0c
    Local virtual MAC address is 0000.0c07.ac0c (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.800 secs
  Preemption enabled
  Active router is 192.168.12.2, priority 100 (expires in 7.776 sec)
  Standby router is local
  Priority 90 (configured 120)
    Track object 1 state Down decrement 30
  IP redundancy name is "hsrp-Et0/0-12" (default)
R1#show track
Track 1
  IP route 192.168.3.0 255.255.255.0 metric threshold
  Metric threshold is Down (OSPF/20/20)
    2 changes, last change 00:15:45
  Metric threshold down 3 up 2
  First-hop interface is Ethernet0/1
  Tracked by:
    HSRP Ethernet0/0 12
Track 12
  IP route 192.168.3.0 255.255.255.0 metric threshold
  Metric threshold is Up (OSPF/20/20)
    4 changes, last change 00:18:00
  Metric threshold down 21 up 20
  First-hop interface is Ethernet0/1

R2

R2#show standby
Ethernet0/0 - Group 12
  State is Active
    10 state changes, last state change 00:12:17
  Virtual IP address is 192.168.12.254
  Active virtual MAC address is 0000.0c07.ac0c
    Local virtual MAC address is 0000.0c07.ac0c (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.204 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.12.1, priority 90 (expires in 8.240 sec)
  Priority 100 (default 100)
    Track object 12 state Up decrement 30
  IP redundancy name is "hsrp-Et0/0-12" (default)
R2#show track
Track 12
  IP route 192.168.3.0 255.255.255.0 metric threshold
  Metric threshold is Up (OSPF/20/20)
    1 change, last change 00:00:18
  Metric threshold down 21 up 20
  First-hop interface is Ethernet0/1
  Tracked by:
    HSRP Ethernet0/0 12

問題

各ルータのshowコマンドの結果から、トラブルの原因となる設定ミスを判断して以下の問題に解答してください。

  • R1が意図したようにアクティブルータとなっていない原因は何ですか。
  • R1がアクティブルータとなるためにはどのように設定を修正すればよいですか。

解答

R1が意図したようにアクティブルータとなっていない原因は何ですか。

R1で仮想ルータのIPアドレスを192.168.13.253と設定しているが、正しい仮想ルータのIPアドレスは192.168.13.254である。また、トラックするオブジェクトの指定を間違えているため、プライオリティの値が設定した値より小さくなり、アクティブルータとして動作しない。

R1がアクティブルータとなるためにはどのように設定を修正すればよいですか。

R1

interface E0/0
 standby 12 ip 192.168.12.254
 no standby 12 track 1
 standby 12 track 12 decrement 30

ワンポイント

  • HSRPの設定は、HSRPグループ番号と仮想ルータのIPアドレスを他のルータと一致させなければいけない
  • 拡張オブジェクトトラッキングによって、ネットワーク構成の変化に応じてアクティブルータを切り替えられる

解説

今回の構成では、以下の2つのHSRPの設定ミスがあります。

  • 仮想ルータのIPアドレス
  • 拡張オブジェクトトラッキング

【仮想ルータのIPアドレス】

R1とR2でHSRPによって、デフォルトゲートウェイの冗長化を行なっています。仮想ルータのIPアドレスは192.168.13.254です。しかし、R1では仮想ルータのIPアドレスの設定を間違えてしまっています。R1のshow standbyコマンドからR1では仮想ルータのIPアドレスとして192.168.13.253を設定してしまっています。

R1

R1#show standby
Ethernet0/0 - Group 12
  State is Standby
    13 state changes, last state change 00:10:46
  Virtual IP address is 192.168.12.253
  Active virtual MAC address is 0000.0c07.ac0c
    Local virtual MAC address is 0000.0c07.ac0c (v1 default)
~省略~

HSRPの設定では、他のルータとグループ番号、仮想ルータのIPアドレスを一致させなければいけません。なお、R1のコンソールのログには、以下のようにR2との間で仮想IPアドレスが一致していない旨のメッセージが出力されます。

R1

*Mar  1 00:48:51.523: %HSRP-4-DIFFVIP1: Ethernet0/0 Grp 12 active routers virtual IP address 192.168.12.254 is different to the locally configured address 192.168.12.253

図 仮想ルータのIPアドレスの設定ミス
図 仮想ルータのIPアドレスの設定ミス

R1で、次のように仮想ルータのIPアドレスを正しい値に修正します。

R1

interface E0/0
 standby 12 ip 192.168.12.254

【拡張オブジェクトトラッキング】

R1で仮想ルータのIPアドレスを正しく修正しても、アクティブルータにはならずスタンバイルータになってしまいます。R1で仮想ルータのIPアドレスを修正したあとのshow standbyコマンドは、次のようになっています。

R1

R1#show standby 
Ethernet0/0 - Group 12
  State is Standby
    13 state changes, last state change 00:34:07
  Virtual IP address is 192.168.12.254
  Active virtual MAC address is 0000.0c07.ac0c
    Local virtual MAC address is 0000.0c07.ac0c (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.688 secs
  Preemption enabled
  Active router is 192.168.12.2, priority 100 (expires in 8.280 sec)
  Standby router is local
  Priority 90 (configured 120)
    Track object 1 state Down decrement 30
  IP redundancy name is "hsrp-Et0/0-12" (default)

R1のプライオリティ値は120として設定していますが、拡張オブジェクトトラッキングによって90に下げられてしまっています。R2のプライオリティ値はデフォルトの100です。そのため、R2がアクティブルータとなりR1はスタンバイルータとなっている状態です。R1でトラックしているオブジェクトをshow trackで確認すると、以下のような状態です。

R1

R1#show track 
Track 1
  IP route 192.168.3.0 255.255.255.0 metric threshold
  Metric threshold is Down (OSPF/20/20)
    2 changes, last change 00:45:32
  Metric threshold down 3 up 2
  First-hop interface is Ethernet0/1
  Tracked by:
    HSRP Ethernet0/0 12
Track 12
  IP route 192.168.3.0 255.255.255.0 metric threshold
  Metric threshold is Up (OSPF/20/20)
    4 changes, last change 00:47:47
  Metric threshold down 21 up 20
  First-hop interface is Ethernet0/1

トラックしているオブジェクトは、192.168.3.0/24のルートの状態を監視しています。ネットワークの障害などでメトリックの値が変化すると、オブジェクトがダウンします。オブジェクトが2つ設定されていますが、現在トラックしているオブジェクト1はメトリックのしきい値の設定が正しくないため、ダウンしています。R1から見ると、192.168.3.0/24へのルートのメトリックは正常時には20です。ところが、オブジェクト1がアップするしきい値はメトリック2になっています。

図 拡張オブジェクトトラッキングの設定ミス
図 拡張オブジェクトトラッキングの設定ミス

R1では、オブジェクト12をトラックするべきです。ネットワークが正常なとき、R1から見ると192.168.3.0/24のルートのメトリックは20です。オブジェクト12は192.168.3.0/24のルートのメトリックを監視しています。メトリックが20のときはアップで、それを上回るとオブジェクトがダウンします。たとえば、R1のE0/1に障害が発生すると192.168.3.0/24のルートのメトリックは30となり、オブジェクト12はダウンの状態になります。そして、HSRPプライオリティを小さくして、アクティブルータの切り替えが行われるようになります。R1では、以下のようにトラックするオブジェクトの修正を行います。

R1

interface E0/0
 no standby 12 track 1
 standby 12 track 12 decrement 30

設定を修正すると、R1でのshow standbyは次のようになります。

R1

R1#show standby 
Ethernet0/0 - Group 12
  State is Active
    14 state changes, last state change 00:00:41
  Virtual IP address is 192.168.12.254
  Active virtual MAC address is 0000.0c07.ac0c
    Local virtual MAC address is 0000.0c07.ac0c (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.756 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.12.2, priority 100 (expires in 8.776 sec)
  Priority 120 (configured 120)
    Track object 12 state Up decrement 30
  IP redundancy name is "hsrp-Et0/0-12" (default)

また、ホストから192.168.3.0/24へTracerouteを実行すると、R1を経由してルーティングされていることがわかります。

HOST

HOST#traceroute 192.168.3.3

Type escape sequence to abort.
Tracing the route to 192.168.3.3

  1 192.168.12.1 32 msec 8 msec 4 msec
  2 192.168.13.3 8 msec *  16 msec

IPルーティングのキホン