配置OSPF邻居认证_第1页
配置OSPF邻居认证_第2页
配置OSPF邻居认证_第3页
配置OSPF邻居认证_第4页
配置OSPF邻居认证_第5页
已阅读5页,还剩78页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1 6.9 配置 OSPF邻居认证 6.9.1操作内容和环境 操作内容:本节主要介绍在思科路由器上配置 OSPF邻居认证的命令和方法,通过学习,了解并掌握多区域中 OSPF路由器之间邻居认证方式:明文认证和 MD5算法密文认证。 组网环境: Router3是思科 CISCO 3725路由器, IOS为 c3725-jk9s-mz.123-12a(版本为 12.3), Router1和 Router2是思科 CISCO 2621XM路由器, IOS为 c2600-adventerprisek9-mz.123-11.T3(版本为 12.3)。 PC机 3台, DTE-DCE交叉电缆( V35电缆) 1对,交叉网线1根 (或一台交换机和 2根直通网线 ), console配置电缆 3根。 Router1以太网口与 Router3的以太网口通过交叉网线相连或通过交换机相连,Router1串口与 Router3的串口通过 V35电缆相连。 (图中的 Fa0/0代表快速以太网 FastEtherent0/0端口 )。 2 图 6-11 OSPF邻居认证配置拓扑结构图 R o u t e r 1R o u t e r 2R o u t e r 3F a 0 / 0F a 0 / 0S 0 / 0 : 1 9 2 . 1 6 8 . 1 . 1 / 2 4S 0 / 0 : 1 9 2 . 1 6 8 . 1 . 2 / 2 4F a 0 / 0 : 1 0 . 1 0 . 1 . 1 / 2 4F a 0 / 0 : 1 0 . 1 0 . 1 . 2 / 2 4简单口令验证M D 5 验 证区 域 0区 域 13 6.9.2 相关知识介绍 (基础知识 ) OSPF协议支持基于接口的 OSPF报文认证,认证 OSPF相邻路由器的身份,以保证 OSPF报文来自经认证的邻居路由器,防止未授权的邻居向自己传递包含虚假路由信息的的 OSPF报文 OSPF协议支持两种认证方式:在相邻路由器之间明文认证( Simple),或 MD5算法密文认证。 采用明文认证时,认证密码在链路上以明文方式传送,用数据包嗅探器就可以轻易地捕获 OSPF的分组,并解码出没有加密的密码。 如果使用密文认证,则路由器只在链路上传送密码的消息摘要或哈希值,而不传送密码本身,只有接收的路由器配置了正确的认证密钥,认证才能通过 4 6.9.2 相关知识介绍 (注意要点 ) 当接口采用 MD5密文认证时,除了设定认证字(即认证密码),还要指定认证字键值 key-id,每个 key-id是一个 1 255之间的整数, 与 MD5认证字配合使用。在一个接口上,后配置的认证字与 key-id将覆盖原有的认证字与 key-id。 需要缺省情况下,接口不对报文进行认证。在配置对报文进行认证时,其明文认证密码的最大长度为 8个字符; MD5认证密码的最大长度为 16个字符; key-id为 MD5认证方式时的认证字键值,取值范围为 1 255。 同一网段上的相邻路由器的接口配置的报文认证方式、认证密码以及 key-id都必须一致,否则认证会失败。 5 6.9.2 相关知识介绍 (认证格式 ) (1 )相邻路由器明文认证的设置 第一步:在区域中进入认证的路由器上启动区域明文认证 。 启动区域明文认证的命令格式如下: area area_id authentication 第二步,在接口上输入明文形式的密码 在接口上配置明文认证方式和密码的命令格式如下: ip ospf authentication-key password 例:配置区域 0内接口 Serial0/0 对 OSPF 报文采用简单认证,密码为 abc123,命令如下: Router(config)#router ospf 1 Router(config-router)# area 0 authentication Router(config-router)#exit Router(config)#interface s0/0 Router(config-if)# ip ospf authentication-key abc123 6 6.9.2 相关知识介绍 (认证格式 ) (2)相邻路由器 MD5密文认证的设置 第一步:在区域中进入认证的路由器上启动 MD5区域认证 。 启动区域 MD5密文认证的命令格式如下: area area_id authentication message-digest 在接口上输入 MD5认证字(或称为认证密钥)及认证字键值 在接口上配置 MD5认证字及认证字键值的命令格式如下: ip ospf message-digest-key keyid md5 key 例:配置区域 0内接口 Serial0/0 采用 MD5密文认证, MD5认证密钥为 bbbb, key-id 为 178,命令如下: Router(config)#router ospf 1 Router(config-router)# area 0 authentication message-digest Router(config-router)#exit Router(config)#interface s0/0 Router(config-if)# ip ospf message-digest-key 178 md5 bbbb 7 6.9.3 操作步骤 1. 按拓扑图配置各个端口及认证方式 (1) 配置 Router3的 FA0/0接口及接口认证方式 Router3路由器型号为:思科 CISCO 3725,其命令如下 Routerenable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router3 Router3(config)#interface fa0/0 Router3(config-if)#ip address Router3(config-if)#no shutdown Router3(config-if)#ip ospf authentication-key aaaa Router3(config-if)#exit Router3(config)#router ospf 1 #进入 ospf设置状态 Router3(config-router)#network 55 area 0 Router3(config-router)#area 0 authentication #在区域 0路由器 上启动区域认证 Router3(config-router)#end 8 6.9.3 操作步骤 1. 按拓扑图配置各个端口及认证方式 (2) Router1的 FA0/0、 S0/0接口配置及接口认证方式: Router1路由器型号为:思科 CISCO2621XM,其命令如下 Routerenable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router1 Router1(config)#interface fa0/0 Router1(config-if)#ip address Router1(config-if)#no shutdown Router1(config-if)#ip ospf authentication-key aaaa Router1(config-if)#interface s0/0 Router1(config-if)#ip address Router1(config-if)#no shutdown Router1(config-if)#clockrate 64000 #连接该端口的电缆若是 DTE电缆,则不用配置 Router1(config-if)#ip ospf message-digest-key 178 md5 bbbb 9 Router1(config-if)#exit Router1(config)#router ospf 1 #进入 ospf设置状态 Router1(config-router)#network 55 area 1 Router1(config-router)#network 55 area 0 Router1(config-router)#area 0 authentication #在区域 0路由器上启动区域明文认证 Router1(config-router)#area 1 authentication message-digest #在区域 1路由器上启动 MD5区域认证 Router1(config-router)#end Router1# 10 6.9.3 操作步骤 1. 按拓扑图配置各个端口及认证方式 (3) Router2的 S0/0接口的配置及认证方式 Router2的型号为:思科 CISCO 2621XM路由器,配置命令如下: Routerenable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router2 Router2(config)#interface s0/0 Router2(config-if)#ip address Router2(config-if)#no shut Router2(config-if)#clockrate 64000 #连接该端口的电缆若是 DTE电缆,则不用设置 Router2(config-if)#ip ospf message-digest-key 178 md5 bbbb Router2(config-if)#exit Router2(config)#router ospf 1 Router2(config-router)#network 55 area 1 Router2(config-router)#area 1 authentication message-digest 11 6.9.3 操作步骤 2. 测试认证方式的正确性 Router2#ping Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to , timeout is 2 seconds: ! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/32 ms 从结果看, Router2能 ping通 Router1,线路是连通的, MD5密文认证通过。再测试其它网段。 Router2#ping #测试结果是连通的 Router2#ping #测试结果是连通的 通过 ping命令测试, Router2能 ping通 Router3,线路是连通的,明文认证也通过,并且 OSPF协议工作正常。 12 6.9.3 操作步骤 3. 查看路由信息 , 确定其认证方式 (1)查看 Router2和 Router3的路由表 , 测试认证方式的正确性 Router2#show ip route Gateway of last resort is not set /24 is subnetted, 1 subnets O IA 110/65 via , 00:11:36, Serial0/0 C /24 is directly connected, Serial0/0 Router3#show ip route Gateway of last resort is not set /24 is subnetted, 1 subnets C is directly connected, FastEthernet0/0 O IA /24 110/65 via , 00:13:08, FastEthernet0/0 通过显示的路由表内容可知, Router2和 Router3通过 OSPF协议,获得了非直连网段路由信息,这说明链路是连通的 ,邻居认证通过。 13 6.9.3 操作步骤 3. 查看路由信息 , 确定其认证方式 (1)查看在 Router1上查看端口信息 , 测试认证方式的正确性 Router1#show ip ospf interface FastEthernet0/0 is up, line protocol is up Internet Address /24, Area 0 Process ID 1, Router ID , Network Type BROADCAST, Cost: 1 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) , Interface address Backup Designated router (ID) , Interface address Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:02 Supports Link-local Signaling (LLS) Index 1/2, 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 14 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor (Backup Designated Router) Suppress hello for 0 neighbor(s) Simple password authentication enabled Serial0/0 is up, line protocol is up Internet Address /24, Area 1 Process ID 1, Router ID , Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:07 Supports Link-local Signaling (LLS) Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 15 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor Suppress hello for 0 neighbor(s) Message digest authentication enabled Youngest key id is 178 由 Router1上的端口信息可知:在 FastEthernet0/0上明文认证方式已启动,在 Serial0/0上 MD5密文认证方式已启动,其最新设置的认证字 key-id号为 178,这与我们配置相符。 在路由器之间进行邻居认证时,认证双方的认证方式与密码必须一致,否则,不能通过认证。下面我们修改认证一方的认证密码,使其与对方不一致,再测试邻居认证情况。 16 6.9.3 操作步骤 4. 修改 S2端口的 OSPF认证密码: (1)修改 S0/0端口的 OSPF认证密码,使其与对端不一致 Router2#config terminal Router2(config)#interface s0/0 Router2(config-if)#no ip ospf message-digest-key 178 md5 bbbb Router2(config-if)#ip ospf message-digest-key 123 md5 abcd (2)用 ping命令测试连通性 Router2#ping Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to , timeout is 2 seconds: . Success rate is 0 percent (0/5)(不通) 在 Router2上执行 ping ,则后发现此时链路不通,说明Router2与 Router1之间的 MD5密文认证方式没有通过。 17 6.9.3 操作步骤 4. 修改 S2端口的 OSPF认证密码: (3)查看路由表信息 Router2#show ip route Gateway of last resort is not set C /24 is directly connected, Serial0/0 从路由表信息可知,由于邻居之间认证失败,所以链路不通, OSPF协议无法正确执行,路由表中不含通过 OSPF获得的到远端网络的路由信息。 由此说明在邻居之间进行身份认证时,必须设置统一的认证密码。 18 6.9.3 操作步骤 4. 修改 S2端口的 OSPF认证密码: (4)测试 Router1与 Router2 Router2#ping Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to , timeout is 2 seconds: ! Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/28 ms 这时 Router2与 Router1之间的链路还是激活的, Router2能 ping通Router1。但是 Router2与 Router1之间不构成邻居关系,因为不能互相通过认证,下面的命令能证实这一点。 Router2#show ip ospf neighbor (空白行) 显示空白,说明 Router2没有邻居。 19 6.9.3 操作步骤 5. 密码改回: Router2#config terminal Router2(config)#interface s0/0 Router2(config-if)#no ip ospf message-digest-key 123 md5 abcd Router2(config-if)#ip ospf message-digest-key 178 md5 bbbb 6.小结 OSPF 支持在相邻路由器之间进行明文认证( Simple)或 MD5密文认证,同一网段上的路由器接口配置的报文认证方式、认证密码、 key-id(如果有的话)必须一致。 并非不同的区域才可配置不同的认证方式,同一区域的不同网段可用不同的认证方式,因此,把前面配置中 Router1和 Router2之间的链路由区域 1改成区域 0也是可以的。 20 附:各路由器最终配置信息 : Router1#show run Building configuration. Current configuration : 1092 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname Router1 ! boot-start-marker boot-end-marker ! no network-clock-participate slot 1 no network-clock-participate wic 0 ip subnet-zero ! 21 ip cef ip ips po max-events 100 no aaa new-model no ftp-server write-enable voice-card 1 ! interface FastEthernet0/0 ip address ip ospf authentication-key aaaa duplex auto speed auto ! interface Serial0/0 ip address ip ospf message-digest-key 178 md5 bbbb clockrate 64000 ! 22 interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 no ip address shutdown ! router ospf 1 log-adjacency-changes area 0 authentication area 1 authentication message-digest network 55 area 0 network 55 area 1 ! 23 ip classless ! no ip http server no ip http secure-server ! control-plane ! line con 0 line aux 0 line vty 0 4 ! end 24 Router2#show run hostname Router2 interface Serial0/0 ip address ip ospf message-digest-key 178 md5 bbbb ! router ospf 1 log-adjacency-changes area 1 authentication message-digest network 55 area 1 25 Router3#show run hostname Router3 interface FastEthernet0/0 ip address ip ospf authentication-key aaaa ! router ospf 1 log-adjacency-changes area 0 authentication network 55 area 0 26 6.10 配置 OSPF路由聚合 6.10.1操作内容和环境 操作内容:本节主要介绍在思科路由器上配置 OSPF网段聚合的方法,通过学习,了解多区域中 OSPF路由聚合的意义,掌握把多条 AS外部路由聚合成一条汇总路由的方法,通过路由聚合,可以减少路由器上路由信息的数量,改善网络性能 。 组网环境: Router1是思科 CISCO 3725路由器, IOS为 c3725-jk9s-mz.123-12a(版本为 12.3), Router2和 Router3是思科 CISCO 2621XM路由器, IOS为 c2600-adventerprisek9-mz.123-11.T3(版本为 12.3)。 PC机 3台,交叉网线 3根, DTE-DCE交叉电缆( V35电缆)2对, console配置电缆 3根。路由器以太网端口与 PC机相连。图中的Fa0/0代表快速以太网 FastEtherent0/0端口。 27 图 6-12 OSPF网段聚合配置拓扑结构图 L o o p 04 0 . 1 . 3 . 1 / 2 43 0 . 1 . 1 . 2 / 2 42 0 . 1 . 1 . 2 / 2 42 0 . 1 . 1 . 1 / 2 4P C - AP C - B P C - CR o u t e r 1 R o u t e r 2F a 0 / 0 : 1 0 . 1 . 1 . 1 / 2 43 0 . 1 . 1 . 1 / 2 4F a 0 / 1S 1 / 0S 0 / 0S 0 / 1S 0 / 0区 域 0区 域 1R o u t e r 3F a 0 / 0 : 4 0 . 1 . 1 . 1 / 2 44 0 . 1 . 2 . 1 / 2 428 6.10.2 相关知识介绍 (基础知识 ) 当路由信息在 ABR(或 ASBR)中进行处理时,如果在 ABR(或ASBR)上配置了路由聚合, ABR(或 ASBR)只发送一条聚合路由,该聚合路由包含了属于该网段的多个子网段。一个区域可多次配置路由聚合。 “ area range”命令的用法。该命令只在 ABR上使用, ABR检查自身路由表,对每个目的网络地址的类型是网络(而不是路由器)的路由项,以网段为单位生成网络汇总 LSA( 3类 LSA),再向该LSA的目的网络所在区域外的其它区域发送该 3类 LSA 。 缺省情况下, OSPF不进行区域内路由聚合。分配非骨干区域的网段时请尽量连续可聚合,否则以后网络扩容时,维护难度会加大很多。 29 6.10.2 相关知识介绍 (认证格式 ) 配置 OSPF路由聚合命令如下 ; summary-address ip_address mask_address no summary-address ip_address mask_address 其中: ip-address 和 mask_address 为网络 IP 地址和掩码,点分十进制格式。 例: ASBR用汇总路由 /16代替被覆盖的 AS外部网段/24、 /24、 /24,并以 5类 LSA的形式把 总路由 /16传播到整个 AS内。 Router(config-router)#summary-address 区域内路由汇总,即把多条路由合并成一条。 area area-id range summary-address mask no area area-id range summary-address mask 30 6.10.3 操作步骤 1. 按拓扑图配置各个端口及认证方式 (1) 配置 Router1的 Fa0/0、 S1/0口: Router1路由器型号为:思科 CISCO 3725路由器,其命令如下 Routerenable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router1 Router1(config)#interface fa0/0 Router1(config-if)#ip address Router1(config-if)#no shutdown Router1(config-if)#interface s1/0 Router1(config-if)#ip address Router1(config-if)#no shutdown Router1(config-if)#clockrate 64000 #连接该端口的电缆若是 DTE电缆,则不用配置 Router1(config-if)#exit Router1(config)#router ospf 1 Router1(config-router)#network 55 area 0 Router1(config-router)#network 55 area 0 31 6.10.3 操作步骤 1. 按拓扑图配置各个端口及认证方式 (2) Router2的 S0/0、 S0/1口配置 路由器 Router2的型号为:思科 CISCO 2621X路由器,该路由器是边 界路由器,注意其所属 OSPF区域的设置。其命令如下: Routerenable Router#config terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname Router2 Router2(config)#interface s0/0 Router2(config-if)#ip address Router2(config-if)#no shutdown Router2(config-if)#clockrate 64000 Router2(config-if)#interface s0/1 Router2(config-if)#ip address Router2(config-if)#no shutdown Router2(config-if)#clockrate 64000 Router2(config-if)#exit Router2(config)#router ospf 1 Router2(config-router)#network 55 area 1 Router2(config-router)#network 55 area 0 32 6.10.3 操作步骤 1. 按拓扑图配置各个端口及认证方式 (3) Router3的接口配置 路由器 Router3型号为:思科 CISCO2621X型路由器,其命令如下: Routerenable Router#config terminal Router(config)#hostname Router3 Router3(config)#interface fa0/0 Router3(config-if)#ip address Router3(config-if)#no shutdown Router3(config-if)#interface fa0/1 Router3(config-if)#ip address Router3(config-if)#no shutdown Router3(config-if)#interface s0/0 Router3(config-if)#ip address Router3(config-if)#no shutdown Router3(config-if)#clockrate 64000 Router3(config-if)#interface Loopback0 Router3(config-if)#ip address Router3(config-if)#exit Router3(config)#router ospf 1 Router3(config-router)#network 55 area 1 33 6.10.3 操作步骤 2. 测试端口连通性 Router1#ping #测试结果是连通的 Router1#ping #测试结果是连通的 Router1#ping #测试结果是连通的 Router1#ping #测试结果不通,因为 Router3在 /24上没有启用 OSPF协议,到网段 /24的路由信息 没有在 AS内传播 Router1#ping #测试结果不通,原因同上 34 6.10.3 操作步骤 3. 查看路由信息 , 确定其认证方式 (1)查看 Router1的路由表信息 Router1#show ip route Gateway of last resort is not set /24 is subnetted, 1 subnets C is directly connected, Serial1/0 /24 is subnetted, 1 subnets C is directly connected, FastEthernet0/0 /24 is subnetted, 1 subnets O IA 110/128 via , 00:06:18, Serial1/0 从上面显示的信息可知,对于 Router1来说,通过 OSPF协议学习获得了 1条区域外部路由: ,但不包括到 /24、/24、 /24的路由。 35 6.10.3 操作步骤 3. 查看路由信息 , 确定其认证方式 (1)查看 Router1的路由表信息 Router1# show ip ospf database OSPF Router with ID () (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 1394 0x80000003 0x0021E7 3 659 0x80000003 0x00D841 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 655 0x80000001 0x004972 Router1的 OSPF数据库显示, Router1收到了 1条区域外部的网络汇总 LSA( 3类 LSA),它们是由 ABR( Router2)传入的。因为Router3在 /24、 /24、 /24上没有启用 OSPF协议,这些区域 1中的网络地址没有传入区域 0。 36 6.10.3 操作步骤 3. 查看路由信息 , 确定其认证方式 (2) 查看 Router2的 OSPF路由信息 Router2#show ip route Gateway of last resort is not set /24 is subnetted, 1 subnets C is directly connected, Serial0/1 /24 is subnetted, 1 subnets O 110/65 via , 02:19:46, Serial0/1 /24 is subnetted, 1 subnets C is directly connected, Serial0/0 从上面显示的信息可知, Router2通过 OSPF协议获得了 1条路由:。 37 6.10.3 操作步骤 3. 查看路由信息 , 确定其认证方式 (2) 查看 Router2的 OSPF路由信息 Router2#show ip ospf database OSPF Router with ID () (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 1414 0x80000007 0x0019EB 3 437 0x80000007 0x00D045 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 437 0x80000005 0x004176 Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 437 0x80000007 0x008E5E 2 355 0x80000006 0x00429F 2 38 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Ch

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论