A-A+

OSPF路由的认证实验:区域认证和接口认证的使用方法

2015年11月21日 站长资讯 暂无评论

【这次实验目的】OSPF的认证有2个方面一个是区域认证,另一个是接口认证;两者必须配合起来才能起作用。在实验中,演示如何使用.

OSPF 的认证,在实验中我们在区域 0中做认证,并在接口上配合认证。

【配置步骤】

(1)具体的配置会在实验结尾处给出来,拓扑如下:

(2) 区域认证配置:

[R1-ospf-1-area-0.0.0.0]authentication-mode simple

[R2-ospf-1-area-0.0.0.0]authentication-mode simple

(3)

[R1-S0/6/0]ospf authentication-mode simple plain 123

[R2-S0/6/0]ospf authentication-mode simple plain 123

【测试结果】

(1)在没有使用认证技术前,我们来观察一下R1和R2之间的邻居关系

  1. [R1]dis ospf peer  
  2.    
  3.                   OSPF Process 1 with Router ID 10.1.1.2  
  4.                         Neighbor Brief Information  
  5.    
  6.  Area: 0.0.0.0          
  7.  Router ID       Address         Pri Dead-Time Interface       State  
  8.  10.1.1.3        3.3.3.2         1   40        S0/6/0          Full/ -  
  9.    
  10.    
  11. [R2]dis ospf peer  
  12.    
  13.                   OSPF Process 1 with Router ID 10.1.1.3  
  14.                         Neighbor Brief Information  
  15.    
  16.  Area: 0.0.0.0          
  17.  Router ID       Address         Pri Dead-Time Interface       State  
  18.  10.1.1.2        3.3.3.1         1   38        S0/6/0          Full/ -  

(2)在R1使用了认证,而R2未使用认证的时候

  1. [R1]dis ospf peer  
  2.    
  3.                   OSPF Process 1 with Router ID 10.1.1.2  
  4.                         Neighbor Brief Information  
  5. [R1]  
  6.    
  7. [R2]dis ospf peer  
  8.    
  9.                   OSPF Process 1 with Router ID 10.1.1.3  
  10.                         Neighbor Brief Information  

分别在R1和R2上开启debugging ospf packet后发现各自都在不断地发包,R1发的包中autype字段中填充的是01,R2发的包中autype

字段中填充的字段是00,经查资料autype字段填充00表示无认证,01填充表示simple认证,02填充表示md5认证。

  1. R1:*Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:OSPF 1: SEND Packet.  
  2. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:Source Address: 3.3.3.1   
  3. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:Destination Address: 224.0.0.5   
  4. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:Ver# 2, Type: 1, Length: 44.  
  5. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:Router: 10.1.1.2, Area: 0.0.0.0, Checksum: 61598.  
  6. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:AuType: 01, Key(ascii): 31 32 33 0 0 0 0 0.   
  7. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:Net Mask: 255.255.255.252, Hello Int: 10, Option: _E_.  
  8. *Jan 16 21:44:26:62 2013 R1 RM/6/RMDEBUG:Rtr Priority: 1, Dead Int: 40, DR: 0.0.0.0, BDR: 0.0.0.0.  
  9.                                                                   
  10. R2:  
  11. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:OSPF 1: SEND Packet.  
  12. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:Source Address: 3.3.3.2   
  13. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:Destination Address: 224.0.0.5   
  14. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:Ver# 2, Type: 1, Length: 44.  
  15. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:Router: 10.1.1.3, Area: 0.0.0.0, Checksum: 61598.  
  16. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:AuType: 00, Key(ascii): 0 0 0 0 0 0 0 0.   
  17. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:Net Mask: 255.255.255.252, Hello Int: 10, Option: _E_.  
  18. *Jan 16 21:45:11:484 2013 R2 RM/6/RMDEBUG:Rtr Priority: 1, Dead Int: 40, DR: 0.0.0.0, BDR: 0.0.0.0.  

(3)2台设备都使用了 simple 认证之后,二者的邻居关系正常

(4)接下来我们把他们的认证方式改成 MD5后再来看一下
[R1-ospf-1-area-0.0.0.0]authentication-mode md5

[R2-ospf-1-area-0.0.0.0]authentication-mode md5

(3)

[R1-S0/6/0]ospf authentication-mode md5 1 cipher abcde

[R2-S0/6/0]ospf authentication-mode md5 1 cipher abcde

配置完成后仍然可以建立邻居。

附加说明:

当两边的密码不同时:

debugging ospf packet 发现一直发包

debugging ospf event 报以下错误:OSPF 1 :OSPF received packet with mismatch authentication key.

如果R1配置了MD5验证,而R2配置了

则debugging ospf event 可以见到

R1 OSPF 1 :OSPF received packet with mismatch authentication type :0.

R2 OSPF 1 :OSPF received packet with mismatch authentication type :2.

R1 debugging信息显示:对端来的是没有验证,我没有办法跟他协商呀!

R2 debugging 信息显示:对端来的是MD5验证,我没办法跟他协商呀!亲,是不是配置错误了!嘻嘻。

  1. R1:  
  2. [R1-ospf-1]qu  
  3. [R1]dis cu  
  4. #  
  5.  version 5.20, Alpha 1011  
  6. #  
  7.  sysname R1  
  8. #  
  9.  password-control login-attempt 3 exceed lock-time 120  
  10. #  
  11.  undo voice vlan mac-address 00e0-bb00-0000  
  12. #  
  13.  ipsec cpu-backup enable  
  14. #  
  15.  undo cryptoengine enable  
  16. #  
  17.  domain default enable system  
  18. #  
  19. vlan 1  
  20. #  
  21. domain system  
  22.  access-limit disable  
  23.  state active  
  24.  idle-cut disable  
  25.  self-service-url disable  
  26. #  
  27. interface Serial0/6/0  
  28.  link-protocol ppp  
  29.  ip address 3.3.3.1 255.255.255.252  
  30.  ospf authentication-mode simple plain 123  
  31. #  
  32. interface Serial0/6/1  
  33.  link-protocol ppp  
  34. #  
  35. interface Serial0/6/2  
  36.  link-protocol ppp  
  37. #  
  38. interface Serial0/6/3  
  39.  link-protocol ppp  
  40. #  
  41. interface NULL0  
  42. #  
  43. interface LoopBack0  
  44.  ip address 10.1.1.2 255.255.255.255  
  45. #  
  46. interface Ethernet0/4/0  
  47.  port link-mode bridge  
  48. #  
  49. interface Ethernet0/4/1  
  50.  port link-mode bridge  
  51. #  
  52. interface Ethernet0/4/2  
  53.  port link-mode bridge  
  54. #  
  55. interface Ethernet0/4/3  
  56.  port link-mode bridge  
  57. #  
  58. interface Ethernet0/4/4  
  59.  port link-mode bridge  
  60. #  
  61. interface Ethernet0/4/5  
  62.  port link-mode bridge  
  63. #  
  64. interface Ethernet0/4/6  
  65.  port link-mode bridge  
  66. #  
  67. interface Ethernet0/4/7  
  68.  port link-mode bridge  
  69. #  
  70. ospf 1 router-id 10.1.1.2  
  71.  import-route direct  
  72.  area 0.0.0.0  
  73.   authentication-mode simple  
  74.   network 3.3.3.0 0.0.0.3  
  75. #  
  76.  load xml-configuration  
  77. #  
  78. user-interface con 0  
  79. user-interface vty 0 4  
  80. #  
  81. return  
  82.    
  83.    
  84.    
  85. R2  
  86.    
  87. [R2]  dis cu  
  88. #  
  89.  version 5.20, Alpha 1011  
  90. #  
  91.  sysname R2  
  92. #  
  93.  password-control login-attempt 3 exceed lock-time 120  
  94. #  
  95.  undo voice vlan mac-address 00e0-bb00-0000  
  96. #  
  97.  ipsec cpu-backup enable  
  98. #  
  99.  undo cryptoengine enable  
  100. #  
  101.  domain default enable system  
  102. #  
  103. vlan 1  
  104. #  
  105. domain system  
  106.  access-limit disable  
  107.  state active  
  108.  idle-cut disable  
  109.  self-service-url disable  
  110. #  
  111. interface Serial0/6/0  
  112.  link-protocol ppp  
  113.  ip address 3.3.3.2 255.255.255.252  
  114.  ospf authentication-mode simple plain 123  
  115. #  
  116. interface Serial0/6/1  
  117.  link-protocol ppp  
  118. #  
  119. interface Serial0/6/2  
  120.  link-protocol ppp  
  121. #  
  122. interface Serial0/6/3  
  123.  link-protocol ppp  
  124. #  
  125. interface NULL0  
  126. #  
  127. interface LoopBack0  
  128.  ip address 10.1.1.3 255.255.255.255  
  129. #  
  130. interface Ethernet0/4/0  
  131.  port link-mode bridge  
  132. #  
  133. interface Ethernet0/4/1  
  134.  port link-mode bridge  
  135. #  
  136. interface Ethernet0/4/2  
  137.  port link-mode bridge  
  138. #  
  139. interface Ethernet0/4/3  
  140.  port link-mode bridge  
  141. #  
  142. interface Ethernet0/4/4  
  143.  port link-mode bridge  
  144. #  
  145. interface Ethernet0/4/5  
  146.  port link-mode bridge  
  147. #  
  148. interface Ethernet0/4/6  
  149.  port link-mode bridge  
  150. #  
  151. interface Ethernet0/4/7  
  152.  port link-mode bridge  
  153. #  
  154. ospf 1 router-id 10.1.1.3  
  155.  area 0.0.0.0  
  156.   authentication-mode simple  
  157.   network 3.3.3.0 0.0.0.3  
  158. #  
  159.  load xml-configuration  
  160. #  
  161. user-interface con 0  
  162. user-interface vty 0 4  
  163. #  
  164. return  
标签:

给我留言