Static routes are manually added to a routing table through direct configuration. Using a static route, a router can learn about a route to a remote network that is not directly attached to one of its interfaces. Note that, however, static routes are not widely used today, since you have to configure each static route manually on each router in the network.
Static routes are configured in the global configuration mode using the ip route DESTINATION_NETWORK SUBNET_MASK NEXT_HOP_IP_ADDRESS command. The NEXT_HOP_IP_ADDRESS parameter is the IP address of the next-hop router that will receive packets and forward them to the remote network. The router with the next-hop IP address must be on a directly connected network.
Consider the following example:
Let’s take a look at the routing table on R1:
Note that R1 knows about the two directly connected networks: 10.0.0.0/24 and 172.16.0.0/24. What it doesn’t know about, however, is the 192.168.0.0/24 network directly attached to R2. Let’s try to ping a host in that network:
The ping command fails because R1 doesn’t know where to send the packets. However, we can specify a static route that will rectify this problem:
With the command above, we’ve instructed R1 to send all packets destined for the 192.168.0.0/24 network to the IP address of 172.16.0.2 (the IP address of the Fa0/1 interface on R2). Let’s try to ping that same host again:
Because R1 now knows where to send packets, the ping command is successful.