【OSPF】プレーンテキストでの認証設定

 OSPFでは、不正なルータとネイバー関係にならないよう、認証を設定することができます。 認証にはプレーンテキストを使用した認証とMD5 認証があります。ここでは、プレーンテキストを使用した認証についてまとめます。

 まず、OSPFの基本設定をします。

R2(config)# router ospf 1
R2(config-router)# network 192.168.23.0 0.0.0.255 area 0
R2(config-router)# network 2.2.2.2 0.0.0.0 area 0

R3(config)# router ospf 1
R3(config-router)# network 192.168.23.0 0.0.0.255 area 0
R3(config-router)# network 3.3.3.3 0.0.0.0 area 0

 では、プレーンテキストでの認証を有効化し、認証キーをCISCOに設定します。

スポンサーリンク

認証の有効化

 認証の有効化はインターフェース単位の設定、もしくはエリア全体に設定の2通りがあります。

インタフェース単位で有効にする方法

 インタフェース単位で、OSPF認証を有効化します。R2のインタフェースで認証を有効化します。

R2(config)# int fastEthernet 0/0.23
R2(config-subif)# ip ospf authentication

 R2のOSPFインタフェース状態を確認します。

R2# show ip ospf interface
Loopback0 is up, line protocol is up
  Internet Address 2.2.2.2/32, Area 0, Attached via Network Statement
  Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Loopback interface is treated as a stub Host
FastEthernet0/0.23 is up, line protocol is up
  Internet Address 192.168.23.2/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 2.2.2.2, Interface address 192.168.23.2
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:03
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0
  Suppress hello for 0 neighbor(s)
  Simple password authentication enabled

 R2のHelloパケットを確認すると、Auth Typeが Simple password となっています。

 しばらくすると、ネイバーがダウンします。

*Jun 18 11:54:04.611: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0.23 from 
FULL to DOWN, Neighbor Down: Dead timer expired

 R2でdebug ip ospf adjを有効すると、R3と認証タイプが異なることで、ネイバーがダウンしてることがわかります。

R2# debug ip ospf adj
OSPF adjacency debugging is on

*Jun 18 11:57:04.983: OSPF-1 ADJ   Fa0/0.23: Rcv pkt from 192.168.23.3 : 
Mismatched Authentication type. Input packet specified type 0, we use type 1

 では、R3のインタフェースで認証を有効化します。

R3(config)# interface fastEthernet 0/0.23
R3(config-subif)# ip ospf authentication

 すると、ネイバーがアップします。

*Jun 18 12:00:43.207: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0.23 
from LOADING to FULL, Loading Done

エリア単位での認証の有効化

 OSPFインタフェースが多い場合など、エリア単位で一括で認証を有効化できます。R2のエリア0で認証を有効化します。

R2(config)# router ospf 1
R2(config-router)# area 0 authentication 

 R2にOSPFインタフェースを確認します。

R2# show ip ospf interface 
Loopback0 is up, line protocol is up 
  Internet Address 2.2.2.2/32, Area 0, Attached via Network Statement
  Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Loopback interface is treated as a stub Host
FastEthernet0/0.23 is up, line protocol is up 
  Internet Address 192.168.23.2/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Transmit Delay is 1 sec, State DR, Priority 1
  Designated Router (ID) 2.2.2.2, Interface address 192.168.23.2
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:08
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0 
  Suppress hello for 0 neighbor(s)
  Simple password authentication enabled

 しばらくすると、ネイバーがダウンします。

R2#
*Jun 18 12:27:38.015: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0.23 
from FULL to DOWN, Neighbor Down: Dead timer expired

 では、R3でもエリア0で認証を有効化します。

R3(config)# router ospf 1
R3(config-router)# area 0 authentication

 しばらくすると、ネイバーがアップします。

*Jun 18 12:29:49.867: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0.23 
from LOADING to FULL, Loading Done
スポンサーリンク

認証キーの設定

 R2でdebug ip ospf adjを有効にし、インタフェースにOSPF認証キーとしてCISCOを設定します。

R2#debug ip ospf adj
OSPF adjacency debugging is on

R2(config)# int fastEthernet 0/0.23
R2(config-subif)# ip ospf authentication-key CISCO

 すると、認証キーが対向と不一致のデバックログが出力されます。

*Jun 18 12:12:36.423: OSPF-1 ADJ   Fa0/0.23: Rcv pkt from 192.168.23.3,  : 
Mismatched Authentication Key - Clear Text

 では、R3で認証キーを設定します。

R3(config)# int fastEthernet 0/0.23
R3(config-subif)# ip ospf authentication-key CISCO

 すると、ネイバーがアップします。

*Jun 18 12:14:57.315: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0.23 
from LOADING to FULL, Loading Done

 R2のHelloパケットを確認すると、Auth DataCISCOとなっています。プレーンテキスト認証ですので、キーはそのまま読み取れます。

コメント