| ライター翻訳版 - October 30, 2006 |
| 機械翻訳版 - October 30, 2006 |
| 英語版 - October 30, 2006 |
| Document ID: 27082 |
目次
概要前提条件
要件
使用するコンポーネント
背景理論
表記法
問題
ソリューション
NetPro ディスカッション フォーラム:特集対話
関連情報
概要
このドキュメントでは、スタティック ルートに関する基本概念を紹介しています。このドキュメントでは、スタティック ルートを設定する際に、ネクスト ホップ IP アドレスに到達可能なインターフェイスを指定することが必要になる状況を、ある問題のシナリオを使って紹介しています。
前提条件
要件
このドキュメントに関する特別な要件はありません。
使用するコンポーネント
このドキュメントは、特定のソフトウェアやハードウェアのバージョンに限定されるものではありません。
背景理論
Cisco IOS(R) ソフトウェア リリース 10.0 では、スタティック ルートの設定ができるようになっています。スタティック ルートはさまざまな理由により使用されますが、宛先へのダイナミック ルートがない場合や、ダイナミック ルーティング プロトコルの適用が困難な場合に、特によく使用されます。
デフォルトでは、スタティック ルートのアドミニストレーティブ ディスタンスは 1 となっているので、ダイナミック ルーティング プロトコルによるルートよりも優先されます。アドミニストレーティブ ディスタンスを、ダイナミック ルーティング プロトコルのアドミニストレーティブ ディスタンスよりも大きな値に増加させることにより、スタティック ルートは、ダイナミック ルーティングが失敗した場合の安全ネットとなることができます。たとえば、Interior Gateway Routing Protocol(IGRP)に由来するルートでは、デフォルトのアドミニストレーティブ ディスタンスは 100 となっています。IGRP ルートの方が優先するようなスタティック ルートを設定するのであれば、そのスタティック ルートのアドミニストレーティブ ディスタンスを 100 よりも大きな値に指定します。
この種のスタティック ルートは「フローティング」スタティックと呼ばれます。このルートは優先ルートが消失した場合にだけルーティング テーブルにインストールされます。たとえば、ip route 172.31.10.0 255.255.255.0 10.10.10.2 101 のようになります。
注:アドミニストレーティブ ディスタンスの 255 は到達不能として扱われ、アドミニストレーティブ ディスタンスが 255 のスタティック ルートはルーティング テーブルに入れられることはありません。
スタティック ルートでブロードキャスト インターフェイスを指した場合、そのルートはブロードキャスト インターフェイスが起動したときのみ、ルーティング テーブルに挿入されます。スタティック ルートのネクスト ホップが、あるインターフェイスを指していると、ルータはそのルートの範囲内の全てのホストがそのインターフェイスを介して直接に接続されていると見なすので、この設定は推奨されません。たとえば、ip route 0.0.0.0 0.0.0.0 Ethernet0 がこれに該当します。
このタイプの設定では、ルータは、すべての宛先が Ethernet 0 に直接接続されていると見なすため、ルータがデフォルト ルートを介して発見するすべての宛先に対して、イーサネット上で Address Resolution Protocol(ARP)を実行することになります。
特に、このタイプのデフォルトルートが多数の別々の宛先サブネットへの大量のパケットに使われた場合には、プロセッサの高使用率と非常に大きな ARP キャッシュ(アテンダント メモリ割り当ての失敗を伴う)を発生させる可能性があります。
直接接続されたインターフェイスで絶対値ネクスト ホップを指定すると、ルータがそれぞれの宛先アドレスで ARP を実行するのを防止します。しかし、ネクスト ホップを伴うインターフェイスがダウンし、絶対値ネクスト ホップが再帰ルートを介して到達可能である場合には、ネクスト ホップ IP アドレスと共に、そのネクスト ホップが見つかるインターフェイスも指定する必要があります。たとえば、ip route 0.0.0.0 0.0.0.0 Serial 3/3 192.168.20.1 がこれに該当します。
表記法
ドキュメント表記の詳細は、『シスコ テクニカル ティップスの表記法』を参照してください。
問題
次のネットワーク ダイアグラムでは、同一の宛先(172.31.10.0/24)に対して 2 つのスタティック ルートが存在します。一方のルートはフローティング スタティックで、LAN 上の宛先ネットワークへの「バックアップ」あるいは冗長パスです。このシナリオでの問題は、プライマリ リンクがシャットダウンされた場合に、フローティング スタティック ルートがルーティング テーブルにインストールされない点です。
R1 には、インターネット アクセスのための Internet Service Provider(ISP)ルータを指すデフォルト ルートがあります。R1 には R2 への 2 つのリンクがあります。T1 はプライマリ リンクで、56 K はバックアップ リンクです。R1 には、ネクスト ホップとして R2 の Serial 0 IP アドレス(10.10.10.2)を指す 172.31.10.0/24 へのスタティック ルートがあります。R1 には、さらに R2 の Serial 1 IP アドレス(192.168.20.2)を指す 172.131.10.0/24 へのフローティング スタティック ルートがあり、このフローティング スタティック ルートへのアドミニストレーティブ ディスタンスは 250 です。つまり、プライマリ リンクに障害が発生した場合のみ、56 K の回線をパケットが双方向で流れることになります。

この例は、R1 の設定を示しています。
| R1 |
|---|
hostname R1 ! ip subnet-zero no ip domain-lookup ! controller E1 2/0 ! controller E1 2/1 ! interface Serial3/0 description ISP Link ip address 192.168.10.1 255.255.255.252 clockrate 64000 ! interface Serial3/1 no ip address shutdown ! interface Serial3/2 description Primary Link to R2 ip address 10.10.10.1 255.255.255.252 ! interface Serial3/3 description Backup Link to R2 ip address 192.168.20.1 255.255.255.252 clockrate 64000 ! ip classless ip route 0.0.0.0 0.0.0.0 Serial3/0 !--- これは ISP ルータへのデフォルト ルートです。 ip route 172.31.10.0 255.255.255.0 10.10.10.2 !--- これは LAN への優先ルートです。 ip route 172.31.10.0 255.255.255.0 192.168.20.2 250 !--- これは LAN へのフローティング ルートです。 |
この例は、R1 のルーティング テーブルを示しています。
| R1 ルーティング テーブル |
|---|
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
10.0.0.0/30 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Serial3/2
192.168.10.0/30 is subnetted, 1 subnets
C 192.168.10.0 is directly connected, Serial3/0
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, Serial3/3
172.31.0.0/24 is subnetted, 1 subnets
S 172.31.10.0 [1/0] via 10.10.10.2
!--- T1 を介した LAN への優先スタティック ルート。
S* 0.0.0.0/0 is directly connected, Serial3/0
!--- インターネットへのスタティック デフォルト ルート。
|
この例では、R2 の設定を示します。
| R2 |
|---|
hostname R2 ! enable password ww ! ! ! ! ! ip subnet-zero no ip finger no ip domain-lookup ! ! ! interface Ethernet0 description Local LAN ip address 172.31.10.2 255.255.255.0 ! interface Serial0 description Primary Link to R1 ip address 10.10.10.2 255.255.255.252 clockrate 56000 ! interface Serial1 description Backup Link to R1 ip address 192.168.20.2 255.255.255.252 ! interface TokenRing0 no ip address shutdown ! ip classless ip route 0.0.0.0 0.0.0.0 10.10.10.1 !--- これはプライマリ デフォルト ルートです。 ip route 0.0.0.0 0.0.0.0 192.168.20.1 250 !--- T1 が失敗した場合に使われるフローティング デフォルト ルート。 no ip http server ! ! line con 0 exec-timeout 0 0 transport input none line aux 0 line vty 0 4 password ww login ! end |
R2 には 10.10.10.1 を介したデフォルト ルートがインストールされており、R2 から ISP ルータに traceroute コマンドを発行すると、パケットは T1 リンクを使用します。R2 は 172.31.10.2 を送信元として、インターネット ホスト 192.168.30.1 に ping を送信できます。192.168.30.1 へのルートは、デフォルト ルート 0.0.0.0 0.0.0.0 を介しています。
| R2 ルーティング テーブル |
|---|
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 10.10.10.1 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
C 172.31.10.0 is directly connected, Ethernet0
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, Serial1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/30 is directly connected, Serial0
S* 0.0.0.0/0 [1/0] via 10.10.10.1
!--- これはプライマリ デフォルト ルートです。
R2#traceroute 192.168.10.2
Type escape sequence to abort.
Tracing the route to 192.168.10.2
1 10.10.10.1 16 msec 20 msec 16 msec
2 192.168.10.2 32 msec * 32 msec
R2#ping
Protocol [ip]:
Target IP address: 192.168.30.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.31.10.2
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms
|
R1 で Serial 3/2 をシャットダウンしてフェールオーバーをテストすると、R1 にローカルの LAN 172.31.10.0 へのフローティング スタティック ルートがインストールされ、R2 に 192.168.20.1 経由 0.0.0.0 へのフローティング スタティック ルートがインストールされるはずです。そうすると、56K リンクにトラフィックが流れます。
| R1 |
|---|
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial3/0 192.168.10.1 YES manual up up
Serial3/1 unassigned YES unset administratively down down
Serial3/2 10.10.10.1 YES manual up up
Serial3/3 192.168.20.1 YES manual up up
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s3/2
R1(config-if)#shut
R1(config-if)#end
2d21h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/2, changed state to down
2d21h: %LINK-5-CHANGED: Interface Serial3/2, changed state to administratively down
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial3/0 192.168.10.1 YES manual up& up
Serial3/1 unassigned YES unset administratively down down
Serial3/2 10.10.10.1 YES manual administratively down down
Serial3/3 192.168.20.1 YES manual up up
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
192.168.10.0/30 is subnetted, 1 subnets
C 192.168.10.0 is directly connected, Serial3/0
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, Serial3/3
172.31.0.0/24 is subnetted, 1 subnets
S 172.31.10.0 [1/0] via 10.10.10.2
!--- T1 を介したスタティック ルートはルーティング テーブルに残ります。
!--- これは Serial 3/2 のシャットダウン時に予想されるものではありません。
S* 0.0.0.0/0 is directly connected, Serial3/0
!--- インターネットへのスタティック デフォルト ルート。
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 192.168.20.1 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
C 172.31.10.0 is directly connected, Ethernet0
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, Serial1
S* 0.0.0.0/0 [250/0] via 192.168.20.1
!--- R2 上の LAN を送信元とする ping は、インターネット ホスト 192.168.20.1
!--- に送信できなくなります。
!--- なぜならば、R1 は、Serial 3/2 経由での応答を試みますが、
!--- これがダウンしているからです。
R2#ping
Protocol [ip]:
Target IP address: 192.168.30.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.31.10.2
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
|
フローティング スタティック ルートは R1 にインストールされておらず、Serial 3/2 リンクがシャットダウンされていても、まだプライマリ スタティック ルートは R1 のルーティング テーブルにあります。これが発生するのは、もともとスタティック ルートが再帰的であることに起因します。ネクスト ホップへのルートが存在するかぎり、スタティック ルートはルーティング テーブルに残ります。この場合、192.168.10.2 は 0.0.0.0 0.0.0.0 へのネクスト ホップなので、R1 では 192.168.10.2 経由で 10.10.10.2 に到達できるものと見なします。
ネクスト ホップへのルートは、より限定的、より非限定的、あるいは、デフォルト ルートであることもあります。この問題シナリオでは、リンクがダウンしているので 10.10.10.2 へのルートがないと思われるかもしれませんが、R1 のルーティング テーブルを見れば、ISP ルータを指すスタティック デフォルト ルートがあります。そのため、R1 ではこのデフォルト ルートを介して 172.31.10.0/24 へのネクスト ホップ(10.10.10.2)に到達できるものと考えます。これにより、10.10.10.2 経由 172.31.10.0/24 へのスタティック ルートはルーティング テーブルに残り、フローティング スタティック ルートはインストールされません。
この問題を回避できるようなスタティック ルートを設定するもっとよい方法があります。ネクスト ホップが見つかるようなインターフェイスを指定すると、ネクスト ホップの IP アドレスに指定のインターフェイスを介して到達可能な場合のみ、フローティング スタティック ルートをインストールすることになります。この問題のソリューションが提示されるまでは、R1 の Serial 3/2 インターフェイスを再度バックアップとすることになります。
| R1 |
|---|
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s 3/2
R1(config-if)#no shut
R1(config-if)#end
R1#
2d22h: %LINK-3-UPDOWN: Interface Serial3/2, changed state to up
2d22h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/2, changed state to up
2d22h: %SYS-5-CONFIG_I: Configured from console by console
R1#show ip int brief
Interface IP-Address OK? Method Status Protocol
Serial3/0& 192.168.10.1 YES manual up up
Serial3/1 unassigned YES unset administratively down down
Serial3/2 10.10.10.1 YES manual up up
Serial3/3 192.168.20.1 YES manual up up
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
10.0.0.0/30 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Serial3/2
192.168.10.0/30 is subnetted, 1 subnets
C 192.168.10.0 is directly connected, Serial3/0
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, Serial3/3
172.31.0.0/24 is subnetted, 1 subnets
S 172.31.10.0 [1/0] via 10.10.10.2
S* 0.0.0.0/0 is directly connected, Serial3/0
R1#
|
ソリューション
このソリューションは LAN(172.31.10.0)への古いスタティック ルートを削除し、新規のスタティック ルートを設定するもので、そこでは、ネクスト ホップに到達するようなインターフェイスを指定します。これにより、R1 上のフローティング スタティック ルートは、Serial 3/2 インターフェイスがシャットダウンした場合にインストールされます。
| R1 |
|---|
R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#no ip route 172.31.10.0 255.255.255.0 10.10.10.2 R1(config)#no ip route 172.31.10.0 255.255.255.0 192.168.20.2 250 R1(config)#ip route 172.31.10.0 255.255.255.0 Serial3/2 10.10.10.2 R1(config)#ip route 172.31.10.0 255.255.255.0 Serial3/3 192.168.20.2 250 R1(config)#end R1# 2d22h: %SYS-5-CONFIG_I: Configured from console by console |
Serial 3/2 を介して 10.10.10.2 が見える場合には、10.10.10.2 経由 172.31.10.0 へのスタティック ルートが R1 のルーティング テーブルにインストールされます。そうでない場合は、10.10.10.2 経由のスタティック ルートはルーティング テーブルから削除され、ネクスト ホップが 192.168.20.2 である Serial 3/3 経由での 172.31.10.0 へのフローティング スタティック ルートがインストールされます。
この動作のしくみのテストを行い T1 リンクをダウンさせるには、Serial 3/2 をシャットダウンして、ルーティング テーブルにフローティング スタティック ルートがインストールされているかを調べます。
| R1 |
|---|
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s 3/2
R1(config-if)#shut
R1(config-if)#end
R1#
3d00h: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/2, changed state to down
3d00h: %SYS-5-CONFIG_I: Configured from console by console
3d00h: %LINK-5-CHANGED: Interface Serial3/2, changed state to administratively down
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial3/0 192.168.10.1 YES manual up up
Serial3/1 unassigned YES unset administratively down down
Serial3/2 10.10.10.1 YES manual administratively down down
Serial3/3 192.168.20.1 YES manual up up
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
192.168.10.0/30 is subnetted, 1 subnets
C 192.168.10.0 is directly connected, Serial3/0
192.168.20.0/30 is subnetted, 1 subnets
C 192.168.20.0 is directly connected, Serial3/3
172.31.0.0/24 is subnetted, 1 subnets
S 172.31.10.0 [250/0] via 192.168.20.2, Serial3/3
S* 0.0.0.0/0 is directly connected, Serial3/0
R1#
|
ここで R1 は LAN を送信元とするパケットを伴って、インターネット ホスト 192.168.20.1 に ping できます。
| R2 |
|---|
R2#ping Protocol [ip]: Target IP address: 192.168.20.1 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 172.31.10.2 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms |
フローティング スタティック ルートが予想どおりにインストールされます。
NetPro ディスカッション フォーラム:特集対話
Networking Professionals Connection はネットワーキング プロフェッショナルが、ネットワーキングに関するソリューション、製品、およびテクノロジーについての質問、提案、情報を共有するためのフォーラムです。特集リンクでは、このテクノロジー分野での最新の対話を取り上げています。| NetPro ディスカッション フォーラム:RP に関する特集対話 |
|---|
| サービス プロバイダー:MPLS |
| バーチャル プライベート ネットワーク:サービス |
| バーチャル プライベート ネットワーク:セキュリティ |
