Configure a Black Hole Static Route

About this task

Configure a black hole static route to the destination a router advertises to avoid routing loops after the router aggregates or injects routes to other routers.

If a black hole route is enabled, you must first delete or disable it before you can add a regular static route to that destination.

Note

Note

Only black hole routes that belong to the static type protocol are supported. An inter-VRF black hole route is not installed in the routing table of the destination VRF on the same switch.

Procedure

  1. Enter either Global Configuration mode or VRF Router Configuration mode for a specific VRF context:

    enable

    configure terminal

    Optional: router vrf WORD<1-16>

  2. Create a black hole static route:

    ip route <A.B.C.D> <A.B.C.D> 255.255.255.255 weight <1–65535>

  3. Enable a black hole static route:

    ip route <A.B.C.D A.B.C.D | A.B.C.D/X> 255.255.255.255 enable [next-hop-vrf WORD<1-16>]

  4. Configure other black hole static route parameters as required.

    When you specify a route preference, appropriately configure the preference so that when the black-hole route is used, it is elected as the best route.

Example

Create a black hole static route and enable the black hole static route.

Switch:1>enable
Switch:1#configure terminal
Switch:1(config)#ip route 192.0.2.0 255.255.0.0 255.255.255.255 weight 200
Switch:1(config)#ip route 192.0.2.0 255.255.0.0 255.255.255.255 enable

Variable Definitions

The following table defines parameters for the ip route command.

Variable

Value

<A.B.C.D A.B.C.D | A.B.C.D/X>

Specifies the IP address and mask for the route destination in one of the following formats:

  • A.B.C.D A.B.C.D

  • A.B.C.D/X

255.255.255.255 is the destination of the black hole route.

enable

Adds a static route to the router or VRF.

local-next-hop enable

Enables the local next hop for this static route.

next-hop-vrf WORD<1-16>

Specifies the next-hop VRF instance by name.

weight <1-65535>

Specifies the static route cost.

Note:

Do not configure a static interface subnet route with a weight of 1.

preference <1-255>

Specifies the route preference.