OSPF邻居加密认证配置
OSPF协议原理及配置详解

OSPF协议原理及配置详解OSPF(Open Shortest Path First)是一种用于计算机网络中的内部网关协议(IGP),用于在大型网络中动态确定数据包的传输路径。
其算法基于Dijkstra最短路径算法,并支持IPv4和IPv6网络。
OSPF的工作原理如下:1. 链路状态数据库(Link State Database):每个OSPF路由器都维护着一个链路状态数据库,其中存储了它所连接的所有网络的信息,包括链路的状态、带宽、延迟等。
每个OSPF路由器通过发送链路状态更新(Link State Update)将自己的链路状态信息告知其他路由器。
2.路由器之间的邻居关系建立:OSPF路由器之间通过邻居发现过程建立邻居关系。
当一个OSPF路由器启动时,它会向网络广播HELLO消息来寻找其他路由器。
当两个路由器之间收到彼此的HELLO消息时,它们可以建立邻居关系。
3. 路由计算:每个OSPF路由器通过收集链路状态信息来计算最短路径。
路由器将链路状态信息存储在链路状态数据库中,并使用Dijkstra 最短路径算法来确定到达目标网络最短路径。
4.路由更新:当链路状态发生变化时,OSPF路由器将会发送更新消息通知其他路由器。
其他路由器接收到更新消息后,会更新自己的链路状态数据库,并重新计算最短路径。
OSPF的配置如下:1. 启用OSPF协议:在路由器配置模式下使用"router ospf"命令启用OSPF协议。
2. 配置区域(Area):将网络划分为不同的区域。
在配置模式下使用"area <区域号> range <网络地址> <网络掩码>"命令将网络地址加入到区域中。
3. 配置邻居:使用"neighbor <邻居IP地址>"命令来配置OSPF邻居关系。
邻居IP地址可以手动配置或通过HELLO消息自动发现。
ospf全部知识点总结

ospf全部知识点总结一、OSPF的基本概念1.1 OSPF的发展历程OSPF是由IETF(Internet Engineering Task Force)定义的开放标准,最初在RFC 1131中提出,随后在RFC 1247和RFC 1245中进行了修订,成为了OSPFv2的标准。
OSPFv3则是OSPF在IPv6环境下的扩展,定义在RFC 5340中。
OSPF发展至今已经成为互联网上使用最广泛的动态路由协议之一。
1.2 OSPF的基本特点OSPF是一种链路状态路由协议,和距离矢量路由协议相比,它具有更快的收敛速度、更灵活的路由选择和更好的可扩展性。
OSPF使用SPF算法计算最短路径,能够支持VLSM 和CIDR的IP地址分配,并且提供了可靠的路由数据交换。
1.3 OSPF的组成部分OSPF由路由器、链路、网络和邻居关系组成。
路由器负责OSPF协议的计算和路由表的更新,链路是指连接路由器之间的物理或逻辑链路,网络是指可以发送OSPF Hello消息的链路,邻居关系是指路由器之间建立的可靠的邻居关系,用于交换路由信息。
1.4 OSPF的工作原理OSPF使用Hello消息来发现邻居,并且建立邻居关系。
建立邻居关系后,路由器之间会交换LSA(Link State Advertisement)来收集网络拓扑信息。
然后使用SPF算法计算最短路径,并且更新路由表。
最后,OSPF使用LSA更新来维护网络状态,并且保证网络的稳定性。
二、OSPF的工作原理2.1 OSPF消息格式OSPF消息有Hello消息、LSA消息和LSU(Link State Update)消息。
Hello消息用于邻居发现和建立邻居关系,LSA消息用于交换路由信息,LSU消息用于路由表的更新。
2.2 OSPF的邻居关系OSPF使用Hello消息来发现邻居,并且建立邻居关系。
当路由器接收到相邻路由器的Hello消息,并且满足了协议规定的条件,邻居关系就会建立成功。
ospf

ospf:收集链路状态信息完全了解网络拓扑,使用spf算法自主的计算路径。
ospf特性:open 无类手动汇总层次化结构收敛快速触发更新等价负载均衡邻居表(邻接关系数据库):领居建立过程:init state:一方组播hello包two-way state:双方收到hello包形成邻居关系exstart state:交换bdb包选举dr/bdrexchange state:交换bdb包交换lsdb摘要。
loading state:交换lsufull state:完全邻接拓朴表(lsdb,链路状态数据库):同一区域内每个路由器的lsdb一致lsa:包含接口ip前缀、开销、优先级,包含于LSU中,遵循水平分割原则。
lsa序列号:lsa的生存周期为60分钟,30分钟定期刷新,没有被刷新lsa将会在60分钟后被丢弃ospf的五种包:hello、dbd、lsr、lsu、lsackdbd、lsr、lsu需lsack确认路由表区域:CISCO建议每个区域的路由器不应超过50台。
双层结构:中转区域:又称骨干区域或核心区域(area 0),用于流量的中转没有终端用户。
常规区域:连接终端用户用于数据的收发。
常规区域必须与骨干区域直连,常规区域间不能有直连链路。
常规区域包括标准区域、末节区域、绝对末节区域、次末节区域。
区域的设计:凭经验公司:核心层做area 0,汇聚和接入做常规区域整个ospf网络在同一个AS中ospf中的路由器指的是:接口骨干路由器:位于area 0abr:abr连接的区域数不应超过3个,abr也可以是asbrasbr:重分发配置ospf:r1(conftig)# router ospf 1r1(config)# network …………area 0(等同于ip ospf 1 area 0)验证OSPF:sh ip protocolssh ip router ospfsh ip ospf interfacesh ip ospfsh ip ospf neighbor detaildebug ip ospf eventsdebug ip ospf adjospf的网络类型(dead time=4*hello time)点到点(PPP、HDLC串口):直接邻接,hello-time 10s2、广播(LAN):选dr/bdr,hello-time 10sdrother与dr/bdr:邻接;drother之间:领居dr组播224.0.0.5;drother组播224.0.0.6dr的轮选:数值最大接口优先级(默认值1)ip ospf priority ?2、rid:环回地址、物理接口ip地址router-id ip address(次于优先级,ip地址可以为存在或不存在,不能指定其他路由器已有IP)dr稳定性,先到先得clear ip ospf process(清除ospf进程让dr重选;清除ospf进程邻居关系重新形成)3、ospf在nbma网络运行的公有模式:1、nbma:默认模式hello time 30s在hub-spoke拓朴,选dr/bdr,同一子网,中心路由器为dr/bdr边缘路由器(spoke)相互之间要做dlci的映射(dlci复用)中心路由器手动指定领居(如:nei 192.168.1.2 priority 0把spoke优先级设为0)2、p2m:hello time 30s同一子网,不选dr/bdr,多点fr子接口无需修改网络类型,邻接关系可以正常建立,但路由就没法学到,因此建议在多点fr子接口修改网络类型。
路由器交换机配置任务4.3OSPF基于区域的MD5认证

二.接口认证配置命令
Router (config)#interface 接口名称 Router (config-if)#ip ospf authentication [message-digest] Router (config-if)#ip ospf message-digest-key 1 md5 密码
四.OSPF基于接口的MD5认证配置示例
r0(config)#interface s0/0/0 r0(config-if)#ip ospf authentication message-digest //验证方式为MD5 r0(config-if)#ip ospf message-digest-key 1 md5 cisco //验证密码为cisco
r1(config)#interface s0/0/0 r1(config-if)#ip ospf authentication message-digest //验证方式为MD5 r1(config-if)#ip ospf message-digest-key 1 md5 cisco //验证密码为cisco
路由器交换机配置任务4.3OSPF基于区域的MD5认证
【实训目的】
配置基于区域的OSPF MD5认证,提高网络安全性。
【实训任务】
1.配置OSPF路由协议。 2.配置基于区域的OSPF MD5 认证。 3.验证测试OSPF MD5 认证。
OSPF认证
区域认证
一.区域认证配置命令
Router(config)#router ospf 进程号 Router (config-router)#area 区域号 authentication [message-digest] // 带上message-digest选项,加密方式为MD5;省略message-digest选项, 则加密方式为明文。 Router (config)#interface 接口名称 Router (config-if)#ip ospf message-digest-key 1 md5 密码 //在接口下应用认证,并设置验证密码。
OSPF协议原理与配置详解

快速响应: 如果DR 由于某种故障而失效,这时必须重新选举DR,并与之同步。这需要较长的时间,在这段时间内,路由计算是不正确的。为了能够缩短这个过程,OSPF提出了BDR(Backup Designated Router)的概念。 BDR 实际上是对DR 的一个备份,在选举DR 的同时也选举出BDR,BDR 也和本网段内的所有路由器建立邻接关系并交换路由信息。当DR 失效后,BDR 会立即成为DR,由于不需要重新选举,并且邻接关系事先已建立,所以这个过程是非常短暂的。 当然这时还需要重新选举出一个新的BDR,虽然一样需要较长的时间,但并不会影响路由计算。
OSPF和RIP的比较(1)
向本自治系统中所有路由器发送信息。这里使用的方法是洪泛法(flooding),这样,最终整个区域中所有的路由器都得到了这个信息的一个副本。而RIP协议是仅仅向自己相邻的几个路由器发送信息。 发送的信息就是与本路由器相邻的所有路由器的链路状态,这是路由器所知道的部分信息。链路状态就是说明本路由器都和哪些路由器相邻,以及该链路的“度量”。OSPF将这个“度量”用来表示费用、距离、时延、带宽等等。而RIP协议发送的信息是:“到所有网络的距离和下一跳路由器”。
OSPF和RIP的比较(2)
只有当链路状态发生变化时,路由器才用洪泛法向所有路由器发送此信息。而RIP不管网络拓扑有无发生变化,路由器之间都要定期交换路由器表的信息。
基本的OSPF协议
Router ID:一个32bit的无符号整数,是一台路由器的唯一标识,在整个自治系统内惟一。一般是手工配置。 有些厂家路由器支持自动从当前所有接口的IP地址自动选举一个IP地址作为ROUTER ID. OSPF报文直接封装在IP报文中传输。IP头部中协议号为89。 。
区域验证

思科OSPF区域认证2008-02-16 14:21命令:--------------------------------1、明码认证:Router1(config)# area [区域ID] authenticationRouter1(config)# int 接口Router1(config-if)# ip ospf authentication-key [密码]2、加密认证(MD5):Router1(config)# area [区域ID] authentication message-digestRouter1(config)# int 接口Router1(config-if)# ip ospf message-digest-key [Key-ID] authentication [密码] //Key-ID:密匙链ID,取值1-255,验证双方需一样具体实例:----------------------------连接如图区域0 明文认证区域1 MD5认证R1 的配置如下interface Loopback0ip address 1.1.1.1 255.255.255.0!interface FastEthernet0/0no ip addressshutdownduplex autospeed auto!interface Serial1/0no ip addressshutdownno fair-queueserial restart-delay 0!interface Serial1/1ip address 12.1.1.1 255.255.255.0ip ospf authentication-key 123serial restart-delay 0clock rate 64000!interface Serial1/2no ip addressshutdownserial restart-delay 0!interface Serial1/3no ip addressshutdownserial restart-delay 0!router ospf 1log-adjacency-changesarea 0 authenticationnetwork 1.1.1.1 0.0.0.0 area 0 network 12.1.1.1 0.0.0.0 area 0 !ip classlessip http server!!line con 0exec-timeout 0 0logging synchronousline aux 0line vty 0 4login!endR2 的配置如下:interface FastEthernet0/0no ip addressshutdownduplex autospeed auto!interface Serial1/0ip address 12.1.1.2 255.255.255.0 ip ospf authentication-key 123 serial restart-delay 0clock rate 64000!interface Serial1/1ip address 23.1.1.1 255.255.255.0ip ospf authentication-key 1 md5 123 serial restart-delay 0clock rate 64000!interface Serial1/2no ip addressshutdownserial restart-delay 0!interface Serial1/3no ip addressshutdownserial restart-delay 0!router ospf 1log-adjacency-changesarea 0 authenticationarea 1 authentication message-digest network 12.1.1.2 0.0.0.0 area 0 network 23.1.1.1 0.0.0.0 area 1!ip classlessip http server!!line con 0exec-timeout 0 0logging synchronousline aux 0line vty 0 4login!endR3 的配置如下:interface Loopback0ip address 3.3.3.3 255.255.255.0!interface FastEthernet0/0no ip addressshutdownduplex autospeed auto!interface Serial1/0ip address 23.1.1.2 255.255.255.0ip ospf authentication-key 1 md5 123 serial restart-delay 0clock rate 64000!interface Serial1/1no ip addressshutdownserial restart-delay 0!interface Serial1/2no ip addressshutdownserial restart-delay 0!interface Serial1/3no ip addressshutdownserial restart-delay 0!router ospf 1log-adjacency-changesarea 1 authentication message-digest network 3.3.3.3 0.0.0.0 area 1 network 23.1.1.2 0.0.0.0 area 1!ip classlessip http server!!line con 0exec-timeout 0 0logging synchronousline aux 0line vty 0 4login!end。
OSPF Authentication配置详解

OSPF Authentication配置详解在IOS12.0以前,如果在一个OSPF Area内任意一个接口上配置了认证,则所有area内的其它路由器的所有接口也必须配置认证。
在IOS12.0以后,允许在单独在一个接口上配置认证,与area内其它路由器无关。
命令语法:ip ospf authentication-key passwordip ospf message-digest-key key-id md5 passwordpassword:在特定接口、区域或Virtual Link上用于密码认证。
可以是1-8个字符串。
key-id:用于加密密码的密钥。
取值范围1-255。
key-id匹配检测是从小的ID到大的ID的。
大的ID被称为youngest-id。
key-id是基于接口、Virtual-link的,每个接口都有相应的一个key-id范围,相互之间key-id是分别开来的。
当ospf收到一个ospf packet时:1>检测packet中的认证类型与当前接口、链路或区域配置是否匹配。
0为无认证,1为明文认证,2为MD5认证。
2>检测packet中的密码是否匹配,如果是MD5认证则从key-id小的开始,找到一个匹配则结束。
无匹配则不能建立Adjacency关系。
链路两端必须配置相同的password和key-id。
Part I. AREA级明文认证!host r1description conn_to_r2ip add 192.168.1.1 255.255.255.0ip ospf authentication-key cisco!router ospf 100router-id 10.0.0.1net 192.168.1.0 0.0.0.255 area 0area 0 authentication!-------------------------------------------- !host r2!int s1/0description conn_to_r1ip add 192.168.1.2 255.255.255.0ip ospf authentication-key cisco!router ospf 100router-id 10.0.0.2net 192.168.1.0 0.0.0.255 area 0area 0 authentication!++++++++++++++++++++++++++++++service password-encryptionshow ip ospf neighbordebug ip ospf events++++++++++++++++++++++++++++++Part II. AREA级md5认证!host r1!int s1/0description conn_to_r2ip add 192.168.1.1 255.255.255.0ip ospf message-digest-key 1 md5 cisco!router ospf 100router-id 10.0.0.1net 192.168.1.0 0.0.0.255 area 0area 0 authentication message-digest!---------------------------------------------!int s1/0description conn_to_r1ip add 192.168.1.2 255.255.255.0ip ospf message-digest-key 1 md5 cisco!router ospf 100router-id 10.0.0.2net 192.168.1.0 0.0.0.255 area 0area 0 authentication message-digest!Part III. AREA级md5认证切换因为md5认证在收到时是从认证密码池中依次匹配密码的(密码ID从小到大),所以它可以同时配置多个密码,进而可以实现在多个密码中平滑的过度。
OSPF 的四种认证方式总结

OSPF 的四种认证方式OSPF的四种认证,基于区域的认证两种:简单口令认证,MD5。
基于链路的认证有两种:简单口令认证,MD5。
简单介绍一下:基于区域的简单口令认证:在R2上的配置如下:Router(config)#router ospf 100Router(config-router)#area 0 authenticationRouter(config)#int s1/3Router(config-if)#ip ospf authentication-key tyt在R3上的配置也是一样的,当你配置完一方时,邻居关系会断掉,另一方配置完后,邻居关系会重启,再者两边的密码一定要一样,不然不行。
基于区域的MD5认证:在R2上的配置如下:Router(config)#router ospf 100Router(config-router)#area 0 authentication message-digestRouter(config)#int s1/3Router(config-if)#ip ospf message-digest-key 1 md5 tyt在R3上的配置也是一样的,当你配置完一方时,邻居关系会断掉,另一方配置完后,邻居关系会重启,再者两边的密码一定要一样,不然不行。
基于链路的简单口令认证:在R2上的配置如下:Router(config)#int s1/3Router(config-if)#ip ospf authenticationRouter(config-if)#ip ospf authentication-key tyt这个很简单,在R3上的配置也是这样的基于链路的MD5认证的配置:在R2上的配置如下:Router(config)#int s1/3Router(config-if)#ip ospf authentication message-digestRouter(config-if)#ip ospf message-digest-key 1 md5 tyt其实在认证配置方面很简单!因为文档太小的话,文库会不认上传,所以在后面加些无关紧要的东西,可以删掉!实验 1-2:在NAT中使用Access List 和Route Maps【实验目的】:在本次实验中,你需要使用网络地址转换(NAT)去允许内网路由器(PxR3 和 PxR4)从TFTP服务器下载配置文件为了完成本次实验,你需要完成下列任务:∙建立在NAT中需要使用的访问控制列表∙在NAT中使用ROUTE-MAPS执行分开的并发地址转换。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验十三OSPF邻居加密认证配置
试验目的:
掌握OSPF的邻居加密认证配置
背景描述:
你是一名高级技术支持工程师,某企业的网络整个的网络环境是ospf。
为了安全起见,新加入的路由器要通过认证,请你给予支持。
试验设备:
RG-RSR20 二台、网线若干
试验拓扑图:
实验步骤及要求:
1、配置各台路由器用户名和接口IP地址,并且使用ping命令确认各路由器的直连口的互通性。
具体配置请参考试验十二
2、在R1上启动OSPF路由协议
R1(config)#router ospf 100
R1(config-router)#area 0 authentication message-digest
R1(config-router)#inter f0/0
R1(config-if)#ip osp message-digest-key 1 md5 ruijie
R1(config-if)#end
R1#
*Apr 10 20:09:23: %OSPFV2-5-NBRCHG: OSPF[100] Nbr[2.2.2.2-FastEthernet 0/0] Full to Down, InactivityTimer
3、在R2上启动OSPF路由协议
R2(config)#router ospf 100
R2(config-router)#area 0 authentication message-digest
R2(config-router)#inter f0/1
R2(config-if)#ip osp message-digest-key 1 md5 ruijie
R2(config-if)#end
R2#
*Apr 10 20:11:08: %OSPFV2-5-NBRCHG: OSPF[100] Nbr[1.1.1.1-FastEthernet 0/1] Loading to Full, LoadingDone
4、验证测试:(以R1为例)
R1#sho ip route
Codes: C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default
Gateway of last resort is no set
C 1.1.1.0/24 is directly connected, Loopback 0
C 1.1.1.1/32 is local host.
O 2.2.2.2/32 [110/1] via 12.1.1.2, 00:00:04, FastEthernet 0/0
C 12.1.1.0/24 is directly connected, FastEthernet 0/0
C 12.1.1.1/32 is local host.
R1#show ip ospf neighbor
OSPF process 100, 1 Neighbors, 1 is Full:
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 Full/BDR 00:00:37 12.1.1.2 FastEthernet 0/0
R1#show ip osp
Routing Process "ospf 100" with ID 1.1.1.1
Process uptime is 1 hour 23 minutes
Process bound to VRF default
Conforms to RFC2328, and RFC1583Compatibility flag is enabled
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
LsaGroupPacing: 240 secs
Number of incomming current DD exchange neighbors 0/5
Number of outgoing current DD exchange neighbors 0/5
Number of external LSA 0. Checksum 0x000000
Number of opaque AS LSA 0. Checksum 0x000000
Number of non-default external LSA 0
External LSA database is unlimited.
Number of LSA originated 3
Number of LSA received 20
Log Neighbor Adjency Changes : Enabled
Number of areas attached to this router: 1: 1 normal 0 stub 0 nssa Area 0 (BACKBONE)
Number of interfaces in this area is 2(2)
Number of fully adjacent neighbors in this area is 1 Area has message digest authentication
SPF algorithm last executed 00:07:16.730 ago
SPF algorithm executed 20 times
Number of LSA 3. Checksum 0x00a138
5、试验完成
【注意事项】
在接口上配置的认证密码一定要一致。