One of the most basic and fundamental routing are static routes. Tonight I'll show you how to configure a static route from the Green Network to the Red Network using Cisco Packet Tracer.
What is Packet Tracer? It's simulation software for Cisco networking equipment, it imitates Cisco IOS close to how you will see it in the real world. It's an amazing tool to practice networking without having to get actual networking equipment or Cisco IOS images. As of this writing the current version of Packet Tracer is 7.2.
As you can see I have set up 2 networks Red and Green; both routers are connected to each other with a serial cable. To do this you will need to click each router and add the HWIC-2T module to an empty slot on each router.
Red Network - 10.10.10.0 /24
Green Network - 192.168.1.0 /24
For anyone that is still up and alert at this hour with me, you may have noticed that I have another network - 172.16.0.0 /30, this network will be used specifically to connect the two routers. The cidr 30 (/30) indicates that only 2 devices can be used on this network. Ideal setup to avoid any unwanted routers being introduced into the topology. However that is a whole other topic (network security), all you have to know for now is that /30 only allows two devices in that network or subnet.
Now lets configure the routers! We will begin with Red Router, in the system configuration dialog enter no. We will do this manually and get our feet wet in Cisco IOS!
Just an FYI Ciso has three command modes, you can think of these as access levels similar to elevating to root in Linux. The first mode is user EXEC and is denoted by ">", this is level has very basic or read only access and is mostly for observation and basic diagnostic. The next level is privileged EXEC and is denoted by "#", this level will allow you to do more advance and resource intensive diagnostics as well as reboot the device. The final level is global configuration and it is denoted by "config", this level allows you to configure the router.
We are currently in user EXEC mode, lets elevate our rights and get into privileged EXEC:
en then press enter
Now lets take a look at all of the commands available to us, to do this type ? and press enter. Take a look at the show command, this will be the most popular informational command in your entire repertoire, it will show you numerous info about your device's current configuration and status. If you type show ? you will see all the options available to you.
Type show ip interface brief. This will show you the current status of the ports and whether or not they have IP addresses assigned to them. As you can see we have no IP addresses on any ports and all of them are down. Cool, I'll just connect a serial cable on interface serial0/0/0 of Red Router and likewise on Green Router.
SIDE NOTE: There is a specific numbering scheme to all of Cisco device interface. The '0/0/0' on Serial0/0/0 stands for chasis slot 0, module 0, interface 0.
Once the interfaces on both routers are connected lets hop back into the CLI and elevate to priviledged EXEC and lets check the status of interface serial0/0/0 (show ip interface brief).
Time to dig further, lets go into global configuration mode, type configure terminal or conf t. You should now see the prompt change to (config) #.
In order to edit the settings for interface serial0/0/0 we need to get into it, to do this type interface serial0/0/0 to get into it. This will change the prompt to Router (config-if) #
Give this interface an IP address of 172.16.0.1 and subnet mask 255.255.255.252. (Remember, this is the /30 network)
ip address 172.16.0.1 255.255.255.252
Last lets turn on this interface.
Now we're going to do the same thing on Green Router. Same procedure as before, go to global configuration mode and configure the IP address and subnet mask for interface serial0/0/0. The IP address for this port is 172.16.0.2 with a subnet mask of 255.255.255.252. Don't forget to enter no shutdown to activate the port. You may have noticed the the interface state and line protocol has changed to up. And our topology now shows green on the link.
Perfect, now let's exit out of global configuration mode and go back to privileged EXEC and test the connectivity between the devices.
Great, now Red and Green Router are communicating with each other.
Time to create the Red and Green Networks. We will start with the Green Network since we are already on it. Hop back into global configuration (shorthand: conf t) and we will use the loop back interface to function as the subnet.
I will use loopback 0 and assign it an IP address of 192.168.1.1 with a subnet mask of 255.255.255.0. You may notice that as soon as you enter loopback 0 interface it starts up right away. This is normal for virtual interfaces.
interface lookpback 0
ip address 192.168.1.1 255.255.255.0
interface loopback 0
ip address 10.10.10.1 255.255.255.0
Now that the loopback interfaces are configured let's see if we can ping loopback 0 on Red Router (10.10.10.1).
Nothing! Something is definitely wrong with this picture. While in privleged EXEC let's take a look at all the routes Green knows.
show ip route
So.... Green knows about the 172.16.0.0 /30 network on its serial 0/0/0 interface and the 192.168.1.0 /24 on it's loopback 0 interface, however it doesn't know about the 10.10.10.0 /24 network on Red. Let's check Red, it knows about the 172.16.0.0 /30 network since it's directly connected on it's serial 0/0/0 interface and the 10.10.10.0 /24 network on it's loopback 0 interface, but it doesn't know about the 192.168.1.0 /24 network.
Now the question you maybe asking is how do we get both routers to know about the different networks on their loopback interfaces? Easiest solution are static routes. Think of a static route as specific instruction on which interface or IP to use to get to a particular network. For example on Red, we will tell it to go through serial 0/0/0 if it wants to reach the 192.168.1.0 /24 network on Green. We don't have to use the interface, if you prefer IP address you can provide the next hop IP address, in this case it would be 172.16.0.2, which is the IP of the serial 0/0/0 interface on Green.
To configure the static routes, go into global config mode on Red.
To specifically tell Red of the other network on Green, use
ip route command.
ip route 192.168.1.0 255.255.255.0 serial 0/0/0
ip route 192.168.1.0 255.255.255.0 172.16.0.2
The first command tells Red to use the local serial 0/0/0 interface on Red to get to the 192.168.1.0 /24 network. The second command tells the Red to use the next hop IP address which is Green's IP address on serial 0/0/0 interface.
Let's go back to privileged EXEC mode and see the known routes on Red. Cool, there is static route to the 192.168.1.0 /24 via 172.16.0.2. We can clearly see that it's a static route based on the 'S' that is indicated in the beginning.
Now we should be able to ping the Green Network from Red.
And it's a success!
Finally we can can configure Green with a static route to the Red Network.
Once this is complete, you'll have configured static routes to both networks! Check out my configurations for both routers. (show run)
Building configuration... Current configuration : 933 bytes ! version 15.1 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname Router ! ! ! ! ! ! ! ! no ip cef no ipv6 cef ! ! ! ! license udi pid CISCO2911/K9 sn FTX15240W85- ! ! ! ! ! ! ! ! ! ! ! spanning-tree mode pvst ! ! ! ! ! ! interface Loopback0 ip address 192.168.1.1 255.255.255.0 ! interface GigabitEthernet0/0 no ip address duplex auto speed auto shutdown ! interface GigabitEthernet0/1 no ip address duplex auto speed auto shutdown ! interface GigabitEthernet0/2 no ip address duplex auto speed auto shutdown ! interface Serial0/0/0 ip address 172.16.0.2 255.255.255.252 ! interface Serial0/0/1 no ip address clock rate 2000000 shutdown ! interface Vlan1 no ip address shutdown ! ip classless ip route 10.10.10.0 255.255.255.0 Serial0/0/0 ! ip flow-export version 9 ! ! ! ! ! ! ! ! line con 0 ! line aux 0 ! line vty 0 4 login ! ! ! end Red Router: Building configuration... Current configuration : 952 bytes ! version 15.1 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption ! hostname Router ! ! ! ! ! ! ! ! no ip cef no ipv6 cef ! ! ! ! license udi pid CISCO2911/K9 sn FTX15243XIX- ! ! ! ! ! ! ! ! ! ! ! spanning-tree mode pvst ! ! ! ! ! ! interface Loopback0 ip address 10.10.10.1 255.255.255.0 ! interface GigabitEthernet0/0 no ip address duplex auto speed auto shutdown ! interface GigabitEthernet0/1 no ip address duplex auto speed auto shutdown ! interface GigabitEthernet0/2 no ip address duplex auto speed auto shutdown ! interface Serial0/0/0 ip address 172.16.0.1 255.255.255.252 clock rate 2000000 ! interface Serial0/0/1 no ip address clock rate 2000000 shutdown ! interface Vlan1 no ip address shutdown ! ip classless ip route 192.168.1.0 255.255.255.0 172.16.0.2 ! ip flow-export version 9 ! ! ! ! ! ! ! ! line con 0 ! line aux 0 ! line vty 0 4 login ! ! ! end