This Tutorial shows you how to do Static Routing in Cisco Router.As shown in above Image ‘CCNA-RS-IMG-4.0’ there are three routers connected with each other through Serial Cable on Serial Interface of Router. To configure Static Routing in Router follow below steps
- Router Configuration Wizard
- Â Router R1 Configuration
R1> enable
R1# configure terminal
R1(config)# interface fastEthernet 0/0
R1(config-if)# ip address 192.168.10.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface Serial 1/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# clock rate 64000
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)#
- Router R2 Configuration
R2> enable
R2# configure terminal
R2(config)# interface fastEthernet 0/0
R2(config-if)# ip address 192.168.20.1 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)#
R2(config)# interface Serial 1/0
R2(config-if)# ip address 192.168.1.2 255.255.255.0
R2(config-if)# clock rate 64000
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)#
R2(config)# interface Serial 1/1
R2(config-if)# ip address 192.168.2.1 255.255.255.0
R2(config-if)# clock rate 64000
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)#
- Router R3 Configuration
R3> enable
R3# configure terminal
R3(config)# interface fastEthernet 0/0
R3(config-if)# ip address 192.168.30.1 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# exit
R3(config)#
R3(config)# interface Serial 1/0
R3(config-if)# ip address 192.168.2.2 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# exit
R3(config)#
- Configuring DHCP Server on each Router
R1> enable
R1# configure terminal
R1(config)# service dhcp ( To enable DHCP Server on router )
R1(config)# ip dhcp pool LAN_1_Address
R1(dhcp-config)# network 192.168.10.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.10.1
R1(dhcp-config)# dns-server 8.8.8.8
R1(dhcp-config)# exit
R1(config)# ip dhcp excluded-address 192.168.10.2 192.168.10.10 ( To exclude IP range that we dont want to assign)
R2> enable
R2# configure terminal
R2(config)# service dhcp ( To enable DHCP Server on router )
R2(config)# ip dhcp pool LAN_2_Address
R2(dhcp-config)# network 192.168.20.0 255.255.255.0
R2(dhcp-config)# default-router 192.168.20.1
R2(dhcp-config)# dns-server 8.8.8.8
R2(dhcp-config)# exit
R2(config)# ip dhcp excluded-address 192.168.20.2 192.168.20.10 ( To exclude IP range that we dont want to assign)
R3> enable
R3# configure terminal
R3(config)# service dhcp (To enable DHCP Server on router)
R3(config)# ip dhcp pool LAN_3_Address
R3(dhcp-config)# network 192.168.30.0 255.255.255.0
R3(dhcp-config)# default-router 192.168.30.1
R3(dhcp-config)# dns-server 8.8.8.8
R3(dhcp-config)# exit
R3(config)# ip dhcp excluded-address 192.168.30.2 192.168.30.10 (To exclude IP range that we dont want to assign)
- Verifying Connectivity from PC in 192.168.10.0/24 Network to PC in 192.168.20.0/24 Network
C:\>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::20A:41FF:FE0E:6467
IP Address......................: 192.168.10.13
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.10.1
C:\>ping 192.168.20.12
Pinging 192.168.20.12 with 32 bytes of data:
Reply from 192.168.10.1: Destination host unreachable.
Reply from 192.168.10.1: Destination host unreachable.
Reply from 192.168.10.1: Destination host unreachable.
Reply from 192.168.10.1: Destination host unreachable.
Ping statistics for 192.168.20.12:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
- As seen in above response we are not able to connect with another network.
Let us check in Router with IP Route Command
R1(config)#do 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 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.10.0/24 is directly connected, FastEthernet0/0
- As shown in above output the 192.168.20.0/24, 192.168.30.0/24 & 192.168.2.0/24 network are not present in Router R1 Routing Table, so it will not route the packet to that network. For that we need to add the Route to each & every Router in network so that they can connect with each other.
- Here we’ll add Classful (IP Having default Subnet Mask) route to Router Routing Table. In Static Routing the Network Administrator should have knowledge of each & every network that he want’s to connect & have to manually add that Route in Router’s Routing table as shown below
R1# configure terminal
R1(config)# ip route Destination prefix Destination prefix mask Next's HOP Address
R1(config)# ip route 192.168.20.0 255.255.255.0 192.168.1.2 (Here 192.168.1.2 is Address of Interface from where it would connect to 192.168.20.0/24 Network)
R1(config)# ip route 192.168.30.0 255.255.255.0 192.168.1.2
R1(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2
- Similarly for R2 & R3 Router
R2# configure terminal
R2(config)# ip route 192.168.10.0 255.255.255.0 192.168.1.1
R2(config)# ip route 192.168.30.0 255.255.255.0 192.168.2.2
R3# configure terminal
R3(config)# ip route 192.168.10.0 255.255.255.0 192.168.2.1
R3(config)# ip route 192.168.20.0 255.255.255.0 192.168.2.1
R3(config)# ip route 192.168.1.0 255.255.255.0 192.168.2.1
- Verifying from Router
R1(config)# do 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 192.168.1.0/24 is directly connected, Serial1/0
S 192.168.2.0/24 [1/0] via 192.168.1.2
C 192.168.10.0/24 is directly connected, FastEthernet0/0
S 192.168.20.0/24 [1/0] via 192.168.1.2
S 192.168.30.0/24 [1/0] via 192.168.1.2
As shown above the Routing table of Router R1 contains Route to all Network, so now it can PING or Connect to all the Network.
- Verifying Connection from PC
C:\>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::20A:41FF:FE0E:6467
IP Address......................: 192.168.10.13
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.10.1
C:\>ping 192.168.20.12
Pinging 192.168.20.12 with 32 bytes of data:
Reply from 192.168.20.12: bytes=32 time=2ms TTL=126
Reply from 192.168.20.12: bytes=32 time=1ms TTL=126
Reply from 192.168.20.12: bytes=32 time=1ms TTL=126
Reply from 192.168.20.12: bytes=32 time=1ms TTL=126
Ping statistics for 192.168.20.12:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms
Hence, Connection established.