This chapter describes how to add static and null routes to the IP route table.
Configuring an IPv4 Route
Static route
Configure a static route to a specific network or host address
Null route
Configure a "null" route to discard IP traffic to a specific network or host address:
• Discard traffic for the destination, with ICMP notification to sender
• Discard traffic for the destination, without ICMP notification to sender
Syntax:
[no] ip route
dest-ip-addr / mask-length
[
next-hop-ip-addr
| vlan vlan-id | reject
| blackhole] [metric metric] [distance1-255] [tag-value tagval] [name <name-str>]
Allows the addition and deletion of static routing table entries. A route entry is identified by a destination (IP
address/mask length) and next-hop pair. The next-hop can be either a gateway IP address, a VLAN, or the
keyword "reject" or "blackhole".
A gateway IP address does not have to be directly reachable on one of the local subnets. If the gateway address
is not directly reachable, the route is added to the routing table as soon as a route to the gateway address is
learned.
dest-ip-addr / mask-bits
The route destination and network mask length for the destination IP address. Alternatively, you can enter the
mask itself.
For example, you can enter either 10.0.0.0/24 or 10.0.0.0 255.255.255.0 for a route destination of 10.0.0.0
255.255.255.0.
next-hop-ip-addr
This IP address is the gateway for reaching the destination. The next-hop IP address is not required to be
directly reachable on a local subnet. (If the next-hop IP address is not directly reachable, the route will be
added to the routing table as soon as a route to this address is learned.)
reject
Specifies a null route where IP traffic for the specified destination is discarded and an ICMP error notification
is returned to the sender.
blackhole
Specifies a null route where IP traffic for the specified destination is discarded and no ICMP error notification
is returned to the sender.
distance
Specifies the administrative distance to associate with a static route. If not specified, this value is set to a
default of 1. (Range: 1 to 255)
Chapter 6
Static Routing
Chapter 6 Static Routing
155