The following series of static route input examples are based upon the following route configuration:
# **** VRF default (default) **** configure terminal ! # Static routes configured on routed interfaces ip route 33.1.1.0/24 133.1.1.2 interface vlan.0.333 1 ip route 33.1.2.0/24 144.1.1.2 interface vlan.0.444 1 ip route 192.168.1.0/24 blackhole 1 ip route 192.168.1.0/30 reject 1 ip route 192.168.1.4/30 100.1.1.3 interface vlan.0.100 1 ! # Static routes configured on non-routed interfaces ip route 10.0.0.0/8 10.21.128.1 interface vlan.0.4000 1 ip route 134.141.0.0/16 10.21.128.1 interface vlan.0.4000 1 ! exit !
The following example enters a static route with no next-hop interface specified. The route prefix and length is 33.1.1.0/24 and the next-hop is 133.1.1.2.
System(rw-config)->ip route 33.1.1.0/24 133.1.1.2
This is a legacy format. You are not prevented from entering the route in this format, but the behavior has changed as follows:
System(rw-config)->ip route 33.1.1.0/24 133.1.1.2 interface vlan.0.333
System(rw-config)->ip route 33.1.1.0/24 133.1.1.2 recursive
The following example enters a static route for prefix and length 33.1.2.0/24 with a next-hop of 144.1.1.2, but this time specifying the interface, vlan.0.444, that the next-hop is on:
System(rw-config)->ip route 33.1.2.0/24 144.1.1.2 interface vlan.0.444
The following example configures a blackhole route for prefix and length 192.168.1.0/24. Packets destined for blackhole routes are silently dropped. An ICMP network unreachable message is not sent to the packet source.
System(rw-config)->ip route 192.168.1.0/24 blackhole
The following example configures a reject route that overlaps the 192.168.1.0/24 blackhole route for prefix and length 192.168.1.0/30. In this case, packets destined for this next-hop are also dropped, but an ICMP network unreachable message is sent to the packet source:
System(rw-config)->ip route 192.168.1.0/30 reject
The following example configures an overlapping route allowing frames to 192.168.1.5 and 192.168.1.6 to be forwarded to next-hop 100.1.1.3 on interface vlan.0.100:
System(rw-config)->ip route 192.168.1.4/30 100.1.1.3 interface vlan.0.100
Use the show ip route command to display IP routes for this device. Route display can be narrowed by specifying route type: connected, ospf, rip, or static. The show ip route command output for this series of inputs is:
System(rw-config)->show ip route Host IP Route Table for VRF default Codes: C-connected, D-dynamic, H-host, S-static *-no forwarding interface S* 10.0.0.0/8 10.21.128.1 vlan.0.4000 C* 10.21.128.0/17 10.21.130.151 vlan.0.4000 H 10.21.130.151 10.21.130.151 lo.0.1 S 33.1.1.0/24 133.1.1.2 vlan.0.333 S 33.1.2.0/24 144.1.1.2 vlan.0.444 C 100.1.1.0/24 100.1.1.2 vlan.0.100 H 100.1.1.2 100.1.1.2 lo.0.1 C 101.1.1.0/24 101.1.1.2 vlan.0.100 H 101.1.1.2 101.1.1.2 lo.0.1 H 127.0.0.1 127.0.0.1 lo.0.1 C 133.1.1.0/24 133.1.1.1 vlan.0.333 C 133.1.1.0/24 direct vlan.0.333 H 133.1.1.1 133.1.1.1 lo.0.1 S* 134.141.0.0/16 10.21.128.1 vlan.0.4000 S 192.168.1.4/30 100.1.1.3 vlan.0.100 Number of routes = 15
Use the show ip protocols command to display information about IP protocols running on this device.