This chapter provides information and commands concerning the following topics:
Configuring a static route on a router
Configuring a default route on a router
Verifying static routes
Static Routing
When using the ip route command, you can identify where packets should be routed to in two ways:
The next-hop address
The exit interface
Both ways are shown in both the "Configuration Example: Static Routes" section and the "Default Routing" section.
|
Router(config)#ip route 172.16.20.0 255.255.255.0 172.16.10.2 |
172.16.20.0 = destination network 255.255.255.0 = subnet mask 172.16.10.2 = next-hop address Read this to say: To get to the destination network of 172.16.20.0, with a subnet mask of 255.255.255.0, send all packets to 172.16.10.2 |
|
Router(config)#ip route 172.16.20.0 255.255.255.0 s0/0 |
172.16.20.0 = destination network 255.255.255.0 = subnet mask s0/0 = exit interface Read this to say: To get to the destination network of 172.16.20.0, with a subnet mask of 255.255.255.0, send all packets out interface Serial 0/0 |
Default Routing
|
Router(config)#ip route 0.0.0.0 0.0.0.0 172.16.10.2 |
Send all packets destined for networks not in my routing table to 172.16.10.2 |
|
Router(config)#ip route 0.0.0.0 0.0.0.0 s0/0 |
Send all packets destined for networks not in my routing table out my Serial 0/0 interface |
Verifying Static Routes
|
Router#show ip route |
Displays contents of IP routing table |
Configuration Example: Static Routes
Figure 6-1 shows the network topology for the configuration that follows, which shows how to configure static routes using the commands covered in this chapter.
Figure 6-1 Network Topology for Static Route Configuration
Boston Router
|
Boston>en |
|
|
Boston#config t |
|
|
Boston(config)#ip route 172.16.30.0 255.255.255.0 172.16.20.2 |
Configures a static route using the next-hop address |
|
Boston(config)#ip route 172.16.40.0 255.255.255.0 172.16.20.2 |
|
|
Boston(config)#ip route 172.16.50.0 255.255.255.0 172.16.20.2 |
|
|
Boston(config)#exit |
|
|
Boston#copy run start |
|
Buffalo Router
|
Buffalo>en |
|
|
Buffalo#config t |
|
|
Buffalo(config)#ip route 172.16.10.0 255.255.255.0 s1 |
Configures a static route using the exit interface |
|
Buffalo(config)#ip route 172.16.50.0 255.255.255.0 s0 |
|
|
Boston(config)#exit |
|
|
Boston#copy run start |
|
Bangor Router
|
Bangor>en |
|
|
Bangor#config t |
|
|
Bangor(config)#ip route 0.0.0.0 0.0.0.0 s1 |
Configures a static route using the default route |
|
Bangor(config)#exit |
|
|
Bangor#copy run start |
|
