Configuring an OSPF host route

Configure host routes when the switch resides in a network that uses routing protocols other than OSPF. A host route is a more-specific route and is used even if it is higher cost than a network route.

Before you begin

  • Globally enable OSPF.

  • You configure an OSPF host route 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. The VRF must have an RP Trigger of OSPF. Not all parameters are configurable on non0 VRFs.

About this task

Use a host route to create a custom route to a specific host to control network traffic.

You can specify which hosts directly attach to the router, and the metrics and types of service to advertise for the hosts.

Procedure

  1. Enter OSPF Router Configuration mode:

    enable

    configure terminal

    router ospf

  2. Create a host route:

    host-route {A.B.C.D} [metric <0-65535>]

  3. Ensure that the configuration is correct:

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

Example

Create a host route on IP address 192.0.2.20 with a metric of 20.

Switch:1>enable
Switch:1#configure terminal
Switch:1(config)#router ospf
Switch:1(config-ospf)#host-route 192.0.2.20 metric 20
Switch:1(config-ospf)#show ip ospf host-route
Switch:1(config-ospf)#show ip ospf host-route

================================================================================
                         OSPF Host Route - GlobalRouter
================================================================================
HOSTIPADDR      TOS  METRIC
--------------------------------------------------------------------------------
192.0.2.20      -    20

Variable definitions

The following table defines parameters for the host-route command.

Variable

Value

{A.B.C.D}

Specifies the IP address of the host router in a.b.c.d format.

metric <0-65535>

Configures the metric (cost) for the host route.

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

Variable

Value

vrf WORD<1-16>

Specifies a VRF by name.

vrfids WORD<0-512>

Specifies a range of VRF IDs.