
单区域OSPF协议及SPF算法(共21页).ppt
19页北京八维网络工程学院路由原理 第二课 单区域OSPF协议及SPF算法2021/11/17北京八维网络工程学院课程目标 通过本课的学习,让学生掌握OSPF的特性,OSPF单区域基本配置,并了解spf算法的特点2021/11/17北京八维网络工程学院本课内容 :单区域OSPF协议的配置以及工作机制 :什么是最短路径优先算法(SPF)2021/11/17北京八维网络工程学院OSPF 单区域配置2021/11/17北京八维网络工程学院router ospf process-id vrf vpn-name Router(config)# 开启OSPF路由进程OSPF基本配置network ip-address wildcard-mask area area-idRouter(config-router)# 定义OSPF将运行在哪个接口Router(config-if)#ip ospf process-id area area-id secondaries none 在指定的接口启用OSPF2021/11/17北京八维网络工程学院单区域实验要求任务:OSPF单区域的配置配置loopback地址作为路由器的ID配置OSPF的进程并在相应的接口上启用 完成标准可以ping通各路由器的loopback地址show run时可以查看到每台路由器所属的区域2021/11/17北京八维网络工程学院OSPF Router IDl运行OSPF的路由器之间是通过OSPF的router ID 来相互识别的lLSDBs 使用OSPF router ID 来区分路由器l默认,OSPF 的router ID 是使用被激活的接口的最高的ip地址l如果有loopback interface 那么它将成为OSPF router ID 如果有多个loopback interface 那么将选择其中ip地址最大的l可以使用命令配置指定的 OSPF router-id2021/11/17北京八维网络工程学院Router(config)#interface loopback 0 如果OSPF的进程已经运行的时候,想更改Router ID 则必须要重新启动OSPF的进程,才能使新的Router ID 生效Loopback Interfaces2021/11/17北京八维网络工程学院router-id ip-address 配置OSPF router-id 命令Router(config-router)#Router(config)#router ospf 1Router#clear ip ospf processclear ip ospf process Router#2021/11/17北京八维网络工程学院OSPF Router ID 验证RouterB#sh ip ospf Routing Process ospf 50 with ID 10.64.0.2 Number of areas in this router is 2. 2 normal 0 stub 0 nssa Number of areas transit capable is 0 External flood list length 0 Area BACKBONE(0) Area BACKBONE(0) Area has no authentication SPF algorithm last executed 00:01:25.028 ago SPF algorithm executed 7 times Area 1 Number of interfaces in this area is 1 Area has no authentication SPF algorithm last executed 00:00:54.636 ago SPF algorithm executed 3 times2021/11/17北京八维网络工程学院show ip protocols Router#OSPF的检验show ip route ospf process-id Router#show ip ospf interface type numberRouter#2021/11/17北京八维网络工程学院show ip ospf Router#OSPF 的检验show ip ospf neighbor type number neighbor-id detailRouter#2021/11/17北京八维网络工程学院例: show ip route ospfRouterA#show ip route ospf 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masksO IA 10.2.1.0/24 110/782 via 10.64.0.2, 00:03:05, FastEthernet0/0RouterA#2021/11/17北京八维网络工程学院例:show ip ospf interfaceRouterA#show ip ospf interface fastEthernet 0/0FastEthernet0/0 is up, line protocol is up Internet Address 10.64.0.1/24, Area 0 Process ID 1, Router ID 10.64.0.1, Network Type BROADCAST, Cost: 1 Transmit Delay is 1 sec, State DROTHER, Priority 0 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:04 Supports Link-local Signaling (LLS) Index 1/1, flood queue length 0 Next 0 x0(0)/0 x0(0) Last flood scan length is 1, maximum is 4 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 10.64.0.2 (Designated Router) Suppress hello for 0 neighbor(s)2021/11/17北京八维网络工程学院例: The show ip ospf neighbor RouterB# show ip ospf neighborNeighbor ID Pri State Dead Time Address Interface10.64.0.1 0 FULL/DROTHER 00:00:30 10.64.0.1 FastEthernet0/010.2.1.1 0 FULL/ - 00:00:34 10.2.1.1 Serial0/0/1RouterB# show ip ospf neighbor detail In the area 0 via interface FastEthernet0/0 Neighbor priority is 0, State is FULL, 16 state changes In the area 1 via interface Serial0/0/1 Neighbor priority is 0, State is FULL, 6 state changes2021/11/17北京八维网络工程学院Dijkstra算法 Dijkstra算法是路由表计算的依据,通过Dijkstra算法可以得到有关网络节点的最短路径树,然后由最短路径优先树得到路由表。
SPF算法有时也被称为Dijkstra算法,这是因为最短路径优先算法SPF是Dijkstra发明的2021/11/17北京八维网络工程学院Dijkstra算法lSPF算法将每一个路由器作为根(ROOT)来计算其到每一个目的地路由器的距离,每一个路由器根据一个统一的数据库会计算出路由域的拓扑结构图,该结构图类似于一棵树,在SPF算法中,被称为最短路径树l在OSPF路由协议中,最短路径树的树干长度,即OSPF路由器至每一个目的地路由器的距离,称为OSPF的Cost2021/11/17北京八维网络工程学院SPF 算法2021/11/17北京八维网络工程学院修改链路成本 CISCO IOS 用公式 108带宽 来自动确认链路成本:传输介质成本56kbit/s链路1785T1(1.544Mbit/s)64E1(2.048Mbit/s)484Mbit/s令牌环25以太网1016Mbit/s令牌环6100Mbit/s快速以太网,FDDI12021/11/17。
