Single-Area OSPF Link


some text




Single-Area OSPF Link Costs and Interface Priorities 
Learning Objectives 

<> Configure single-area OSPF on a router 
<> Advertise loopback interfaces into OSPF 
<> Verify OSPF adjacencies 
<> Verify OSPF routing information exchange 
<> Modify OSPF link costs 
<> Change interface priorities 
<> Utilize debugging commands for troubleshooting OSPF 


Step 1: Addressing 
Using the addressing scheme in the diagram, apply IP addresses to the Fast 
Ethernet interfaces on R1, R2, and R3. Create Loopback1 on R1, Loopback2 
on R2, and Loopback3 on R3 and address them according to the diagram.

R1# configure terminal R1(config)# interface Loopback1 
R1(config-if)# description Engineering Department 
R1(config-if)# ip address 10.1.1.1 255.255.255.0 
R1(config-if)# exit 
R1(config)# interface FastEthernet0/0 
R1(config-if)# ip address 10.1.200.1 255.255.255.0 
R1(config-if)# no shutdown

R2# configure terminal 
R2(config)# interface Loopback2 
R2(config-if)# description Marketing Department 
R2(config-if)# ip address 10.1.2.1 255.255.255.0 
R2(config-if)# exit R2(config)# interface FastEthernet0/0 
R2(config-if)# ip address 10.1.200.2 255.255.255.0 
R2(config-if)# no shutdown 

R3# configure terminal 
R3(config)# interface Loopback3 
R3(config-if)# description Accounting Department 
R3(config-if)# ip address 10.1.3.1 255.255.255.0 
R3(config-if)# exit R3(config)# interface FastEthernet0/0 
R3(config-if)# ip address 10.1.200.3 255.255.255.0 
R3(config-if)# no shutdown 

********************************************************************************
Leave the switch in its default (blank) configuration. By default, all switchports 
are in VLAN1 and are not administratively down.

Also configure the serial interfaces with the IP addresses given in the diagram. 
Remember to add the clockrate command where appropriate.
********************************************************************************

R1(config)# interface Serial 0/0  
R1(config-if)# ip address 10.1.100.1 255.255.255.0 
R1(config-if)# clockrate 64000 
R1(config-if)# no shutdown 
 
R2(config)# interface Serial 0/0  
R2(config-if)# ip address 10.1.100.2 255.255.255.0 
R2(config-if)# no shutdown


Step 2: Adding Physical Interfaces to OSPF

R1(config)# router ospf 1 
R1(config-router)# network 10.1.100.0 0.0.0.255 area 0 
R1(config-router)# network 10.1.200.1 0.0.0.0 area 0 
R1(config-router)# end R1# 

R2(config)# router ospf 1 
R2(config-router)# network 10.1.100.0 0.0.0.255 area 0 
R2(config-router)# network 10.1.200.0 0.0.0.255 area 0 
 
R3(config)# router ospf 1 
R3(config-router)# network 10.1.200.0 0.0.0.255 area 0 


Step 3: OSPF show Commands 
Some show commands are very useful for OSPF. The show ip protocols
command displays basic high-level routing protocol information. The following 
shows information about OSPF:

R1#show ip protocols Routing Protocol is "ospf 1" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 10.1.1.1 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 10.1.100.0 0.0.0.255 area 0 10.1.200.1 0.0.0.0 area 0 Reference bandwidth unit is 100 mbps Routing Information Sources: Gateway Distance Last Update Distance: (default is 110) R1#
Another useful command when looking at OSPF is show ip ospf:
R1#show ip ospf Routing Process "ospf 1" with ID 10.1.1.1 Start time: 01:04:53.288, Time elapsed: 00:19:38.668 Supports only single TOS(TOS0) routes Supports opaque LSA Supports Link-local Signaling (LLS) Supports area transit capability Router is not originating router-LSAs with maximum metric Initial SPF schedule delay 5000 msecs Minimum hold time between two consecutive SPFs 10000 msecs Maximum wait time between two consecutive SPFs 10000 msecs Incremental-SPF disabled Minimum LSA interval 5 secs Minimum LSA arrival 1000 msecs LSA group pacing timer 240 secs Interface flood pacing timer 33 msecs Retransmission pacing timer 66 msecs Number of external LSA 0. Checksum Sum 0x000000 Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Number of areas transit capable is 0 External flood list length 0 Area BACKBONE(0) Number of interfaces in this area is 2 Area has no authentication SPF algorithm last executed 00:15:21.192 ago SPF algorithm executed 7 times Area ranges are Number of LSA 4. Checksum Sum 0x02F33E Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 R1#
Notice the router ID listed in the show output. The router ID of R1 is 10.1.1.1, even though we have not added this loopback into the OSPF process. The router chooses the router ID using the highest IP on a loopback interface when OSPF is configured. If an additional higher IP address loopback interface is added after OSPF is turned on, it does not become the router ID unless the router is reloaded. If there are no loopback interfaces present on the router, the router takes the highest available IP address on an interface. If there are no IP addresses assigned to interfaces, the OSPF process does not start.
R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 10.1.2.1 1 FULL/BDR 00:00:32 10.1.200.2 FastEthernet0/0 10.1.3.1 1 FULL/DROTHER 00:00:38 10.1.200.3 FastEthernet0/0 10.1.2.1 0 FULL/ - 00:00:37 10.1.100.2 Serial0/0 R1# ------------------------------------------------------------------------------------- <> If you need more detail, use show ip ospf neighbor detail, which shows more than just the standard one-line summaries of neighbors ------------------------------------------------------------------------------------- R1#show ip ospf interface fastEthernet 0/0 FastEthernet0/0 is up, line protocol is up Internet Address 10.1.200.1/24, Area 0 Process ID 1, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) 10.1.1.1, Interface address 10.1.200.1 Backup Designated router (ID) 10.1.2.1, Interface address 10.1.200.2 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 2/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 4 msec Neighbor Count is 2, Adjacent neighbor count is 2 Adjacent with neighbor 10.1.2.1 (Backup Designated Router) Adjacent with neighbor 10.1.3.1 Suppress hello for 0 neighbor(s) R1# ------------------------------------------------------------------------------------- <> Another useful command is show ip ospf database, which displays the various LSAs in the OSPF database, organized by area and type. ------------------------------------------------------------------------------------- R1#show ip ospf database OSPF Router with ID (10.1.1.1) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 10.1.1.1 10.1.1.1 1236 0x80000005 0x00B61F 3 10.1.2.1 10.1.2.1 1100 0x80000004 0x00B91A 3 10.1.3.1 10.1.3.1 993 0x80000003 0x0091CC 1 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.1.200.1 10.1.1.1 984 0x80000003 0x00EA3D R1#
Step 4: Adding Loopback Interfaces to OSPF All three routers have loopback interfaces, but they are not yet advertised in the routing process. You can verify this with show ip route on your three routers.
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP 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-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 3 subnets C 10.1.1.0 is directly connected, Loopback0 C 10.1.100.0 is directly connected, Serial0/0 C 10.1.200.0 is directly connected, FastEthernet0/0 R1# R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP 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-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 3 subnets C 10.1.2.0 is directly connected, Loopback2 C 10.1.100.0 is directly connected, Serial0/0 C 10.1.200.0 is directly connected, FastEthernet0/0 R2# R3#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP 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-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 3 subnets C 10.1.3.0 is directly connected, Loopback3 O 10.1.100.0 [110/74] via 10.1.200.2, 00:56:20, FastEthernet0/0 [110/74] via 10.1.200.1, 00:56:20, FastEthernet0/0 C 10.1.200.0 is directly connected, FastEthernet0/0 R3#
<> For each of the routers, the only loopback address that comes up is the locally connected one. We can add these into the routing process with the network command previously used to add the physical interfaces. R1(config)# router ospf 1 R1(config-router)# network 10.1.1.0 0.0.0.255 area 0 R2(config)# router ospf 1 R2(config-router)# network 10.1.2.0 0.0.0.255 area 0 R3(config)# router ospf 1 R3(config-router)# network 10.1.3.0 0.0.0.255 area 0 <> Verify that these networks have been added to the routing table using the show ip route command:
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP 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-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks O 10.1.2.1/32 [110/11] via 10.1.200.2, 00:04:04, FastEthernet0/0 O 10.1.3.1/32 [110/11] via 10.1.200.3, 00:04:04, FastEthernet0/0 C 10.1.1.0/24 is directly connected, Loopback0 C 10.1.100.0/24 is directly connected, Serial0/0 C 10.1.200.0/24 is directly connected, FastEthernet0/0 R1#
<> Now you can see the loopbacks of the other routers, but their subnet mask is incorrect, because the default network type on loopback interfaces advertises them as /32 (host) routes. To change this, go to the interface configuration mode of each loopback and use the ip ospf network point-to-point command. After the routes propagate, you see the correct subnet masks associated with those loopback interfaces. R1(config)# interface loopback1 R1(config-if)# ip ospf network point-to-point R2(config)# interface loopback2 R2(config-if)# ip ospf network point-to-point R3(config)# interface loopback3 R3(config-if)# ip ospf network point-to-point
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP 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-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 5 subnets O 10.1.3.0 [110/11] via 10.1.200.3, 00:02:22, FastEthernet0/0 O 10.1.2.0 [110/11] via 10.1.200.2, 00:02:22, FastEthernet0/0 C 10.1.1.0 is directly connected, Loopback0 C 10.1.100.0 is directly connected, Serial0/0 C 10.1.200.0 is directly connected, FastEthernet0/0 R1#
Step 5: Modifying Link Costs in OSPF When you use the show ip route command on R1, you see that the most direct route to R2’s loopback is through its Ethernet connection. Next to this route is a pair in the form [administrative distance / metric ]. The administrative distance is 110, the default administrative distance of OSPF on Cisco routers. The metric depends on the link type. OSPF picks the route with the lowest metric, which is a sum of link costs. You can modify a single link cost by using the interfacelevel command ip ospf cost cost. Use this on both ends of the link. In the following commands, the link cost of the Ethernet connection between the three routers is changed to a cost of 50. Notice the change in the metrics in the routing table. R1(config)# interface fastEthernet 0/0 R1(config-if)# ip ospf cost 50 R2(config)# interface fastEthernet 0/0 R2(config-if)# ip ospf cost 50 R3(config)# interface fastEthernet 0/0 R3(config-if)# ip ospf cost 50
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP 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-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 5 subnets O 10.1.3.0 [110/51] via 10.1.200.3, 00:00:23, FastEthernet0/0 O 10.1.2.0 [110/51] via 10.1.200.2, 00:00:23, FastEthernet0/0 C 10.1.1.0 is directly connected, Loopback0 C 10.1.100.0 is directly connected, Serial0/0 C 10.1.200.0 is directly connected, FastEthernet0/0 R1#
<()> For reference, here are some default link costs (taken from Cisco.com): • 56-kbps serial link—Default cost is 1785. • 64-kbps serial link—Default cost is 1562. • T1 (1.544-Mbps serial link)—Default cost is 64. • E1 (2.048-Mbps serial link)—Default cost is 48. • 4-Mbps Token Ring—Default cost is 25. • Ethernet—Default cost is 10. • 16-Mbps Token Ring—Default cost is 6. • FDDI—Default cost is 1. • X25—Default cost is 5208. • Asynchronous—Default cost is 10,000. • ATM— Default cost is 1. Step 6: Modifying Interface Priorities If you use the show ip ospf neighbor detail on any of the routers, you see that for the Ethernet network, R3 is the DR (designated router) and R2 is the BDR (backup designated router). This is determined by the interface priority for all routers in that network, which you see in the show output R1(config)# interface fastEthernet 0/0 R1(config-if)# ip ospf priority 10 R2(config)# interface fastEthernet 0/0 R2(config-if)# ip ospf priority 5
R1#show ip ospf neighbor detail Neighbor 10.1.2.1, interface address 10.1.200.2 In the area 0 via interface FastEthernet0/0 Neighbor priority is 5, State is FULL, 6 state changes DR is 10.1.200.1 BDR is 10.1.200.2 Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:32 Neighbor is up for 01:48:28 Index 2/2, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec Neighbor 10.1.3.1, interface address 10.1.200.3 In the area 0 via interface FastEthernet0/0 Neighbor priority is 1, State is FULL, 6 state changes DR is 10.1.200.1 BDR is 10.1.200.2 Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:38 Neighbor is up for 01:47:28 Index 3/3, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec Neighbor 10.1.2.1, interface address 10.1.100.2 In the area 0 via interface Serial0/0 Neighbor priority is 0, State is FULL, 6 state changes DR is 0.0.0.0 BDR is 0.0.0.0 Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:35 Neighbor is up for 01:49:04 Index 1/1, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec R1#
Note: To make a router take over as DR, you may need to use the clear ip ospf process command on all your routers after changing the priorities.