配置静态路由
实验拓扑:

                                 

实验目的:使不同网段的路由器间能够相互ping通

实验步骤:路由器的简单配置
R1
Router>ena
Router#conf ter
Router(config)#host R1
R1(config)#int s2/0
R1(config-if)#ip add 192.168.1.2 255.255.255.0
R1(config-if)#no shut
R1(config)#int s3/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#clock rate 64000
R1(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
%LINK-5-CHANGED: Interface Serial3/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/0, changed state to up

R2
Router>
Router>ena
R2#conf ter
R2(config)#int s2/0
R2(config-if)#ip add 192.168.1.1 255.255.255.0
R2(config-if)#no shut
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
R2(config-if)#clock rate 64000
R2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R3
R3>ena
R3#conf ter
R3(config)#int s3/0
R3(config-if)#ip add 192.168.2.2 255.255.255.0
R3(config-if)#no shut
%LINK-5-CHANGED: Interface Serial3/0, changed state to up
R3(config-if)#clock rate 64000
R3(config-if)#
%SYS-5-CONFIG_I: Configured from console by console

实验调试:
   从R2 ping R1 的s2/0接口
   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 = 31/31/32 ms
    成功!
  ping s3/0接口
 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
  失败!
利用debug调试命令查看:

Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
IP: s=0.0.0.0 (local), d=192.168.2.1 len 0, unroutable.
IP: s=0.0.0.0 (local), d=192.168.2.1 len 0, unroutable.
IP: s=0.0.0.0 (local), d=192.168.2.1 len 0, unroutable.
IP: s=0.0.0.0 (local), d=192.168.2.1 len 0, unroutable.
IP: s=0.0.0.0 (local), d=192.168.2.1 len 0, unroutable.
Success rate is 0 percent (0/5)
 发现unroutable,则目标网络不可到达
查看路由表:
Gateway of last resort is not set
C    192.168.1.0/24 is directly connected, Serial2/0
发现只连接了一个网络,没有到目的网络的路由条目
增加静态路由
Router#conf ter
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
Router(config)#
再测试
Router#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms
可以ping 通R1的s3/0接口,再试一下R2的s3/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
失败!应该想到ping 是一个又向的过程,则应该在另一个路由器上增加一条到1.0网段的静态路由
在R3中增加静态路由:
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
再测试:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/63 ms
成功!
应该注意的是ping 是一个双向的过程