Skip to Content
Cisco IOS Cookbook, 2nd Edition
book

Cisco IOS Cookbook, 2nd Edition

by Kevin Dooley, Ian Brown
December 2006
Intermediate to advanced
1188 pages
72h 8m
English
O'Reilly Media, Inc.
Content preview from Cisco IOS Cookbook, 2nd Edition

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 Serial0
Router(config-if)#ip address 10.35.6.2 255.255.255.0  
Router(config-if)#exit
Router(config)#ip route 172.16.0.0 255.255.0.0 10.35.6.1 2
Router(config)#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 36291
Router(config)#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, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

IP Routing on Cisco IOS, IOS XE, and IOS XR: An Essential Guide to Understanding and Implementing IP Routing Protocols

IP Routing on Cisco IOS, IOS XE, and IOS XR: An Essential Guide to Understanding and Implementing IP Routing Protocols

Brad Edgeworth, Aaron Foss, Ramiro Garza Rios
Cisco Software-Defined Access

Cisco Software-Defined Access

Srilatha Vemula, Jason Gooley, Roddie Hasan

Publisher Resources

ISBN: 0596527225Supplemental ContentErrata Page