Using Static Routing
Problem
You want to configure a static route.
Solution
You can configure a static route with the ip route command, as follows:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip route
10.35.15.5 255.255.255.255
Ethernet0
Router(config)#end
Router#
You can also configure a static route to point to a particular next hop router:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface
Router(config-if)#
Serial0
ip address
Router(config-if)#
10.35.6.2 255.255.255.0
exit
Router(config)#ip route
Router(config)#
172.16.0.0 255.255.0.0 10.35.6.1 2
end
Router#
If you want to ensure a route remains in place even if the next-hop IP address becomes unreachable, or the interface goes down, you can use the permanent keyword:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip route
10.35.15.5 255.255.255.255
Ethernet0 permanent
Router(config)#ip route
172.16.0.0 255.255.0.0 10.35.6.1 2
permanent
Router(config)#end
Router#
You can also manually configure routing tags that use static routes by using the tag keyword:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip route
172.16.0.0 255.255.0.0 10.35.6.1 2
tag
Router(config)#
36291
end
Router#
Discussion
The first version sends all packets destined to the single host
10.35.15.5
out through the Ethernet0 interface. In this case, ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.