COST value 1. Topology: 2. Configuration and Description: 1. Configure the IP address and ospf protocol of each interface. I used an R0 router to configure a frame relay switch. This helps us better understand frame relay. Note: When R1 and R4 use the FR interface, you can define the interface type ip ospf network broadcast or manually specify the neighbors of the two interfaces. Otherwise, the neighbors may fail. 2. Then we can manually specify the cost value through the interfaces of each route. The command is as follows: ip ospf cost note: the default COST value of the Ethernet port is 1. The default value of the wide area network port is 64. (the default value of ospf is 100 divided by the interface bandwidth of 1.544 = 64. You can go to the show interface for query .) When a router source interface is connected to another network, the COST value of this interface must be taken as the path orientation. For example, in R3, S1/0 and S1/1 are not manually specified if S1/0. The default value is 64. Then, the interface S1/0 is not used for the route from R3 to another route. It calculates small COST interfaces with SPF. Www.2cto.com 3. Let's take a look at the COST value comparison between R3 and 192.168.1.0: number path COST value 1R3 ------> R2 ------> R1 ------> destination network 132R3 ------> R2 ------> R4 ------> R1 ------> destination network 73R3 ------> R4 ------> R1 ------> destination network 84R3 ------> R4 ------> R2 ------> R1 ------> target network 18 4. analyze cost of Number 2 through common sense, the route number 2 should be taken, but it is not. Let's take a look at R3's route: R3 # show ip routeCodes: C-connected, S-static, R-RIP, m-mobile, B-Border Gateway (BGP) D-VPN, EX-VPN external, 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, su-IS summary, L1-IS level-1, l2-IS level-2 ia-IS inter area, *-candidate default, U-per-user static route o-ODR, p-periodic downloaded static route www.2cto.com Gateway of last resort is not set 172.16.0.0/30 is sub Netted, 5 subnetsO IA 172.16.255.0 [110/12] via 172.16.00005, 00:00:02, Serial1/0C 172.16.00004 is directly connected, Serial1/0C 172.16.00008 is directly connected, serial1/1O IA 172.16.000012 [110/6] via 172.16.00005, 00:00:02, Serial1/0O 172.16.000016 [110/4] via 172.16.00005, 00:00:02, Serial1/0O IA 192.168.1.0/24 [110/7] via 172.16.00005, 00:00:02, serial1/0 5. Let's take a look at traceroute: R3 # traceroute 1 92.161.0type escape sequence to abort. tracing the route to 192.168.1.0 1 172.16.20.5 52 msec 68 msec 24 msec 2 172.16.255.1 16 msec 20 msec 24 msec6, directly thrown to R1 after finding R2, instead of following the CIDR Block 172.16.255.0, the COST value is 10. What is the reason for going to R4 (this path is also calculated by SPF): When R3 forwards the data packet to R2, R2 finds that the data packet is sent to other networks. Therefore, R2 will not forward data packets to other routers in the same region. Because R2 itself is an ABR, he thinks that packets arriving in other regions need to be directly forwarded to the backbone region. And you happen to be connected to the backbone area. Therefore, R2 forwards data packets directly to the R1 router in the backbone area. For this reason, the routes we view are inconsistent with the paths of the actually forwarded packets. 7. Next let's take a look at the R3-R2-R4 (the original COST is: 4, because I defined R2 F0/0 COST as 2, note: this COST is not 1, because Ethernet it will be calculated according to the interface, not to select the smallest COST value of the network segment to stack the path), R3-R4 (originally COST is 5 ). We can change the f0/0 cost value of R2 to 3. In this case, both are 5. After the change. Let's take a look at show ip route: www.2cto.com R3 # show ip routeCodes: C-connected, S-static, R-RIP, M-mobile, B-BGP D-VPN, EX-OSPF external, 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, su-IS summary, L1-IS level-1, l2-IS level-2 ia-IS inter area, *-candidate de Fault, U-per-user static route o-ODR, P-periodic downloaded static route Gateway of last resort is not set 172.16.0.0/30 is subnetted, 5 subnetsO IA versions [110/12] via 172.16.20.5, 00:00:04, Serial1/0C connector is directly connected, Serial1/0C connector is directly connected, Serial1/1O IA 172.16.20.12 [110/7] via 172.16.20.10, 00:00:04, Serial1/1 [110/7] via 172.16.20.5, 00:00:04, Serial1/0O 172.16.000016 [110/5] via 172.16.00005, 00:00:04, Serial1/0O IA 192.168.1.0/24 [110/8] via 172.16.000010, 00:00:04, Serial1/1 [110/8] via 172.16.00005, 00:00:04, serial1/0R3 # www.2cto.com found that two paths of Server Load balancer appear in the segment 192.168.1.0. Summary: OSPF metric (cost) value: only the minimum Metrics value of the same network is extracted, and the COST value is accumulated with the self-calculated link. Note that if this router is a source address. Then, the route to the router selects the interface with the smallest COST value. The Ethernet link does not select the minimum value of the same network. It depends on the COST value of the interface from which it goes. OSPF can use the COST value of the modified interface for Link balancing.