Learn Cisco CLI – Part 9 – Configuring Static Routes

Table of Contents
Learn Cisco CLI - Part 9

Configuring Static Routes

These blog posts I created to help me as a reference tool, as well as a way of retaining the knowledge. If you find it useful that’s just a plus.

Static routes are manually configured routes that tell a router where to send packets destined for a particular network. Unlike dynamic routing protocols, static routes do not adjust to changes in the network automatically, which makes them ideal for small, stable networks where routes rarely change.

Static routes are particularly useful in scenarios where:

  • The network is small and does not require the overhead of dynamic routing protocols.
  • You need to define a default route or a route to a specific destination network.
  • Precise control over routing paths is required.

Configuration Commands

Interface

Changes from global configuration mode to interface configuration mode, allowing you to configure a specific interface.

				
					Syntax:
interface [type] [number]
				
			
  • [type]: The type of interface (e.g., GigabitEthernet, Serial).
  • [number]: The interface number (e.g., 0/0, 1/0).

Example:

				
					Router1>enable
Router1#configure terminal
Router1(config)#interface GigabitEthernet0/1 
Router1(config-if)#
				
			
IP Address

Assigns an IP address to an interface. This is necessary for the interface to participate in routing and to serve as the next-hop IP address for static routes.

				
					Syntax:
ip address [ip-address] [subnet-mask]
				
			

Example:

				
					Router1>enable
Router1#configure terminal
Router1(config)#interface GigabitEthernet0/1 
Router1(config-if)#ip address 192.168.1.1 255.255.255.0 
				
			

IP Route

Establishes a static route. This command tells the router how to reach a specific destination network by specifying the destination network, subnet mask, and either the next-hop IP address or the outgoing interface.

				
					Syntax:
ip route [destination-prefix] [destination-prefix-mask] [ip-address | interface-type]
				
			
  • [destination-prefix]: The network address of the destination network.
  • [destination-prefix-mask]: The subnet mask of the destination network.
  • [ip-address]: The IP address of the next-hop router (or)
  • [interface-type]: The outgoing interface.

Example 1: Configuring a static route to network 192.168.2.0/24 via next-hop IP 192.168.1.2

				
					Router1>enable
Router1#configure terminal
Router1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
				
			

Example 2: Configuring a static route to network 192.168.2.0/24 via the GigabitEthernet0/1 interface.

				
					Router1>enable
Router1#configure terminal
Router1(config)#ip route 192.168.2.0 255.255.255.0 GigabitEthernet0/1 
				
			

Verification and Troubleshooting

Show IP Route

Displays the IP routing table, including static routes. This command is essential for verifying that the static routes have been configured correctly.

				
					Syntax:
show ip route
				
			

Example:

				
					Router1>enable
Router1#show ip route
				
			

Example Output:

				
					Gateway of last resort is 192.168.1.2 to network 0.0.0.0

S    192.168.2.0/24 [1/0] via 192.168.1.2

				
			

Show Running-Config

Displays the active configuration file, allowing you to verify static route configurations and other settings.

				
					Syntax:
show running-config
				
			

Example:

				
					Router1>enable
Router1#show running-config
				
			

Ping

Sends an ICMP echo request to a specified IP address to test connectivity and verify that the static route is functioning as expected.

				
					Syntax:
ping [ip-address]
				
			

Example:

				
					Router1>enable
Router1#ping 192.168.2.1 
				
			

Example Output:

				
					Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

				
			

Leave a Comment