2017年5月14日日曜日

OSPF 認証(エリア認証)

◾️OSPF 認証(エリア認証)

 【課題】
  ・R1-R2間でインターフェース認証を実装する。
   又、ミス設定時の挙動を確認する。

 【補足】
  ・OSPF認証は2種類ある。
   ①インターフェース認証 ※本検証範囲
    (Type0:Null認証[認証なし]/Type1:平文認証/Type2:MD5認証)
   ②エリア認証
    (Type0:Null認証[認証なし]/Type1:平文認証/Type2:MD5認証)
   ※OSPFの認証では認証Type及びパスワード(MD認証であればKey-idも)一致する
   必要があります。

◾️検証環境図





①検証環境 事前設定確認


(1)OSPFネイバー確認

 OSPFネイバーが正常に張れている事を確認する。

R1#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:35    192.168.12.2    Ethernet0/0

R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1        1   FULL/DR         00:00:32    192.168.12.1    Ethernet0/0
3.3.3.3        1   FULL/BDR        00:00:36    192.168.23.3    Ethernet0/1

R3#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:31    192.168.23.2    Ethernet0/1


(1)OSPFネイバー確認
設定変更1(MD5認証[平文])
(1)R2のエリア0にてエリア認証を設定する。
R2(config)#router ospf 1
R2(config-router)#area 0 authentication 
R2(config)#int e0/0

R2(config-if)#ip ospf authentication-key cisco

※認証失敗時の挙動を確認する為に、少し待つ。
[ケース1]R1 認証あり(平文パスワード)  R2 認証なし 
R1#debug ip ospf adj 
OSPF adjacency debugging is on

*May  4 19:37:06.558: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.12.2 : Mismatched Authentication type. Input packet specified type 1, we use type 0 //Type0=Null認証(認証なし)  Type1=平文認証  Type2=MD5認証

R2#debug ip ospf adj 
OSPF adjacency debugging is on

*May  4 19:37:03.661: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.12.1 : Mismatched Authentication type. Input packet specified type 0, we use type 1   //Type0=Null認証(認証なし)  Type1=平文認証  Type2=MD5認証


※認証が出来ていない為、ネイバー関係は確立しない。


R1#show ip ospf neighbor 
R1#



R2#show ip ospf neighbor 
R2#



(2)R1のエリア0にてエリア認証を設定する。(誤ったパスワードを設定する)

R1(config)#router ospf 1
R1(config-router)#area 0 authentication 
R1(config)#int e0/0

R1(config-if)#ip ospf authentication-key ccie
※認証失敗時の挙動を確認する為に、少し待つ。
[ケース2]R1 認証あり(平文パスワード)  R2認証あり(平文パスワード)※パスワード不一致 
R1#debug ip ospf adj 
OSPF adjacency debugging is on

*May  4 19:40:44.348: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.12.2,  : Mismatched Authentication Key - Clear Text


R2#debug ip ospf adj 

OSPF adjacency debugging is on



*May  4 19:40:50.381: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.12.1,  : Mismatched Authentication Key - Clear Text

※認証が出来ていない為、ネイバー関係は確立しない。

R1#show ip ospf neighbor 
R1#


R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:35    192.168.12.1    Ethernet0/0

3.3.3.3           1   FULL/DR         00:00:37    192.168.23.3    Ethernet0/1

(3)R1のE0/0にてインターフェース認証を設定する。(正しいパスワードを設定する)

R1(config)#int e0/0
R1(config-if)#ip ospf authentication-key cisco

(4)OSPFネイバー確認する。
 正常にOSPFネイバーが確立される事を確認する。
R1#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           1   FULL/DR         00:00:35    192.168.12.2    Ethernet0/0

R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:35    192.168.12.1    Ethernet0/0

3.3.3.3           1   FULL/DR         00:00:37    192.168.23.3    Ethernet0/1

設定変更2(エリア認証[MD5パスワード認証)

(1)R1のE0/0にてインターフェース認証を設定する。
R2(config)#router ospf 1
R2(config-router)#area 10 authentication message-digest 
R2(config)#int e0/1
R2(config-if)#ip ospf message-digest-key 1 md5 cisco

※認証失敗時の挙動を確認する為に、少し待つ。
[ケース1]R1 認証あり(MD5パスワード)  R2 認証なし 
R2#debug ip ospf adj 
OSPF adjacency debugging is on

*May  4 19:53:09.161: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.3 : Mismatched Authentication type. Input packet specified type 0, we use type 2   //Type0=Null認証(認証なし)  Type1=平文認証  Type2=MD5認証
*May  4 19:53:12.912: OSPF-1 ADJ   Et0/1: Send with youngest Key 1   //key-id 1 をEt0/0から送信

R3#debug ip ospf adj 
OSPF adjacency debugging is on

*May  4 19:53:12.912: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2 : Mismatched Authentication type. Input packet specified type 2, we use type 0   //Type0=Null認証(認証なし)  Type1=平文認証  Type2=MD5認証

(2)R3のE0/0にてエリア認証を設定する。(誤ったパスワードを設定する)
[ケース2]R1 認証あり(MD5パスワード) R2認証あり(MD5パスワード)※パスワード不一致 
R3(config)#router ospf 1
R3(config-router)#area 10 authentication message-digest 
R3(config)#int e0/1
R3(config-if)#ip ospf message-digest-key 1 md5 ccie

R2#debug ip ospf adj     
OSPF adjacency debugging is on
*May  4 19:57:35.388: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.3 : Mismatched Authentication key - ID 1
*May  4 19:57:41.267: OSPF-1 ADJ   Et0/1: Send with youngest Key 1  //key-id 1 をEt0/0から送信

R3#debug ip ospf adj     
OSPF adjacency debugging is on
*May  4 19:57:35.386: OSPF-1 ADJ   Et0/1: Send with youngest Key 1  //key-id 1 をEt0/0から送信
*May  4 19:57:31.849: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2 : Mismatched Authentication key - ID 1
※認証が出来ていない為、ネイバー関係は確立しない。

R1#show ip ospf neighbor 
R1#


R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/BDR        00:00:39    192.168.12.1    Ethernet0/0



(3R2のE0/0にてインターフェース認証を設定する。(key-chainの不一致)
[ケース3]R1 認証あり(MD5パスワード) R2認証あり(MD5パスワード)※key-chain不一致
R3(config)#int e0/0
R3(config-if)#ip ospf message-digest-key 2 md5 cisco

R2#debug ip ospf adj 
OSPF adjacency debugging is on
*May  4 20:06:00.196: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.3 : Mismatched Authentication Key - Invalid cryptographic authentication Key ID 2 on interface //key-chainが不一致のためのエラー
*May  4 20:06:04.968: OSPF-1 ADJ   Et0/1: Send with youngest Key 1   //key-id 1 をEt0/0から送信

R3#debug ip ospf adj 
OSPF adjacency debugging is on

*May  4 20:06:09.936: OSPF-1 ADJ   Et0/1: Send with youngest Key 2    //key-id 2 をEt0/0から送信
*May  4 20:06:04.973: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2 : Mismatched Authentication Key - Invalid cryptographic authentication Key ID 1 on interface  //key-chainが不一致のためのエラー

※認証が出来ていない為、ネイバー関係は確立しない。

R3#show ip ospf neighbor 
R3#

R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/BDR        00:00:33    192.168.12.1    Ethernet0/0

(3)R3のE0/0にてエリア認証を設定する。(正しいパスワードを設定する)
R3(config)#int e0/0
R3(config-if)#ip ospf message-digest-key 1 md5 cisco


(4)OSPFネイバー確認する。

 正常にOSPFネイバーが確立される事を確認する。

R1#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface


2.2.2.2           1   FULL/DR         00:00:36    192.168.12.2    Ethernet0/0


R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:36    192.168.12.1    Ethernet0/0