Configuring Static Routing

About Static Routing

Static routes are manually configured and define an explicit route between two networking devices. Static routes are useful for smaller networks with only one path to an outside network or to provide security for certain types of traffic in a larger network.

How to Configure Static Routing

Adding Static Routes

To add static routes, perform this procedure.

Procedure

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

[no] ip route dst-ip mask gate-ip

Example:

Device(config)# ip route 192.168.0.100 255.255.0.0 10.11.0.254 

Adds specified static routes to the table.

  • dst-ip : The destination address of the static route that needs to be added.

  • mask : The mask of the destination address.

  • gate-ip : The next-hop address of the static route.

Use the no ip route dst-ip mask [gate-ip] command to delete the configuration.

Step 4

no ip route static all

Example:

Device(config)# ip route static all 

Deletes all static routes in the table.

Monitoring Static Routes Configuration

The commands in the following table can be used to monitor static routes configurations.

Table 1. Monitoring Static Routes Cofiguration

Command

Purpose

show ip route [ip-address [mask] | static | rip | ospf]

Display the related information of specified routes as well as static routes such as the next-hop address, routing type etc.

  • ip-address : The destination address.

  • mask : The destination network segment presented with IP address.

  • static : Displays all static routes

  • rip : Displays all RIP routes.

  • ospf : Displays all OSPF routes.

Example: Static Routing

The following example shows how to add a network routing to 192.168.0.100 and set 10.11.0.254 as the next-hop.

Device> enable
Device# configure terminal 
Device(config)# ip route 192.168.0.100 255.255.0.0 10.11.0.254

The following example shows how to delete a network routing to 192.168.0.100.

Device> enable
Device# configure terminal 
Device(config)# no ip route 192.168.0.100 255.255.0.0 10.11.0.254

The following example shows how to delete all static routing.

Device> enable
Device# configure terminal 
Device(config)# no ip route static all