# 10/11 (CEF/dijkstra algorithm/OSPF ###### tags: `Networking` `CCNA` [TOC] ## CEF(cisco express forwarding) CEF is a CISCO default Rule, the Rule is True. IF(CEF is True ){ it's not going to look up a routing table, it will only go one of these ways. } ![](https://i.imgur.com/lIWOWlZ.png) ### CEF == TRUE(default) ![](https://i.imgur.com/oAOHbpY.png) ### CEF == False ``` R1(config)#no ip cef R2(config)#no ip cef ``` ### Result 0/0 ![](https://i.imgur.com/HAduxJG.png) 0/1 ![](https://i.imgur.com/8B3CdHM.png) RIP-ECMP(equal cost multipathpaht routing) only consider the hop of numbers OSPF-ECMP, only consider the bandwidth EIGRP It consider a bandwidth, delay,reliability,cost and MTU. >![](https://i.imgur.com/EOnny8Y.png) >- Advantage: Load balance >- Disadvantage: It's going to increase the occurred rate of the out-of-order problem ## dijkstra algorithm dijkstra is to find the shortest path between any two vertex in the graph ## Find the shortest path from vertex A to every other vertex. ### example **TO get from A to C ![](https://i.imgur.com/cHQsxbC.png) ## Generate the table we use two list, one to keep track of the vertices that we visited and another to keep track of the vertices that we haven't visited yet. ![](https://i.imgur.com/NBuO6g8.png) Algorithm ``` let distance of start vertex from start vertex =0 let distance of all other vertices form start = infinity while 1 Visit the unvisited vertex with the smallest known distance from the start vertex For the current vertex examine its unvisited neighbourt from start vertex if(the calculated distance of a vertex is less than known distance){ update the shortest path distance } Update the previous vertex for each of the updated distances add the current vertex to the list of visited vertices Until all vertices visited ``` ## OSPF(Open Shortest Path First) cost -> dijkstra algorithm ![](https://i.imgur.com/mPrEGIK.png) ![](https://i.imgur.com/QRGG9Er.png) Configure OSFP R1 ``` r1(config)#router ospf 100 #A Process ID is a local remark, so each device can use a different Process ID r1(config-router)#network 12.0.0.0 0.0.0.255 area 0 ``` R2 ``` r2(config)#router ospf 100 r2(config-router)#network 12.0.0.0 0.0.0.255 area 0 r2(config-router)#network 23.1.0.0 0.0.0.255 area 0 ``` R3 ``` r3(config)#router ospf 100 r3(config-router)#network 23.1.0.0 0.0.0.255 area 0 ``` Wildcard mask: specify segment of IP address that needs to be checked, using deny or allow the IP whether it could go through or not. Result ![](https://i.imgur.com/5ohH62M.png) ad = 110 cost = 10**8 bps / bandwidth Ethernet = 10 mps ![](https://i.imgur.com/wcGavjy.png) 10**8 / 10 * 10\**6 = 10 one hop = 10 (cost) So, we could know there have two hops. ### Packet types 1.hello 2.Database Description 3.LSR(link state request) 4.LSU(link state update) 5.LSA(link state acknowlege) ### OSPF table neighbor table ``` r1(config)#do show ip ospf neighbor ``` ``` r2(config)#do show ip ospf database ``` ![](https://i.imgur.com/P6KgIWA.png) ---