How to Configure Static Routing in Cisco Packet Tracer

In this article, we will communicate with computers in two different segments with Static Routing.

How to Configure Static Routing in Cisco Packet Tracer

How to Configure Static Routing on Cisco Router

There are two types of routing. These;

1. Static Routing
2. Dynamic Routing

In this article, after explaining what Static Routing is and how it works, we will configure routing in a small network environment.

If the network environment consists of several Routers, it is recommended that you use static routes for routing. This is because when routers are configured with Dynamic Routing, they run slower in performance. However, in a small network environment, we can manually add routes to make the routers more efficient.

You need to manually configure this type of routing. However, in a growing network, it would be difficult to do this, so you can use one of the dynamic routing types.

Now, to add a static route to your routers with Cisco Packet Tracer, follow the steps below.

   Step 1

Open the simulator program and configure the TCP/IP settings of the computers after creating the network topology as shown in the image below.

A Network Design with Two Routers

   Step 2

To configure the GigabitEthernet and Serial interfaces of the Cisco Router, open the CLI prompt and execute the following commands.

Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#
R1(config)#interface gigabitethernet 0/0
R1(config-if)#ip address 192.168.5.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#
R1(config)#interface serial0/1/0
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to down
R1(config-if)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#

 
Configuring R1's Gig0/0 and Se0/1/0 Interfaces

   Step 3

In the same way, configure the GigabitEthernet and Serial interfaces of the R2 router with the following commands.

Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#
R2(config)#interface gigabitethernet 0/0
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R2(config-if)#exit
R2(config)#
R2(config)#interface serial 0/1/0
R2(config-if)#ip address 10.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to up
R2(config-if)#end
R2#

 
Configuring R2's Gig0/0 and Se0/1/1 Interfaces

   Step 4

Before adding a static route to the routers, ping the default gateway from PC0 and the Serial interface of R1 to test the network connection.

Pinging will be successful as follows.

Ping from PC0 to R1

   Step 5

Also, test the connection by pinging the default gateway via PC1 and the Serial interface of the R2 to which it is connected.

Ping from PC1 to R2

   Step 6

When you ping the PC0 to the Serial interface of Cisco Router R2 and the computer on its 192.168.5.0/24 network, it will fail as shown in the image below.

Ping PC0 to R2

   Step 7

Also, ping R11’s interfaces from PC1 and check the result.

Ping from PC1 to R1

   Step 8

Pinging between clients in two segments failed because no routing enabled in the network environment. If you ping the Router from the Router according to this network design, you will see that the result is successful.

For example, ping from R1 to R2 would be successful as follows;

Ping Test from R1 to R2

   Step 9

Pinging from R2 to R1 will also be successful.

Ping Test from R2 to R1

   Step 10

Now add a static route to the Routers so that PC0 can communicate with PC1. To add a static route to R1, execute the command ip route 192.168.10.0 255.255.255.0 10.1.1.2.

R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 192.168.10.0 255.255.255.0 10.1.1.2
R1(config)#exit
R1#

 
R1(config)#ip route 192.168.10.0 255.255.255.0 10.1.1.2

After enabling Static routing on R1, execute the show ip route command and check whether the output contains line S 192.168.10.0/24 via 10.1.1.2.

R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Serial0/1/0
L 10.1.1.1/32 is directly connected, Serial0/1/0
192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.5.0/24 is directly connected, GigabitEthernet0/0
L 192.168.5.1/32 is directly connected, GigabitEthernet0/0
S 192.168.10.0/24  via 10.1.1.2
R1#

 
S    192.168.10.0/24 via 10.1.1.2 ⇒ This line indicates that PC0 will reach the network environment 192.168.10.0/24 via the IP address 10.1.1.2.

   Step 11

To add a static route to R2, use the following command:

R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#ip route 192.168.5.0 255.255.255.0 10.1.1.1
R2(config)#
R2(config)#exit
R2#

 
R2(config)#ip route 192.168.5.0 255.255.255.0 10.1.1.1

Show ip route command output in R2;

R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Serial0/1/0
L 10.1.1.2/32 is directly connected, Serial0/1/0
S 192.168.5.0/24  via 10.1.1.1
192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
R2#

 
S    192.168.5.0/24 via 10.1.1.1 ⇒ This line indicates that PC1 will access the network environment 192.168.5.0/24 via IP address 10.1.1.1.

   Step 12

After configuring Static Routing on routers, test the connection by pinging PC0 to PC1. Clients in two different locations will now be able to communicate successfully with each other.

Ping Test from PC0 to PC1

   Step 13

Likewise, when pinging from PC1 to PC0, ping will be successful as follows.

Ping Test from PC1 to PC0

Show Commands

R1#show running-config
Building configuration...

Current configuration : 813 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
no ip cef
no ipv6 cef
!
license udi pid CISCO1941/K9 sn FTX152494BG
!
spanning-tree mode pvst
!
interface GigabitEthernet0/0
ip address 192.168.5.1 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/1/0
ip address 10.1.1.1 255.255.255.0
clock rate 2000000
!
interface Serial0/1/1
no ip address
clock rate 2000000
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 192.168.10.0 255.255.255.0 10.1.1.2
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end
R1#

 

R2#show running-config
Building configuration...

Current configuration : 793 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
no ip cef
no ipv6 cef
!
license udi pid CISCO1941/K9 sn FTX1524GA8Z
!
spanning-tree mode pvst
!
interface GigabitEthernet0/0
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/1/0
ip address 10.1.1.2 255.255.255.0
!
interface Serial0/1/1
no ip address
clock rate 2000000
shutdown
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 192.168.5.0 255.255.255.0 10.1.1.1
!
ip flow-export version 9
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
end
R2#

 

   Video

You can watch the video below to enable Static Routing on Packet Tracer and also subscribe to our YouTube channel to support us!

   Final Word


In this article, we have added static routes to two routers using the Cisco simulator software and communicated computers in two segments. Thanks for following us!

   Related Articles


Creating a Network
♦ Cisco DHCP
♦ Cisco Telnet
♦ Cisco SSH
♦ Cisco Static NAT

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *