RIPの認証を確認する
- カテゴリ:
- Cisco
今回はRIPの認証を確認します。R2とR3はシリアルケーブルで直接接続(23.23.23.0/24)されています。
R2(config)#do sh ip int b Interface IP-Address OK? Method Status Protocol Serial1/2 23.23.23.2 YES manual up up Loopback0 17.17.2.2 YES NVRAM up up R3(config)#do sh ip int b Interface IP-Address OK? Method Status Protocol Serial1/3 23.23.23.3 YES manual up up Loopback0 17.17.3.3 YES NVRAM up up R2(config)#do pin 23.23.23.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 23.23.23.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/26/72 ms |
まず認証なしでRIPを設定します。CCIE(R&S)ではRIPはバージョン2のみの利用ですので、version 2は必須コマンドです。
R2(config)#router rip R2(config-router)#version 2 R2(config-router)#no auto-summary R2(config-router)#network 23.23.23.2 R2(config-router)#network 17.17.2.2 |
OSPFのように、インターフェイスのIPアドレスをそのまま入力してもクラスフルのネットワークアドレスに自動的に置き換わる点に注意してください。
R2(config-router)#do sh run | s rip router rip version 2 network 17.0.0.0 network 23.0.0.0 no auto-summary |
RIPの設定を確認するには"show ip protocols"や"show ip rip database"を使います。
"show ip protocols"によりバージョン2が利用されていることや、指定したネットワークが有効であることが確認できます。
R2#show ip protocols Routing Protocol is "rip" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Sending updates every 30 seconds, next due in 10 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Redistributing: rip Default version control: send version 2, receive version 2 Interface Send Recv Triggered RIP Key-chain Serial1/2 2 2 Loopback0 2 2 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 17.0.0.0 23.0.0.0 Routing Information Sources: Gateway Distance Last Update Distance: (default is 120) |
"show ip rip database"では、現在自分のネットワークしか表示されていないことが分かります。
R2#show ip rip database 17.0.0.0/8 auto-summary 17.17.2.0/24 directly connected, Loopback0 23.0.0.0/8 auto-summary 23.23.23.0/24 directly connected, Serial1/2 |
デバグを有効にして、同じコマンドをR3にも入力します。しばらくするとR2からのアップデートが確認できます。
R3#debug ip rip R3(config-router)#do sh run | s rip router rip version 2 network 17.0.0.0 network 23.0.0.0 no auto-summary Apr 4 07:02:06.631: RIP: received v2 update from 23.23.23.2 on Serial1/3 Apr 4 07:02:06.635: 17.17.2.0/24 via 0.0.0.0 in 1 hops |
R2で確認するとRouting Information SourcesにR3のIPアドレスが表示されることが分かります。
R2#show ip protocols | begin Sources Routing Information Sources: Gateway Distance Last Update 23.23.23.3 120 00:00:23 Distance: (default is 120) |
R3のLo0のネットワークアドレスが追加されています。
R2#show ip rip database 17.0.0.0/8 auto-summary 17.17.2.0/24 directly connected, Loopback0 17.17.3.0/24 [1] via 23.23.23.3, 00:00:12, Serial1/2 23.0.0.0/8 auto-summary 23.23.23.0/24 directly connected, Serial1/2 |
では認証を利用するにあたり、キーチェーンを作成します。ここではキーチェーン名を"RIP"としキー番号は"1"としました。キーの文字列は"CISCO"です。同じものをR3でも作成します。キーの文字列の最後に余計なスペースが入ると認証エラーとなりますので注意してください。
R2(config)#key chain RIP R2(config-keychain)#key 1 R2(config-keychain-key)#key-string CISCO R2(config-keychain-key)#do sh key chain Key-chain RIP: key 1 -- text "CISCO" accept lifetime (always valid) - (always valid) [valid now] send lifetime (always valid) - (always valid) [valid now] |
まずテキストモードで認証を有効にしてみます。認証はテキストモードが初期値のため、"ip rip authentication mode text"は入れても入れなくても同じです。
R2(config-keychain-key)#int s1/2 R2(config-if)#ip rip authentication key-chain RIP R2(config-if)#do sh ip prot | b Interface Interface Send Recv Triggered RIP Key-chain Serial1/2 2 2 RIP Loopback0 2 2 |
この時、R3では下記のように表示されます。
Apr 4 07:30:40.923: RIP: ignored v2 packet from 23.23.23.2 (invalid authentication) |
R3でも認証を有効にしてみます、テキストモードのためキーの文字列"CISCO"がそのまま表示されることが分かります。
R3(config-router)#int s1/3 R3(config-if)#ip rip authentication key-chain RIP Apr 4 07:32:04.659: RIP: received packet with text authentication CISCO Apr 4 07:32:04.659: RIP: ignored v2 packet from 23.23.23.2 (invalid authentication) |
より望ましい認証である、MD5モードに変更します。
R2(config)#int s1/2 R2(config-if)#ip rip authentication mode md5 R3(config)#int s1/3 R3(config-if)#ip rip authentication mode md5 |
確かにMD5が利用されていることが分かります。RIPではこのようにdebugコマンドを利用して、認証を確認します。
Apr 4 07:52:35.035: RIP: received packet with MD5 authentication |
コメント