clear ip ospf

Clears OSPF data processes, graceful restart, counters, neighbors, or routes.

Syntax

clear ip ospf all [ vrf vrf-name ]
clear ip ospf graceful-restart { vrf vrf-name | all-vrf }
clear ip ospf counters { all | ethernet slot/port | loopback number | port-channel number | ve vlan-id } [ vrf vrf-name ]
clear ip ospf neighbor { ip-addr | all } [ vrf vrf-name ]
clear ip ospf routes { ip-addr/mask | all } [ vrf vrf-name ]

Parameters

all
Clears all OSPF data processes.
vrf name
Specifies a VRF.
gr vrf-name
Gracefully restarts the OSPF session for the specified VRF. If no VRF is specified, the default-vrf session is restarted.
counters
Clears OSPF counters.
all
Clears all counters.
ethernet slot / port
Specifies an Ethernet slot and port.
loopback number
Specifies a loopback interface. Valid values range from 1 through 255.
port-channel number
Specifies a port-channel.
ve vlan-id
Specifies a virtual Ethernet (VE) interface. Valid values range from 1 through 4096.
neighbor
Clears neighbors.
ip-addr
Specifies the IP address of the neighbor.
all
Clears all neighbors.
routes
Clears matching routes or clears all routes.
ip-addr/mask
Clears all routes that match the prefix and mask that you specify.
all
Clears all routes.

Modes

Privileged EXEC mode

Examples

The following example restarts all OSPF processes.

device# clear ip ospf all
 

This example gracefully restarts the OSPF session for the VRF named "red."

device# clear ip ospf gr red