Configure a Static Route
Configuration Condition
Before configuring a static route, ensure that:
- The link layer protocol has been configured to ensure normal communication at the link layer.
- Interface IP addresses have been configured so that neighbor nodes are reachable at the network layer.
Configure a Static Route
According to the parameters that have been specified, static routes are categorized into the following three types:
- Interface route: For an interface route, only the output interface is specified.
- Gateway route: For a gateway route, only the gateway address is specified.
- Interface gateway route: For an interface gateway route, both the output interface and the gateway address are specified.
Configured static routes become invalid if some of the following conditions are met:
- The destination address is the local interface address.
- The destination address is the network of the local direct interface.
- The administrative distance of the route is 255.
- The output interface of the route is DOWN.
- No IP address has been configured for the output interface of the route.
- The gateway address is not reachable.
- The output interface and the gateway of the route conflict.
- The output interface of the route does not exist.
- The TRACK object that is associated with the route is "fake".
- The status of the Bidirectional Forwarding Detection (BFD) session that is associated with the route is DOWN.
If an interface route meets any one condition among 1, 2, 3, 4, 5, 9, and 10, the route is invalid. If a gateway route meets any one condition among 1, 2, 3, 4, 6, 8, 9, and 10, the route is invalid. If an interface gateway route meets any of the above conditions, the route is invalid.
Table 3-2 Configuring a Static Route
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Configure a static route.
|
ip route [ vrf vrf-name1] destination-ip-address destination-mask { interface-name / [ nexthop-ip-address [ vrf vrf-name2 ] ] } [ name nexthop-name ] [ tag tag-value ] [ track track-id ] [ administrative-distance ]
|
Mandatory.
The field administrative-distance is the administrative distance of the static route. If it is not specified, the default administrative distance is used.
|
-
For a default route, the destination network and mask must be set to 0.0.0.0.
- The output interface of the Null0 route is Null0.
- The output interface of the Null0 interface need not be configured with an IP address.