ip route

To establish static routes, use the ip route global configuration command. To remove static routes, use the no form of this command.

ip route prefix mask {address | interface} [distance] [tag tag] [permanent]
no ip route prefix mask
Syntax Description

prefix

IP route prefix for the destination.

mask

Prefix mask for the destination.

address

IP address of the next hop that can be used to reach that network.

interface

Network interface to use.

distance

(Optional) An administrative distance.

tag tag

(Optional) Tag value that can be used as a "match" value for controlling redistribution via route maps.

permanent

(Optional) Specifies that the route will not be removed, even if the interface shuts down.

Default

No static routes are established.

Command Mode

Global configuration

Usage Guidelines

This command first appeared in Cisco IOS Release 10.0.

A static route is appropriate when the Cisco IOS software cannot dynamically build a route to the destination.

If you specify an administrative distance, you are flagging a static route that can be overridden by dynamic information. For example, IGRP-derived routes have a default administrative distance of 100. To have a static route that would be overridden by an IGRP dynamic route, specify an administrative distance greater than 100. Static routes have a default administrative distance of 1.

Static routes that point to an interface will be advertised via RIP, IGRP, and other dynamic routing protocols, regardless of whether redistribute static commands were specified for those routing protocols. This is because static routes that point to an interface are considered in the routing table to be connected and hence lose their static nature. However, if you define a static route to an interface that is not one of the networks defined in a network command, no dynamic routing protocols will advertise the route unless a redistribute static command is specified for these protocols.

Examples

The following example chooses an administrative distance of 110. In this case, packets for network 10.0.0.0 will be routed through to a router at 131.108.3.4 if dynamic information with administrative distance less than 110 is not available.

ip route 10.0.0.0 255.0.0.0 131.108.3.4 110

The following example routes packets for network 131.108.0.0 to a router at 131.108.6.6:

ip route 131.108.0.0 255.255.0.0 131.108.6.6