Configuring OSPF globally

Configure OSPF parameters on the switch so that you can control OSPF behavior on the system. The switch uses global parameters to communicate with other OSPF routers. Globally configure OSPF before you configure OSPF for an interface, port, or VLAN.

Before you begin

  • Ensure that the switch has an IP interface.

  • You configure OSPF on a VRF instance the same way you configure the GlobalRouter, except that you must use VRF Router Configuration mode and the prefix ip ospf to commands. Not all parameters are configurable on non0 VRFs.

Procedure

  1. Enter OSPF Router Configuration mode:

    enable

    configure terminal

    router ospf

  2. Configure the OSPF router ID:

    router-id {A.B.C.D}

  3. Configure the router as an autonomous system boundary router (ASBR):

    as-boundary-router enable

    Note

    Note

    Configure the following steps as and when needed.

  4. Enable the automatic creation of OSPF virtual links:

    auto-vlink

  5. Configure the OSPF default metrics:

    default-cost {ethernet|fast-ethernet|forty-gig-ethernet|gig-ethernet|hundred-gig-ethernet|ten-gig-ethernet|twentyfive-gig-ethernet} <1-65535>]

    default-cost vlan <1-65535>]

  6. Configure the OSPF hold-down timer value:

    timers basic holddown <3-60>

  7. Enable the RFC1583 compatibility mode:

    rfc1583-compatibility enable

  8. Enable the router to issue OSPF traps:

    trap enable

  9. Verify the OSPF configuration:

    show ip ospf [vrf WORD<1-16>] [vrfids WORD<0-512>]

  10. Exit OSPF Router Configuration mode:

    exit

    You return to Global Configuration mode.

  11. Enable OSPF for the switch:

    router ospf enable

Example

Configure the OSPF router ID to 192.0.2.2, enable the automatic creation of OSPF virtual links, and enable traps. Configure the default cost metric for Ethernet to 101, for fast Ethernet to 110, and for gig-Ethernet, ten-gig-Ethernet, twentyfive-gig-ethernet, forty-gig-Ethernet, and hundred-gig-ethernet to 20, and vlan to 1. Configure the basic holdown to 10. Enable OSPF for the switch, and review the configuration.

Switch:1>enable
Switch:1#configure terminal
Switch:1(config)#router ospf
Switch:1(config-ospf)#router-id 192.0.2.2
Switch:1(config-ospf)#auto-vlink
Switch:1(config-ospf)#default-cost ethernet 101
Switch:1(config-ospf)#default-cost fast-ethernet 110
Switch:1(config-ospf)#default-cost gig-ethernet 20
Switch:1(config-ospf)#default-cost ten-gig-ethernet 20
Switch:1(config-ospf)#default-cost twentyfive-gig-ethernet 20
Switch:1(config-ospf)#default-cost Forty-gig-ethernet 20
Switch:1(config-ospf)#default-cost hundred-gig-ethernet 20 
Switch:1(config-ospf)#default-cost vlan 2
Switch:1(config-ospf)#timers basic holddown 10
Switch:1(config-ospf)#trap enable
Switch:1(config-ospf)#exit
Switch:1(config)#router ospf enable
Switch:1(config)#show ip ospf

================================================================================
                          OSPF General - GlobalRouter
================================================================================

            RouterId: 192.0.2.2
           AdminStat: disabled
       VersionNumber: 2
    AreaBdrRtrStatus: false
      ASBdrRtrStatus: true
      Bad-Lsa-Ignore: false
      ExternLsaCount: 0
   ExternLsaCksumSum: 0(0x0)
          TOSSupport: 0
    OriginateNewLsas: 0
           RxNewLsas: 0
          TrapEnable: false
  AutoVirtLinkEnable: false
     SpfHoldDownTime: 10
Rfc1583Compatibility: disable
         Helper mode: enabled  

default-metric : 
                         ethernet - 101
                    fast-ethernet - 110
                     gig-ethernet - 20
                 ten-gig-ethernet - 20
          twentyfive-gig-ethernet - 20
               forty-gig-ethernet - 20
             hundred-gig-ethernet - 20
						 					  Vlan - 1

Variable definitions

The following table defines parameters for the router-id command.

Variable

Value

<A.B.C.D>

Configures the OSPF router ID IP address, where A.B.C.D is the IP address.

The following table defines parameters for the default-cost command.

Variable

Value

ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

ethernet is for 10 Mb/s Ethernet (default is 100).

fast-ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

fast-ethernet is for 100 Mb/s (Fast) Ethernet (default is 10).

forty-gig-ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

forty-gig-ethernet is for 40 Gigabit Ethernet (default is 1).

gig-ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

gig-ethernet is for Gigabit Ethernet (default is 1).

hundred-gig-ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

hundred-gig-ethernet is for 100 Gigabit Ethernet (default is 1).

ten-gig-ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

ten-gig-ethernet is for 10 Gigabit Ethernet (default is 1).

twentyfive-gig-ethernet <1-65535>

Configures the OSPF default metrics. The lower the metric, the more likely that OSPF chooses the link to route an OSPF packet.

On a channelized 100 Gbps port, the default-cost for each 25 Gbps channel is 1.

vlan <1-65535>

Configures the OSPF default metrics.

vlan is for Vlan interfaces (default is 10).

The following table defines parameters for the timers basic holddown command.

Variable

Value

<3-60>

Configures the OSPF hold-down timer value in seconds. The default is 10.

The following table defines parameters for the show ip ospf command.

Variable

Value

vrf WORD<1-16>

Specifies a VRF by name.

vrfids WORD<0-512>

Specifies a range of VRF IDs.