ポイントツーポイントGREトンネルの注意点

ポイントツーポイントGREトンネルを設定するときに以下の注意が必要です。

GREトンネルの注意点

tunnel destinationのIPアドレスに一致するルート情報をGREトンネル経由で学習しないようにする

このことをきちんと考えずに設定すると、GREトンネルのインタフェースはフラッピングしてしまいます。フラッピングとは、インタフェースがup/downを繰り返す不安定な状態になることです。

GREトンネルがフラッピングしてしまう仕組み

GREトンネルインタフェースがupする条件は、デフォルトではtunnel destinationに到達可能であることです。ルーティングテーブルにtunnel destinationのIPアドレスに一致するルート情報があれば、GREトンネルインタフェースはupします。

ところが、tunnel destinationに到達するためのルート情報をGREトンネル経由で学習して最適ルートになってしまうと問題が起こります。tunnel destinationのIPアドレスを解決しようとするとループしてしまいます。

すると、GREトンネルインタフェースはdownします。GREトンネルがダウンすると、tunnel destinationのIPアドレスに一致するルート情報を再び通常のインタフェースで学習してGREトンネルがupします。GREトンネルがupすると、tunnel destinationに一致するルート情報をGREトンネル経由で学習します。GREトンネル経由のルート情報が最適ルートになると、また、tunnel destinationのIPアドレスを解決しようとするとループしてGREトンネルはdownします。GREトンネルがupしてはしばらくするとdownします。そして、またupしてdownする・・・これを延々と繰り返すことになります。

図 tunnel destinationのIPアドレスを解決できない
図 tunnel destinationのIPアドレスを解決できない

GREトンネルがフラッピングしてしまうと、コンソールには以下のようなエラーメッセージが定期的に表示されるようになります。

GREトンネルフラッピング

R21#
*Aug 29 01:51:09.218: %TUN-5-RECURDOWN: Tunnel0 temporarily disabled due to recursive routing
*Aug 29 01:51:09.218: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to down
*Aug 29 01:51:09.218: %DUAL-5-NBRCHANGE: EIGRP-IPv4 1: Neighbor 172.16.0.11 (Tunnel0) is down: interface down
R21#
*Aug 29 01:52:09.257: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
*Aug 29 01:52:10.212: %DUAL-5-NBRCHANGE: EIGRP-IPv4 1: Neighbor 172.16.0.11 (Tunnel0) is up: new adjacency
R21#
*Aug 29 01:52:10.535: %ADJ-5-PARENT: Midchain parent maintenance for IP midchain out of Tunnel0 - looped chain attempting to stack
R21#

フラッピングしないようにするための設定

冒頭で触れたようにGREトンネルを設定するときには、「tunnel destinationのIPアドレスに一致するルート情報をGREトンネル経由で学習しないようにする」ことに注意してください。そのためには、主に以下の設定があります。

  1. ルートフィルタ
  2. アドミニストレイティブディスタンス/メトリックの調整
  3. VRFの利用(FVRF)

ルートフィルタ

GREトンネル経由でtunnel destinationのIPアドレスに一致するルート情報をアドバタイズしないようにルートフィルタを行います。このあとの例は、ルートフィルタを利用しています。

アドミニストレイティブディスタンス/メトリックの調整

tunnel destinationのIPアドレスに一致するルート情報をトンネル経由で学習しても、それがベストパスにならなければ大丈夫です。メトリックまたはアドミニストレイティブディスタンスを調整してください。OSPFやEIGRPを利用していると、自動的にメトリックの調整をしていることになります。トンネルの帯域幅は非常に小さくなっているからです。OSPFやEIGRPではGREトンネル経由でtunnel destinationのIPアドレスを学習してもメトリックが大きくなり最適ルートになることはまずありません。

VRFの利用(FVRF)

GREトンネルインタフェースと実際にパケットを転送するインタフェースをVRFによって論理的に分割することで、フラッピングを防止します。

GREトンネルがフラッピングする例

ネットワーク構成

以下のR1~R3で構成するシンプルなネットワークで具体的にGREトンネルがフラッピングする様子を解説します。

図 GREトンネル フラッピングの例
図 GREトンネル フラッピングの例

初期設定

R1~R3でRIPv2を利用してルーティングを行っています。各ルータの初期設定の抜粋は以下の通りとします。

R1

interface Loopback0
 ip address 192.168.0.1 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.12.1 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.1.1 255.255.255.0
!
router rip 
 version 2
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.12.0
 no auto-summary

R2

interface Loopback0
 ip address 192.168.0.2 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.12.2 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.23.2 255.255.255.0
!
router rip 
 version 2
 network 192.168.0.0
 network 192.168.23.0
 network 192.168.12.0
 no auto-summary

R3

interface Loopback0
 ip address 192.168.0.3 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.23.3 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.3.3 255.255.255.0
!
router rip 
 version 2
 network 192.168.0.0
 network 192.168.3.0
 network 192.168.23.0
 no auto-summary

GREトンネルの設定でフラッピング発生

R1-R3間でGREトンネルインタフェースTunnel13を設定して、R1-R3間がポイントツーポイント接続されるようにします。GREトンネルのtunnel source/tunnel destinationとしてそれぞれのLoopback0のIPアドレスを利用します。Tunnel13のIPアドレスはip unnumberedでLoopback0のIPアドレスを使い回すようにします。

R1Tunnel13tunnel destination 192.168.0.3
tunnel source 192.168.0.1
R3Tunnel13tunnel destination 192.168.0.1
tunnel source 192.168.0.3

R1 GREトンネルの設定

interface tunnel13
 tunnel source 192.168.0.1
 tunnel destination 192.168.0.3
 ip unnumbered loopback0

R3 GREトンネルの設定

interface tunnel13
 tunnel source 192.168.0.3
 tunnel destination 192.168.0.1
 ip unnumbered loopback0

ip unnumberedによってTunnel13のIPアドレスLoopback0のIPアドレスを使いまわしているので、Tunnel13でも自動的にRIPv2が有効になります。そして、Tunnel13経由でRIPルートをアドバタイズします。Tunnel13でR1-R3間が直接接続されていることになるので、Tunnel13経由のRIPルートのメトリックは1となります。そのため、tunnel destinationのIPアドレスの最適ルートとしてTunnel13のルートが選ばれてしまいます。すると、tunnel destinationのIPアドレスを解決できずにTunnel13はdownします。

R3のtunnel destinationである192.168.0.1/32のルート情報のアドバタイズに注目すると、以下の図のようになります。

図  tunnel destinationのルートをTunnel経由で学習(R3)
図 tunnel destinationのルートをTunnel経由で学習(R3)

GREトンネルのインタフェースがフラッピングしていると、コンソール上には次のようなログも表示されます。

 
*Mar  1 00:15:54.579: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel13, changed state to up
R3#
*Mar  1 00:16:03.579: %TUN-5-RECURDOWN: Tunnel13 temporarily disabled due to recursive routing
*Mar  1 00:16:04.579: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel13, changed state to down

両方のTunnel13インタフェースがフラッピングするわけではありません。片方だけです。どちらのTunne113インタフェースがフラッピングするかは、設定する順番によって変わります。

ルートフィルタでGREトンネルがフラッピングしないようにする

GREトンネルがフラッピングしないように、tunnel destinationのIPアドレスに関するRIPルートをフィルタします。R1はR3でのtunnel destinationになる192.168.0.1/32をTu13からアドバタイズしないようにディストリビュートリストでフィルタします。R3でも同様です。R3はR1でのtunnel destinationになる192.168.0.3/32をTu13からアドバタイズしないようにディストリビュートリストでフィルタします。

R1 R3のtunnel destinationになるルートをフィルタ

access-list 1 deny 192.168.0.1
access-list 1 permit any
!
router rip
 distribute-list 1 out tunnel13

R3 R1のtunnel destinationのルートをフィルタ

access-list 1 deny 192.168.0.3
access-list 1 permit any
!
router rip
 distribute-list 1 out tunnel13

図 フラッピングしないようにルートフィルタを行う
図 フラッピングしないようにルートフィルタを行う

最終的な設定の抜粋とルーティングテーブル

R1とR3のGREトンネルおよびフラッピングしないようにするためのルートフィルタの設定の抜粋は以下の通りです。

R1

interface Tunnel13
 ip unnumbered Loopback0
 tunnel source 192.168.0.1
 tunnel destination 192.168.0.3
!
router rip
 distribute-list 1 out Tunnel13
!
access-list 1 deny   192.168.0.1
access-list 1 permit any

R3

interface Tunnel13
 ip unnumbered Loopback0
 tunnel source 192.168.0.3
 tunnel destination 192.168.0.1
!
router rip
 distribute-list 1 out Tunnel13
!
access-list 1 deny   192.168.0.3
access-list 1 permit any

また、R1とR3のルーティングテーブルは以下のようになります。

R1

R1#show ip route
~省略~

Gateway of last resort is not set

C    192.168.12.0/24 is directly connected, Ethernet0/0
R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:12, Ethernet0/0
                     [120/1] via 192.168.0.3, 00:00:12, Tunnel13
     192.168.0.0/32 is subnetted, 3 subnets
C       192.168.0.1 is directly connected, Loopback0
R       192.168.0.2 [120/1] via 192.168.12.2, 00:00:12, Ethernet0/0
R       192.168.0.3 [120/2] via 192.168.12.2, 00:00:12, Ethernet0/0
C    192.168.1.0/24 is directly connected, Ethernet0/1
R    192.168.3.0/24 [120/1] via 192.168.0.3, 00:00:14, Tunnel13

R3

R3#show ip route
~省略~

Gateway of last resort is not set

R    192.168.12.0/24 [120/1] via 192.168.23.2, 00:00:06, Ethernet0/0
                     [120/1] via 192.168.0.1, 00:00:09, Tunnel13
C    192.168.23.0/24 is directly connected, Ethernet0/0
     192.168.0.0/32 is subnetted, 3 subnets
R       192.168.0.1 [120/2] via 192.168.23.2, 00:00:06, Ethernet0/0
R       192.168.0.2 [120/1] via 192.168.23.2, 00:00:06, Ethernet0/0
C       192.168.0.3 is directly connected, Loopback0
R    192.168.1.0/24 [120/1] via 192.168.0.1, 00:00:09, Tunnel13
C    192.168.3.0/24 is directly connected, Ethernet0/1

IPルーティング応用