Monday, October 23, 2017

Static Route

In this post I will create a static route to route traffic from R0 (192.168.1.0/30 network) to R2 (192.168.1.4/30 network).


To begin with I check my routing table on R0.


R0#sh ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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

192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, Serial1/0


Currently I can only see directly connected interfaces. Without any static routes or routing protocols traffic from one network cannot reach the other.


R0#ping 192.168.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/11/24 ms

R0#ping 192.168.1.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.5, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)


I can ping the R1 interface on my network but not the interface on the other network. This is because R0 does not know where 192.168.1.5 is. By creating a static route I tell R0 which interface to send packets out of.


R0(config)#ip route 192.168.1.4 255.255.255.252 192.168.1.3 
R0(config)#end 


Now when I examine the route table I can see the static route I have created.


R0#sh ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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

192.168.1.0/30 is subnetted, 2 subnets
C 192.168.1.0 is directly connected, Serial1/0
S 192.168.1.4 [1/0] via 192.168.1.3


Now If I attempt to ping the ethernet interface on R1 I get a response.


R0#ping 192.168.1.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/8 ms


So what about R2?


R0#ping 192.168.1.6

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.6, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)


Well R2 is receiving the ICMP ping packets but it doesn't know how to get them back to me. By going to R2 and giving it a route to get back it will know which direction to send packets back.


R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 192.168.1.0 255.255.255.252 192.168.1.4


Because R1 know which networks it is directly connect to it happily passes the packets to the correct interface.


R1#sh ip route connected 
192.168.1.0/30 is subnetted, 2 subnets
C 192.168.1.0 is directly connected, Serial0/0
C 192.168.1.4 is directly connected, Ethernet1/0


Attempting to ping R2 from R0 now produces the desired result.

R0#ping 192.168.1.6

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.6, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/12/24 ms

No comments:

Post a Comment