Configuring static routing on a Cisco router involves specifying explicit routes to destinations. Here’s a step-by-step guide:
- Access the Command Line Interface (CLI):
Connect to your Cisco router via console cable or SSH. - Enter Privileged Exec Mode:
Once connected, enter privileged exec mode by typing:
Bash
enableProvide the enable password if required.
- Enter Global Configuration Mode:
To configure static routes, enter global configuration mode:
Bash
configure terminalThis command allows you to make changes to the router’s settings.
- Add a Static Route:
To add a static route, use the following command:
Bash
ip route <destination_network> <subnet_mask> <next_hop_ip_address_or_exit_interface>is the network you want to reach.is the subnet mask for the destination network.is either the next hop IP address or the exit interface. For example:- To reach network 192.168.2.0/24 through next hop IP 10.0.0.2:
ip route 192.168.2.0 255.255.255.0 10.0.0.2 - To reach network 192.168.3.0/24 through exit interface GigabitEthernet0/0:
ip route 192.168.3.0 255.255.255.0 GigabitEthernet0/0
- Verify the Static Route:
Use the following command to verify that the static route has been added:
Bash
show ip routeThis command will display the routing table, including the static routes.
- Save the Configuration:
After configuring the static route, save the configuration:
Bash
write memoryor
Bash
copy running-config startup-configThis ensures that your static route persists after a reboot.
- Optional: Remove or Modify Static Routes:
If needed, you can remove or modify static routes using thenoform of theip routecommand, or by re-entering the command with new parameters.
Remember to adapt the commands to your specific network setup and requirements. Static routes are useful for small, simple networks, but may not be as scalable or flexible as dynamic routing protocols in larger or more complex environments. Always be cautious when making changes to a network device’s configuration, especially if it’s in a production environment.