
conf t
!
hostname RT1
!
interface Loopback0
ip address 192.0.2.1 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
no shutdown
!
interface Ethernet0/1
ip address 10.1.2.1 255.255.255.0
no shutdown
!
ip route 0.0.0.0 0.0.0.0 Ethernet0/1 10.1.2.2
!
logging console
!
end
conf t
!
hostname RT2
!
interface Loopback0
ip address 192.0.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.2 255.255.255.0
no shutdown
!
interface Ethernet0/1
ip address 10.1.2.2 255.255.255.0
no shutdown
!
interface Ethernet
ip route 0.0.0.0 0.0.0.0 Ethernet0/1 10.1.2.1
!
logging console
!
end
ネットワーク機器が Routing table を参照して転送先を決定する際、宛先 IP address を含む経路情報が複数存在する場合があります。
その際、宛先 IP address と最も一致する経路情報が転送に使用されます。
これを Longest match と呼びます。
今回の構成では RT1 と RT2 に Ethernet0/1 を出力インターフェースとした default route が事前に設定されており、通信経路が図の通りとなっています。
RT1#traceroute 192.0.2.2 source 192.0.2.1
Type escape sequence to abort.
Tracing the route to 192.0.2.2
VRF info: (vrf in name/id, vrf out name/id)
1 10.1.2.2 1 msec 1 msec *

今回は RT1 と RT2 に static route を追加することでお互いが Ethernet0/0 から通信が送信されるようにします。
RT1 と RT2 に以下のよう設定を追加します。
RT1(config)#ip route 192.0.2.2 255.255.255.255 Ethernet0/0 10.1.1.2
RT2(config)#ip route 192.0.2.1 255.255.255.255 Ethernet0/0 10.1.1.1
すると Routing table はそれぞれ以下となります。
RT1#show ip route
Codes: L - local, C - connected, S - static, 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, m - OMP
n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
H - NHRP, G - NHRP registered, g - NHRP registration summary
o - ODR, P - periodic downloaded static route, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
& - replicated local route overrides by connected
Gateway of last resort is 10.1.2.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.1.2.2, Ethernet0/1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Ethernet0/0
L 10.1.1.1/32 is directly connected, Ethernet0/0
C 10.1.2.0/24 is directly connected, Ethernet0/1
L 10.1.2.1/32 is directly connected, Ethernet0/1
192.0.2.0/32 is subnetted, 2 subnets
C 192.0.2.1 is directly connected, Loopback0
[[red:S 192.0.2.2 [1/0] via 10.1.1.2, Ethernet0/0]]
RT2#show ip route
Codes: L - local, C - connected, S - static, 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, m - OMP
n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
H - NHRP, G - NHRP registered, g - NHRP registration summary
o - ODR, P - periodic downloaded static route, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
& - replicated local route overrides by connected
Gateway of last resort is 10.1.2.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.1.2.1, Ethernet0/1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Ethernet0/0
L 10.1.1.2/32 is directly connected, Ethernet0/0
C 10.1.2.0/24 is directly connected, Ethernet0/1
L 10.1.2.2/32 is directly connected, Ethernet0/1
192.0.2.0/32 is subnetted, 2 subnets
[[red:S 192.0.2.1 [1/0] via 10.1.1.1, Ethernet0/0]]
C 192.0.2.2 is directly connected, Loopback0
例えば RT1 は 192.0.2.2 に通信するにあたり、以下の2つの経路がこの宛先 IP address を含みます。
そして2つの経路を比べた際、最も一致する経路は default route ではなく新規追加した経路情報となります。
S* 0.0.0.0/0 [1/0] via 10.1.2.2, Ethernet0/1
S 192.0.2.2 [1/0] via 10.1.1.2, Ethernet0/0
そして、trace route を実行すると以下のように追加した経路情報により通信されていることがわかります。
RT1#traceroute 192.0.2.2 source 192.0.2.1
Type escape sequence to abort.
Tracing the route to 192.0.2.2
VRF info: (vrf in name/id, vrf out name/id)
1 10.1.1.2 0 msec 1 msec *

Routing table を参照してネットワーク機器がどのように転送先を決定するかというプロセスを理解するのは非常に重要です。
実環境でも Longest match を活用し、メイン経路と別に障害時用のサブ経路を用意するといった実装があります。(本問題だと、RT1 と RT2 の Ethernet0/0 が down したとしても、Ethernet0/1 を通るdefault route があるおかげで障害時も通信が継続できます。)
ログインすると、進捗を保存できます。
← 3.3 IPv4 及び IPv6 Static route の設定 に戻る