Command: clear ip route
Function: Removes all entries from the IP routing table.
Syntax:
clear ip route [<address> | <network> | <wildcard> | <all>]
Parameters:
<address>
: Specifies the IP address of the route that you want to remove.<network>
: Specifies the network address of the route that you want to remove.<wildcard>
: Specifies the wildcard mask of the route that you want to remove.<all>
: Removes all routes from the IP routing table.
Use:
Theclear ip route
command is used to remove routes from the IP routing table. This can be useful if you are troubleshooting a routing problem or reconfiguring your network.
Equipment:
Theclear ip route
command can be used on all Cisco routers.
Output:
Theclear ip route
command does not generate any output.
Additional Information:
- The
clear ip route
command only removes routes from the IP routing table. It does not affect the configuration of the router’s interfaces. - You can use the
show ip route
command to verify that the routes have been removed from the routing table. - The
clear ip route
command is equivalent to thedelete ip route
command.
clear ip route Usage Examples
The Cisco commandclear ip route
is used to clear the routing table. Here are some examples of how to use this command:
- Clear the entire routing table:
clear ip route *
This command will clear all the entries from the routing table.
- Clear a specific route:
clear ip route <destination-prefix>
This command will clear the route to the specified destination prefix. For example, to clear the route to the 10.0.0.0/24 network, you would use the following command:
clear ip route 10.0.0.0/24
- Clear a route based on the administrative distance:
clear ip route <administrative-distance>
This command will clear all the routes with the specified administrative distance. For example, to clear all the routes with an administrative distance of 120, you would use the following command:
clear ip route 120
- Clear a route based on the protocol:
clear ip route <protocol>
This command will clear all the routes that were learned through the specified protocol. For example, to clear all the routes that were learned through OSPF, you would use the following command:
clear ip route ospf
- Clear a route based on the source interface:
clear ip route source <interface>
This command will clear all the routes that were learned through the specified interface. For example, to clear all the routes that were learned through the GigabitEthernet0/1 interface, you would use the following command:
clear ip route source GigabitEthernet0/1