Deleting a dynamically learned route

About this task

Delete a dynamically learned route from the routing table if you do not want the switch to use the route. Exercise caution when you delete entries from the routing table.

Procedure

  1. Enter Global Configuration mode:

    enable

    configure terminal

  2. View IP route information:

    show ip route [<A.B.C.D>] [-s default|-s <A.B.C.D/X>] [alternative] [count-summary] [spbm-nh-as-mac][preference] [vrf WORD<1-16>] [vrfids WORD<0-512>] [static]

  3. Delete the dynamically learned route:

    no ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> dynamic

Example

Delete a dynamically learned route:

Switch:1>enable
Switch:1#configure terminal
Switch:1(config)#no ip route 192.0.2.32 255.255.255.0 198.51.100.31 dynamic

Variable Definitions

Use the data in the following table to use the show ip route commands.

Variable

Value

<A.B.C.D>

Specifies the IP address of the route to the network.

alternative

Displays the alternative routes.

count-summary

Displays a summary of the number of routes learned from each routing protocol for each VRF.

preference

Displays the route preference.

-s <A.B.C.D/X>

Indicates the IP address and subnet mask for which to display routes.

-s default

Indicates the default subnet.

static

Displays the static route information.

vrf WORD<1-16>

Displays the route for a particular VRF.

vrfids WORD<0-512>

Displays the route for a particular VRF number.

spbm-nh-as-mac

Displays the spbm route next hop as mac.

Use the data in the following table to use the no ip route command.

Variable

Value

<A.B.C.D> <A.B.C.D> <A.B.C.D>

Specifies the IP address, the subnet mask, and the next-hop IP address, respectively.

dynamic

Specifies that a dynamic route is to be deleted.

enable

Disables the route.

local-next-hop enable

Disables the local-next-hop option.

preference

Deletes the value of the route preference.

next-hop-vrf WORD<1-16>

Specifies the name of the next-hop VRF router.