Static route in a router

In this article I describe the term Static route in a router related to networking. IP routing in router is a process of packet transfer between different networks via a router. Static route in a router is a type of IP routing in router. When we access the internet or intranet the data packets transmitted and received by IP routing in router. Every interface of router has a different network.

Routers are also known as layer3 device. Various routing and routed protocols used for moving packets between different networks. Generally the IP routing in router is done by static routing, default routing and dynamic routing protocols. Before understanding the static route in a router it will be good to understands about IP routing in router.

Requirement of IP routing in router

The function of a router is to move the data packets from one interface to another interface or we can say between different networks. The movement of packets done at layer 3 which is known as network layer of the OSI reference model. Router keep the information of neighbour router and network in its routing table.

There may be many interfaces in a router which connect different networks. How the router moves the packet to its destination it depends on routing and routed protocol. Static route in a router is a set of protocols which allow the router to transfer the packet to its destination. To understand the IP routing in router it is necessary to know about the routing and routed protocol firstly.

Routing protocol for IP routing in router

Routing protocols helps router to build and maintain the routing table in routers. Routing protocols are one important part of IP routing in router. Routing protocols inform the router about the networks connected at each interface. Routing protocols doesn’t carry or push the data packets in any way. Any change in the network required to be update in the routing tables of all routers. This task is carried out by the routing protocols. Routing protocols help the routers to select the best path to exit the data packets.

Example of routing protocols are RIP, RIPv2, IGRP,OSPF etc. Routing protocols further divided into distance vector, link state and hybrid protocols. These all routing protocols update the routing table of all routers in the network. You can see the routing protocols by “show ip route” command in privilege command mode of router. Routing protocols are not responsible for data packet flow in any way. Routing protocols spread the information of network hierarchy to all routers.

Routed protocol for IP routing in router

Routed protocol works with the data packets for IP routing in router. Routed protocol sends the data packets within a router’s interfaces. Routing protocol decide the best path and routed protocol send the packets on these paths. Routed protocols are defined on interfaces of router. Routed protocols do not update or maintain the routing table in a router. Routed protocols are responsible for flow of data packets from one network to another network.

Routed protocols sends the data packets to correct exit interface of the router. Routed protocols are configured on interfaces of the router. Example of routed protocols are IP, IPv6, IPX and Appletalk. Routed protocols are basically addressing schema of the interfaces of router. Router identify the destination network of a data packet and send the data packet to correct exit interface. The concept of subnetting takes place in routed protocols.   

You may also like to read --  IP Routing in Router

Fundamentals of IP routing in router

We know that routers used to connect the different LAN and WAN. We required to connect the different network with a router physically firstly. After completion of physical connectivity next step is to configure the logical network addresses and routing protocols. Each LAN or WAN works in a fix network ID. In case of router I mention the network ID for each LAN. When we work in a LAN, I mention the IP address for each host. Each host assigned a gateway which is the interface of the router to out the packet from that LAN. Router do not forward the packet to host. Router transfer the packet for network ID.

The flow of packets between different LAN depends on destination address on the packet. All routers maintain the routing table to determine the best route to remote network. Routing protocol keep update the routing table in IOS of router. The routing table help to find the destination network of a packet. Basically multiple protocols works for IP routing in router to transfer the data between different networks.

Commands to check the routing table

We can see the routing table in privilege command mode of router. “show ip route” command can be use to check the routing table in a router. see the below command which show the routing table of the router.

Router>en
Router#show ip route
Codes: C - connected, S - static, I - IGRP, 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
 
C 2.0.0.0/8 is directly connected, Loopback0
C 10.0.0.0/8 is directly connected, Serial0/0/0
C 11.0.0.0/8 is directly connected, Serial0/0/1
192.165.23.0/32 is subnetted, 1 subnets
O 192.165.23.1 [110/65] via 10.0.0.1, 00:00:02, Serial0/0/0
192.168.25.0/32 is subnetted, 1 subnets
O 192.168.25.1 [110/65] via 10.0.0.1, 00:00:02, Serial0/0/0
192.168.30.0/32 is subnetted, 1 subnets
O 192.168.30.1 [110/65] via 10.0.0.1, 00:00:02, Serial0/0/0
 
Router#

Static Route in a Router explained with example

Static route in a router configured manually. Static route in a router used to transfer the data packet to right next hope so the data packet can be sent to its destination network segment. The Static route  used in small networks. Router communicate with the next connected network device automatically.

Router can not save the network ID beyond the next router. network administrator manually configured the network ID beyond the next router in routing table. Static route in a router are not advertise routing table automatically. If there is any change occurs in the network, network administrator needs  to do changes in routing table manually. In complex or large network static routing in a router is very critical so dynamic routing done in router.

Purpose of Static route in a router

Static route in a router describe the exit interface for a data packet. Static route in router is very efficient in small networks because the engagement time for broadcasting the routing table is not available.

Configuration of static route in a router

We created a small network with two routers as shown in picture. There are three different networks with network ID 10.0.0.0/8, 192.168.1.1/24 and 10.10.10.0/24. We configure the static routes in both routers so network 10.0.0.0/8 and 10.10.10.0/24 can communicate with each other.

You may also like to read --  Working of IPv6 in Internetwork
static route in router, ccna, ccna tutorials

Configure the PC1 IP address 10.0.0.5/8 and gateway 10.0.0.1 similarly the PC2 IP address 10.10.10.5/24 and gateway 10.10.10.1.

Configuring the IP address of Router 1 interfaces

We need to enter in Global configuration mode to set the IP address of interfaces in any router. The interface Gigabitethernet0/0/0 relates to PC1 and require the IP address 10.0.0.1/8. The interface Gigabitethernet0/0/1 relates to Router 2 and require the IP address 192.168.1.1/28. Following commands are used for setup the IP address on both interfaces

 Router1>enable
 Router1#
 Router1#configure terminal
 Enter configuration commands, one per line. End with CNTL/Z.
 Router1(config)#interface GigabitEthernet0/0/0
 Router1(config-if)#ip address 10.0.0.1 255.0.0.0
 Router1(config-if)#no shutdown
 Router1(config-if)#
  
 %LINK-5-CHANGED: Interface GigabitEthernet0/0/0, changed state to up
  
 %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/0, changed state to up
  
 Router1(config-if)#exit
 Router1(config)#interface GigabitEthernet0/0/1
 Router1(config-if)#ip address 192.168.1.1 255.255.255.240
 Router1(config-if)#no shutdown
 Router1(config-if)#
  
 %LINK-5-CHANGED: Interface GigabitEthernet0/0/1, changed state to up
  
 %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/1, changed state to up 

Configuring the IP address of Router 2 interfaces

We need to enter in Global configuration mode to set the IP address of interfaces in any router. The interface Gigabitethernet0/0/0 relates to Router1 and require the IP address 192.168.1.2/28. The interface Gigabitethernet0/0/1 relates to PC2 and require the IP address 10.10.10.1/24. Following commands are used for setup the IP address on both interfaces

 Router2>enable
 Router2#
 Router2#configure terminal
 Enter configuration commands, one per line. End with CNTL/Z.
 Router2(config)#interface GigabitEthernet0/0/0
 Router2(config-if)#ip address 192.168.1.2 255.255.255.240
 Router2(config-if)#no shutdown
 Router2(config-if)#
  
 %LINK-5-CHANGED: Interface GigabitEthernet0/0/0, changed state to up
  
 %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/0, changed state to up
  
 Router2(config-if)#exit
 Router2(config)#interface GigabitEthernet0/0/1
 Router2(config-if)#ip address 10.10.10.1 255.255.255.0
 Router2(config-if)#no shutdown
 Router2(config-if)#
  
 %LINK-5-CHANGED: Interface GigabitEthernet0/0/1, changed state to up
  
 %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0/1, changed state to up 

After configuring both router’s interface try to ping the PC1 with PC2. You can see that PC1 is not pinging PC2. See the result below

 C:\>ping 10.10.10.5
  
 Pinging 10.10.10.5 with 32 bytes of data:
  
 Request timed out.
 Request timed out.
 Request timed out.
 Request timed out.
  
 Ping statistics for 10.10.10.5:
     Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), 

Routing in both routers required to communicate PC1 with PC2. Now we configure the static route in both routers 1 and 2. A router itself identify the next hope IP address. For example, here router 2 connected with Gigabitethernet0/0/1 interface of router1. Router1 identify the IP address of router2 interface which is connected with it. Similarly, router 2 identify the ip address of router1 interface. The formula for static router is following

static route in router, ccna, ccna tutorials

Configuration of static route in router 1

Router 1 identify the two networks connected with it are 10.0.0.0/8 and 192.168.1.0/28. Router 1 do not know about the network 10.10.10.0/24. By configuring static route in router1, we set the path of packets for destination 10.10.10.0/24. Run below commands to set the static route in router1.

 Router1>enable
 Router1#
 Router1#configure terminal
 Enter configuration commands, one per line. End with CNTL/Z.
 Router1(config)#ip route 10.10.10.0 255.255.255.0 192.168.1.2
 Router1(config)# 

Check the static routing in router 1 by running following command. In the result you can see the static route 10.10.10.0/24 via 192.168.1.2. other directly connected network also shown in the result of show ip route command

 Router1>
 Router1>en
 Router1#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, 3 subnets, 3 masks
 C 10.0.0.0/8 is directly connected, GigabitEthernet0/0/0
 L 10.0.0.1/32 is directly connected, GigabitEthernet0/0/0
 S 10.10.10.0/24 [1/0] via 192.168.1.2
 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
 C 192.168.1.0/28 is directly connected, GigabitEthernet0/0/1
 L 192.168.1.1/32 is directly connected, GigabitEthernet0/0/1
 Router1# 

Configuration of static route in router 2

Router 2 identify the two networks connected with it are 192.168.1.0/28 and 10.10.10.0/24. Router 2 do not know about the network 10.0.0.0/8. By configuring static route in router2, we set the path of packets for destination 10.0.0.0/8. Run below commands to set the static route in router2.

 Router2>enable
 Router2#
 Router2#configure terminal
 Enter configuration commands, one per line. End with CNTL/Z.
 Router2(config)#ip route 10.0.0.0 255.0.0.0 192.168.1.1
 Router2(config)# 

Check the static routing in router 2 by running command show ip router in privilege mode. In the result you can see all directly connected network id and static route for 10.0.0.0/8 via 192.168.1.1.

 Router2>en
 Router2#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, 3 subnets, 3 masks
 S 10.0.0.0/8 [1/0] via 192.168.1.1
 C 10.10.10.0/24 is directly connected, GigabitEthernet0/0/1
 L 10.10.10.1/32 is directly connected, GigabitEthernet0/0/1
 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
 C 192.168.1.0/28 is directly connected, GigabitEthernet0/0/0
 L 192.168.1.2/32 is directly connected, GigabitEthernet0/0/0
  
 Router2# 

After configuring the static route in both routers try to ping PC1 with PC2. You will get the result as below

 C:\>ping 10.10.10.5
  
 Pinging 10.10.10.5 with 32 bytes of data:
  
 Reply from 10.10.10.5: bytes=32 time<1ms TTL=126
 Reply from 10.10.10.5: bytes=32 time<1ms TTL=126
 Reply from 10.10.10.5: bytes=32 time<1ms TTL=126
 Reply from 10.10.10.5: bytes=32 time<1ms TTL=126
  
 Ping statistics for 10.10.10.5:
     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
 Approximate round trip times in milli-seconds:
     Minimum = 0ms, Maximum = 0ms, Average = 0ms 

I hope this article may be helpful to you to understand and configure the static route in router. For any query or suggestion on this article you may contact us or drop a comment below.

Share this article in your social circle :)
,

1 thought on “Static route in a router

  1. Magnificent beat ! I would like to apprentice while you amend your site, how could i subscribe for a blog web site? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear concept

Leave a Reply

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