皆さんこんにちは。
今回はネットワークの実験としてルーティングループを意図的に発生させてみたいと思います。
L2ループについてはなんとなく仕組みとかは理解してるつもりなのですが、「L3のループってどうゆう風に起こるんだろう?」とふと疑問に思って調べていたら以下の記事で分かりやすく説明されていたので、記事で説明されてる内容を実際のNW機器で動作確認してみました。
参考 : 【図解】ルーティング・ループの確認方法,原因と対策,回避設計~null0インタフェースの活用~
環境:
* (RT1) : Cisco1812J
* (RT2) : Cisco Catalyst 3560
* (RT3) : Cisco Catalyst 3560
※手持ちがなかったのでL3をルータに見立てて動作させてます

設定
# RT1設定抜粋
### インターフェース
!
interface FastEthernet0
ip address 10.0.0.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1
ip address 172.16.10.1 255.255.255.0
duplex auto
speed auto
!
### staticルート
!
ip route 192.0.2.0 255.255.255.0 10.0.0.1
!
### ルーティングテーブル
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.10.0 is directly connected, FastEthernet1
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, FastEthernet0
S 192.0.2.0/24 [1/0] via 10.0.0.1
# RT2
### インターフェース
!
interface FastEthernet0/1
no switchport
ip address 10.0.0.1 255.255.255.0
!
interface FastEthernet0/2
no switchport
ip address 10.0.1.2 255.255.255.0
!
### staticルート
!
ip route 0.0.0.0 0.0.0.0 10.0.0.2
ip route 192.0.2.0 255.255.255.0 10.0.1.1
!
### ルーティングテーブル
Gateway of last resort is 10.0.0.2 to network 0.0.0.0
10.0.0.0/24 is subnetted, 2 subnets
C 10.0.0.0 is directly connected, FastEthernet0/1
C 10.0.1.0 is directly connected, FastEthernet0/2
S 192.0.2.0/24 [1/0] via 10.0.1.1
S* 0.0.0.0/0 [1/0] via 10.0.0.2
# RT3
### インターフェース
!
interface FastEthernet0/1
no switchport
ip address 10.0.1.1 255.255.255.0
!
interface FastEthernet0/2
no switchport
ip address 192.0.2.65 255.255.255.192
!
### staticルート
!
ip route 0.0.0.0 0.0.0.0 10.0.1.2
!
### ルーティングテーブル
Gateway of last resort is 10.0.1.2 to network 0.0.0.0
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.1.0 is directly connected, FastEthernet0/1
192.0.2.0/26 is subnetted, 1 subnets
C 192.0.2.64 is directly connected, FastEthernet0/2
S* 0.0.0.0/0 [1/0] via 10.0.1.2
実験
まず最初に「172.16.10.2」のPCから「192.0.2.65」のIPをアサインしているNWあてにPingを実行しました。
この通信は実際にRT3にConnectedになってるセグメントなのでちゃんと疎通があります。
hiro@hiro [07時03分45秒] [~]
-> % ping -c 5 192.0.2.65
PING 192.0.2.65 (192.0.2.65) 56(84) bytes of data.
64 bytes from 192.0.2.65: icmp_seq=1 ttl=253 time=2.18 ms
64 bytes from 192.0.2.65: icmp_seq=2 ttl=253 time=2.30 ms
64 bytes from 192.0.2.65: icmp_seq=3 ttl=253 time=1.47 ms
64 bytes from 192.0.2.65: icmp_seq=4 ttl=253 time=1.13 ms
64 bytes from 192.0.2.65: icmp_seq=5 ttl=253 time=2.07 ms
--- 192.0.2.65 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 1.136/1.833/2.300/0.451 ms
次に、RT3にアサインされていないセグメントのIP(192.0.2.1)にPingを実行してみます。
hiro@hiro [07時03分56秒] [~]
-> % ping -c 5 192.0.2.1
PING 192.0.2.1 (192.0.2.1) 56(84) bytes of data.
From 10.0.1.2 icmp_seq=1 Time to live exceeded
From 10.0.1.2 icmp_seq=2 Time to live exceeded
From 10.0.1.2 icmp_seq=3 Time to live exceeded
From 10.0.1.2 icmp_seq=4 Time to live exceeded
From 10.0.1.2 icmp_seq=5 Time to live exceeded
--- 192.0.2.1 ping statistics ---
5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4007ms
「 Time to live exceeded 」が通知されました。実際にループが起こってることが確認できました。
OSPFなどの動的プロトコルでは経路集約を行う際は「192.0.2.0/24 -> Null」のようなルートが自動生成されて、RT3にアサインされていないセグメントの場合はパケットを破棄し、ループを防止するようですね。この辺で「ロンゲストマッチ」なども出てきてなるほどなと感じました。
それではまた。