|
|
The add ip route command is used to add runtime static entries to the IP routing table. When the system is rebooted, the parameters will revert to the last saved values. To make permanent changes to the configuration, use the IP Static section.
add ip route destination mask {gateway | port} metric [Redist=RIP | OSPF1 | OSPF2 | none]
destination | A destination option is usually entered in the standard dotted decimal notation for IP addresses. However, values can be entered in hexadecimal as well. Hexadecimal numbers must either be preceded by a "0x" or they must be complete (8 hexadecimal digits, e.g., C6290C00 for 198.41.12.0). If 0.0.0.0 is specified as the destination, then the route being added is to a default router. The mask must also be 0.0.0.0. The default router will be used to route packets when the destination network is not known by the device. |
mask | The mask option tells the device how much of the destination address entry should be considered when determining the route for a packet. This field has the same format as the destination field but typically has 255's for the network portion of the address and 0 for the host portion when adding a network route, and all 255's when adding a host route. |
gateway | port | The gateway | port option also has the same format as the destination option and usually is the address of another router (gateway) which is responsible for packets being sent to the destination address or network. This field can also be specified as a physical interface of the device you are configuring (e.g., WAN 0:0 or just "0") when the interface is unnumbered. However, the name of a physical interface cannot be used when that interface is configured for Frame Relay operation. This is because the Frame Relay protocol allows multiple IP addresses to be reached over a single physical interface via different PVCs (permanent virtual circuits). See the Frame Relay section for more information. You can also specify a VPN port for the port. See the Tunnel Partner section for more information about VPN ports. |
metric | The metric option specifies the distance or cost to the destination. The metric is used by the routing process to determine where packets should be sent. It usually corresponds loosely with the number of hops to the destination. A lower value makes this a "better route." The value entered here must be between 1 and 15 and may correspond to the actual number of hops to the gateway or may be larger to artificially inflate the cost. There are several reasons why you might enter a route with an inflated metric. If there is more than one route to another destination but the route with the shortest number of hops is over a slow WAN link, you might add a route to cause the IP traffic to take the "quicker" route. |
Redist=RIP | OSPF1 | OSPF2 | none | If the optional Redist parameter is specified, this route will be redistributed into the specified routing protocol. If you leave this field off or if none is specified, the static route will not be redistributed. Only one routing protocol can be selected for redistributing each static route.
|
Static routes are used to provide information to the device about where IP packets should be sent when the device itself has not been able to determine a correct route for them using dynamic routing information.
In cases where the routing metrics (i.e., the number of routing hops to a destination) are equal between a static route and a dynamic route, Cisco Systems devices will use the dynamic route.
![]() |
Note Static routes are more difficult to maintain and are generally not as reliable as dynamically-determined routes. We recommend that you use static routing only when the network does not provide adequate routing information through RIP. |
The first example adds a default route which passes all packets with unknown destinations to WAN 0. This route might be used on a device which has a connection to an Internet Service Provider through WAN 0.
add ip route 0.0.0.0 0.0.0.0 0 1
The next example adds a route to network 198.41.13.0 through the gateway 198.41.9.65. Notice that the metric is 4. That means that if a better dynamic route is found (the metric is less than or equal to 4), this route will not be used. The command also tells the device to include this route in its RIP broadcast. If the device is restarted or the configuration is saved, this route will not be retained.
add ip route 198.41.13.0 255.255.255.0 198.41.9.65 4 redist=RIP
| Command | Description |
|---|---|
configure Frame Relay | Configures Frame Relay parameters for an interface |
configure IP | Configures IP parameters for an interface |
edit config IP Static | Creates static IP routes |
save | Saves the edited configuration |
show ip | Shows IP configuration and statistics |
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Wed Sep 27 11:11:23 PDT 2000
Copyright 1989-2000©Cisco Systems Inc.