Lab - Single-Area OSPF link Costs and Interface Priroities

Topology

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: Configure addressing and loopbacks.

a. apply IP address on R1, R2, R3. Create loopback1 on R1, loopback2 on R2, loopback3 on R3.

R1#configure terminal

R1(config-if)#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 f0/0

R1(config-if)#ip address 10.1.200.1 255.255.255.0

R1(config-if)#no shutdown

 

R2#configure terminal

R2(config-if)#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 f0/0

R2(config-if)#ip address 10.1.200.2 255.255.255.0

R2(config-if)#no shutdown

 

R3#configure terminal

R3(config-if)#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 f0/0

R3(config-if)#ip address 10.1.200.3 255.255.255.0

R3(config-if)#no shutdown

 

b. Configure the serial interfaces on R1 and R2.

R1#(config)#interface s1/0

R1(config-if)#ip address 10.1.100.1 255.255.255.0

R1(config-if)#bandwidth 64

R1(config-if)#no shutdown

 

R2#(config)#interface s1/0

R2(config-if)#ip address 10.1.100.2 255.255.255.0

R2(config-if)#bandwidth 64

R2(config-if)#no shutdown

 

Note: The bandwidth command on the serial interfaces is used to match the actual bandwidth of the link. By default, OSPF calculates the cost of links based on the default interface bandwidth which may be either 128 or 1544 Kb/s, depending on the WIC type. In this case the bandwidth 64 command is used because the real bandwidth of the serial interfaces is set to 64 Kbps. 

 

c. Verify that the appropriate interfces are up and that you can ping across each link.

R1#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            10.1.200.1      YES NVRAM  up                    up      
FastEthernet0/1            unassigned      YES NVRAM  administratively down down    
Serial1/0                  10.1.100.1      YES NVRAM  up                    up      
Serial1/1                  unassigned      YES NVRAM  administratively down down    
Serial1/2                  unassigned      YES NVRAM  administratively down down    
Serial1/3                  unassigned      YES NVRAM  administratively down down    
Loopback1                  10.1.1.1        YES NVRAM  up                    up     

 

R2#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            10.1.200.2      YES NVRAM  up                    up      
FastEthernet0/1            unassigned      YES NVRAM  administratively down down    
Serial1/0                  10.1.100.2      YES NVRAM  up                    up      
Serial1/1                  unassigned      YES NVRAM  administratively down down    
Serial1/2                  unassigned      YES NVRAM  administratively down down    
Serial1/3                  unassigned      YES NVRAM  administratively down down    
Loopback2                  10.1.2.1        YES NVRAM  up                    up

 

R3#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            10.1.200.3      YES NVRAM  up                    up      
FastEthernet0/1            unassigned      YES NVRAM  administratively down down    
Serial1/0                  unassigned      YES NVRAM  administratively down down    
Serial1/1                  unassigned      YES NVRAM  administratively down down    
Serial1/2                  unassigned      YES NVRAM  administratively down down    
Serial1/3                  unassigned      YES NVRAM  administratively down down    
Loopback3                  10.1.3.1        YES NVRAM  up                    up     

 

 

step 2: Add physical interfaces to OSPF.

a. Enter the OSPF conifguration prompt using the router ospf process_number command. The process number is locally significant number that does not affect how OSPF works.

b. Add interfaces with the network address wildcard_mask area area command.

Note: Another option for adding individual directly connected networks into the OSPF process is to use the ip ospf process-id area area-id interface command.

c. Enter the command on R1. Exit to priviledged EXEC mode type debug ip ospf adj.

 

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.0 0.0.0.255 area 0

R1#debug ip ospf adj

 

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

 

R1#debug ip ospf adj
OSPF adjacency events debugging is on
R1#
*Jul  9 12:20:21.295: OSPF: 2 Way Communication to 10.1.2.1 on FastEthernet0/0, state 2WAY
*Jul  9 12:20:21.299: OSPF: 2 Way Communication to 10.1.3.1 on FastEthernet0/0, state 2WAY
R1#
*Jul  9 12:20:51.283: OSPF: end of Wait on interface FastEthernet0/0
*Jul  9 12:20:51.283: OSPF: DR/BDR election on FastEthernet0/0
*Jul  9 12:20:51.283: OSPF: Elect BDR 10.1.1.1
*Jul  9 12:20:51.283: OSPF: Elect DR 10.1.1.1
*Jul  9 12:20:51.283: OSPF: Elect BDR 10.1.2.1
*Jul  9 12:20:51.287: OSPF: Elect DR 10.1.1.1
*Jul  9 12:20:51.287:        DR: 10.1.1.1 (Id)   BDR: 10.1.2.1 (Id)
*Jul  9 12:20:51.287: OSPF: Send DBD to 10.1.2.1 on FastEthernet0/0 seq 0x3BF opt 0x52 flag 0x7 len 32
*Jul  9 12:20:51.291: OSPF: Send DBD to 10.1.3.1 on FastEthernet0/0 seq 0xCD9 opt 0x52 flag 0x7 len 32
*Jul  9 12:20:51.387: OSPF: Rcv DBD from 10.1.2.1 on FastEthernet0/0 seq 0xEE3 opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Jul  9 12:20:51.387: OSPF: NBR Negotiation Done. We are the SLAVE
*Jul  9 12:20:51.387: OSPF: Send DBD to 10.1.2.1 on FastEthernet0/0 seq 0xEE3 opt 0x52 flag 0x2 len 72
*Jul  9 12:20:51.387: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul  9 12:20:
R1#51.387: OSPF: DR/BDR election on FastEthernet0/0
*Jul  9 12:20:51.387: OSPF: Elect BDR 10.1.2.1
*Jul  9 12:20:51.387: OSPF: Elect DR 10.1.1.1
*Jul  9 12:20:51.387:        DR: 10.1.1.1 (Id)   BDR: 10.1.2.1 (Id)
*Jul  9 12:20:51.387: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul  9 12:20:51.387: OSPF: DR/BDR election on FastEthernet0/0
*Jul  9 12:20:51.387: OSPF: Elect BDR 10.1.2.1
*Jul  9 12:20:51.387: OSPF: Elect DR 10.1.1.1
*Jul  9 12:20:51.387:        DR: 10.1.1.1 (Id)   BDR: 10.1.2.1 (Id)
*Jul  9 12:20:51.391: OSPF: Rcv DBD from 10.1.3.1 on FastEthernet0/0 seq 0x1B2E opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Jul  9 12:20:51.395: OSPF: NBR Negotiation Done. We are the SLAVE
*Jul  9 12:20:51.395: OSPF: Send DBD to 10.1.3.1 on FastEthernet0/0 seq 0x1B2E opt 0x52 flag 0x2 len 72
*Jul  9 12:20:51.399: OSPF: Rcv DBD from 10.1.3.1 on FastEthernet0/0 seq 0x1B2F opt 0x52 flag 0x3 len 52  mtu 1500 state EXCHANGE
*Jul  9 12:20:51.403: OSPF: Send DBD to 1
R1#0.1.3.1 on FastEthernet0/0 seq 0x1B2F opt 0x52 flag 0x0 len 32
*Jul  9 12:20:51.407: OSPF: Rcv DBD from 10.1.2.1 on FastEthernet0/0 seq 0xEE4 opt 0x52 flag 0x3 len 72  mtu 1500 state EXCHANGE
*Jul  9 12:20:51.411: OSPF: Send DBD to 10.1.2.1 on FastEthernet0/0 seq 0xEE4 opt 0x52 flag 0x0 len 32
*Jul  9 12:20:51.427: OSPF: Rcv DBD from 10.1.3.1 on FastEthernet0/0 seq 0x1B30 opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE
*Jul  9 12:20:51.427: OSPF: Exchange Done with 10.1.3.1 on FastEthernet0/0
*Jul  9 12:20:51.427: OSPF: Send LS REQ to 10.1.3.1 length 12 LSA count 1
*Jul  9 12:20:51.427: OSPF: Send DBD to 10.1.3.1 on FastEthernet0/0 seq 0x1B30 opt 0x52 flag 0x0 len 32
*Jul  9 12:20:51.427: OSPF: Rcv LS REQ from 10.1.3.1 on FastEthernet0/0 length 48 LSA count 2
*Jul  9 12:20:51.427: OSPF: Send UPD to 10.1.200.3 on FastEthernet0/0 length 148 LSA count 2
*Jul  9 12:20:51.427: OSPF: Rcv DBD from 10.1.2.1 on FastEthernet0/0 seq 0xEE5 opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE
*Jul  9 12:20:51.431: OSPF: Exchange Done with 10.1.2.1 on FastEthernet0/0
*Jul  9 12:20:51.431: OSPF: Synchronized with 10.1.2.1 on FastEthernet0/0, state FULL
*Jul  9 12:20:51.431: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Jul  9 12:20:51.435: OSPF: Send DBD to 10.1.2.1 on FastEthernet0/0 seq 0xEE5 opt 0x52 flag 0x0 len 32
*Jul  9 12:20:51.447: OSPF: Rcv LS UPD from 10.1.3.1 on FastEthernet0/0 length 76 LSA count 1
*Jul  9 12:20:51.447: OSPF: Synchronized with 10.1.3.1 on FastEthernet0/0, state FULL
*Jul  9 12:20:51.447: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.3.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Jul  9 12:20:51.455: OSPF: Rcv LS UPD from 10.1.2.1 on Serial1/0 length 76 LSA count 1
*Jul  9 12:20:51.679: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul  9 12:20:51.683: OSPF: DR/BDR election on FastEthernet0/0
*Jul  9 12:20:51.683: OSPF: Elect BDR 10.1.2.1
*Jul  9 12:20:51.683: OSPF: Elect DR 10.1.1.1
*Jul  9 12:20:51.683:        DR: 10.1.1.1 (Id)   BDR: 10.1.2.1 (Id)
*Jul  9 12:20:51.683: OSPF: Neighbor change Event on interface FastEthernet0/0
*Jul  9 12:20:51.687: OSPF: DR/BDR election on FastEthernet0/0
*Jul  9 12:20:51.687: OSPF: Elect BDR 10.1.2.1
*Jul  9 12:20:51.687: OSPF: Elect DR 10.1.1.1
*Jul  9 12:20:51.687:        DR: 10.1.1.1 (Id)   BDR: 10.1.2.1 (Id)
*Jul  9 12:20:51.791: OSPF: Build network LSA for FastEthernet0/0, router ID 10.1.1.1
*Jul  9 12:20:51.791: OSPF: Build network LSA for FastEthernet0/0, router ID 10.1.1.1
*Jul  9 12:20:51.795: OSPF: Build router LSA for area 0, router ID 10.1.1.1, seq 0x80000003, process 1
*Jul  9 12:20:51.827: OSPF: Rcv LS UPD from 10.1.2.1 on Serial1/0 length 64 LSA count 1
*Jul  9 12:20:51.871: OSPF: Rcv LS UPD from 10.1.2.1 on Serial1/0 length 100 LSA count 1
*Jul  9 12:20:51.879: OSPF: Rcv LS UPD from 10.1.2.1 on FastEthernet0/0 length 100 LSA count 1
*Jul  9 12:20:51.895: OSPF: Rcv LS UPD from 10.1.3
R1#.1 on FastEthernet0/0 length 76 LSA count 1
*Jul  9 12:20:51.899: OSPF: Rcv LS UPD from 10.1.2.1 on FastEthernet0/0 length 100 LSA count 1
R1#un all
All possible debugging has been turned off

 

Step 3: Use OSPF show commands.

a. The show ip protocols command displays basic high-level routing protocol information.

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.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    10.1.2.1             110      00:05:44
    10.1.3.1             110      00:05:44
    10.1.1.1             110      00:06:24
  Distance: (default is 110)

 

b. The show ip ospf command displays the OSPF process ID and router ID.

 

R1#show ip ospf
 Routing Process "ospf 1" with ID 10.1.1.1
 Start time: 00:00:10.124, Time elapsed: 00:08:25.552
 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
 IETF NSF helper support enabled
 Cisco NSF helper support enabled
    Area BACKBONE(0)
        Number of interfaces in this area is 3
        Area has no authentication
        SPF algorithm last executed 00:07:40.092 ago
        SPF algorithm executed 3 times
        Area ranges are
        Number of LSA 4. Checksum Sum 0x0200E1
        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

 

Notice the router ID listed in the output.

The router chooses the router ID using the highest IP on a loopback interface when OSPF is configured.

If an additional loopback interface with a higher IP address is added after OSPF is turned on, it does not become the router ID unless the router is reloaded, the OSPF configuration is removed and reentered, or the OSPF-level command router-id is used to modify the RID manually and the clear ip ospf process command is subsequently entered.

If no loopback interfaces are present on the router, the router selects the highest available IP address among interfaces that are activated using the no shutdown command. If no IP addresses are assigned to interfaces, the OSPF process does not start.

 

c. The show ip ospf neighbor command displays important neighbor status, including the adjacency state, address, router ID, and connected interface.

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.2.1          5   FULL/BDR        00:00:30    10.1.200.2      FastEthernet0/0
10.1.3.1          1   FULL/DROTHER    00:00:30    10.1.200.3      FastEthernet0/0
10.1.2.1          0   FULL/  -        00:00:30    10.1.100.2      Serial1/0

 

If you need more detail than the standard one-line summaries of neighbors, use the show ip ospf neighbor detail command.

 

d. The show ip ospf interface interface_type number command shows interface timers and network types.

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: 50
  Transmit Delay is 1 sec, State DR, Priority 10
  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:01
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 3/3, 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 0 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)

 

e. A variation of the previous command is the show ip ospf interface brief command, which displays each interface that is participating in the OSPF process on the router, the area it is in, its IP address, cost, state, and number of neighbors.

R1#show ip ospf interface brief
Interface    PID   Area          IP Address/Mask    Cost  State Nbrs  F/C
Fa0/0        1     0               10.1.200.1/24          50      DR    2/2
Se1/0        1     0               10.1.100.1/24         1562   P2P   1/1
Lo1           1     0               10.1.1.1/24             1        P2P   0/0

 

f. The show ip ospf database command 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        1329        0x80000003 0x006F63 4
10.1.2.1        10.1.2.1        1330        0x80000003 0x009D31 4
10.1.3.1        10.1.3.1        1330        0x80000002 0x000612 2

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.200.1      10.1.1.1        1329        0x80000001 0x00EE3B

 

Step 4: Add loopback interfaces to OSPF

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.1.0 0.0.0.255 area 0

 

 

R2(config)#router ospf 1

R2(config-router)#network 10.1.1.0 0.0.0.255 area 0

 

R1#show ip route | begin Gateway
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/51] via 10.1.200.2, 00:00:41, FastEthernet0/0
O       10.1.3.1/32 [110/51] via 10.1.200.3, 00:00:41, FastEthernet0/0
C       10.1.1.0/24 is directly connected, Loopback1
C       10.1.100.0/24 is directly connected, Serial1/0
C       10.1.200.0/24 is directly connected, FastEthernet0/0

 

R1#show ip ospf interface loopback 1
Loopback1 is up, line protocol is up
  Internet Address 10.1.1.1/24, Area 0
  Process ID 1, Router ID 10.1.1.1, Network Type LOOPBACK, Cost: 1
  Loopback interface is treated as a stub Host

 

Note: The OSPF network type of LOOPBACK is a Cisco-proprietary extension that is not configurable but that is present on loopback interfaces by default.

In some applications such as MPLS, the possible discrepancy between the real loopback interface mask and the advertised address/mask can lead to reachability or functionality issues, and care must be taken to either use /32 mask on loopbacks, or whenever a different mask is used, the OSPF network type must be changed to point-to-point.

 

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

R3#show ip ospf int lo 3
Loopback3 is up, line protocol is up
  Internet Address 10.1.3.1/24, Area 0
  Process ID 1, Router ID 10.1.3.1, Network Type POINT_TO_POINT, Cost: 1
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 0
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 0, Adjacent neighbor count is 0
  Suppress hello for 0 neighbor(s)

 

e. Use the TCL script to verify connectivy to all address in the topology.


R1#tclsh
R1(tcl)#foreach address {
+>(tcl)#10.1.1.1
+>(tcl)#10.1.2.1
+>(tcl)#10.1.3.1
+>(tcl)#10.1.100.1
+>(tcl)#10.1.100.2
+>(tcl)#10.1.200.1
+>(tcl)#10.1.200.2
+>(tcl)#10.1.200.3
+>(tcl)#} {
+>(tcl)#ping $address }

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/17/32 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/18/48 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/24/44 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.100.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/16/28 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.200.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.200.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/10/12 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.200.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/9/16 ms
R1(tcl)#

 

Step 5: Modify OSPF link costs.

When you use the show ip route command on R1, you see that the most direct route to the R2 loopback is through its Ethernet connection. Next to this route is a pair in the form [administrative distance / metric ]. The default administrative distance of OSPF on Cisco routers is 110. The metric depends on the link type. OSPF always chooses the route with the lowest metric, which is a sum of all link costs.

 

You can modify a single link cost by using the interface command ip ospf cost cost. Use this command on both ends of the link. In the following commands, the link cost of the Fast 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-if)#do show ip ospf int f0/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: 1
  Transmit Delay is 1 sec, State DR, Priority 10
  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:06
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 3/3, 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 0 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(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 ospf int f0/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: 50
  Transmit Delay is 1 sec, State DR, Priority 10
  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:03
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 3/3, 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 0 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#show ip route | b Gateway
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:02:42, FastEthernet0/0
O       10.1.2.0 [110/51] via 10.1.200.2, 00:01:53, FastEthernet0/0
C       10.1.1.0 is directly connected, Loopback1
C       10.1.100.0 is directly connected, Serial1/0
C       10.1.200.0 is directly connected, FastEthernet0/0

 

For reference, here are some default link costs (taken from Cisco.com):
• 64-kb/s serial link: 1562
• T1 (1.544-Mb/s serial link): 64
• E1 (2.048-Mb/s serial link): 48
• Ethernet: 10
• Fast Ethernet: 1
• FDDI: 1
• X25: 5208
• ATM: 1
OSPF uses a reference bandwidth of 100 Mb/s for cost calculation. The formula to calculate the cost is the reference bandwidth divided by the interface bandwidth. For example, in the case of Ethernet, is the cost is 100 Mb/s / 10 Mb/s = 10.
The above link costs do not include Gigabit Ethernet, which is significantly faster than Fast Ethernet, but would still have a cost of 1 using the default reference bandwidth of 100 Mb/s.

 

Step 6: Modify interface priorities to control the DR and BDR election.

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:36
    Neighbor is up for 00:58:23
    Index 2/2, retransmission queue length 0, number of retransmission 1
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 1, maximum is 1
    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:36
    Neighbor is up for 00:58:23
    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 Serial1/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 00:58:33
    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

 

What is the purpose of a DR & BDR in OSPF?

如果网络中没有DR与BDR, 那么在广播网络中, 所有设备都会泛洪LSA, 如果网络中的路由器过多,则会增加网络的带宽, 甚至导致网络故障。

当网络中有了DR 与 BDR, 大大减少了网络中流量, 所有的DRother 与DR 与 BDR 泛洪数据包。

 

你可能感兴趣的:(interface)