静态路由配置(Static Routing)_Static
1.按照试验拓扑,配置好路由器的各个接口IP;
2.使用ping命令验证路由器之间的连同性,以r1为例:

r1#ping 10.3.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/67/116 ms
略......

再用r1 ping r2的loopback和r3的ip:

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

r1无法ping通r2的loopback地址和r3的ip地址,需要添加静态路由。
3.下面在3台路由器上使用命令ip route添加相应的静态路由:

r1(config)#ip route 192.168.1.0 255.255.255.0 10.3.3.2         //设置静态路由到192.168.1.0/24,                                                                                                   下一跳地址为10.3.3.2 r1(config)#ip route 172.16.3.0 255.255.255.0 10.3.3.2
r1(config)#ip route 172.16.1.0 255.255.255.0 10.3.3.2
r1(config)#ip route 172.16.2.0 255.255.255.224 10.3.3.2
r2(config)#ip route 10.1.1.0 255.255.255.0 10.3.3.1
r2(config)#ip route 10.2.2.0 255.255.255.224 10.3.3.1
r2(config)#ip route 172.16.1.0 255.255.255.0 172.16.3.1
r2(config)#ip route 172.16.2.0 255.255.255.224 172.16.3.1
r3(config)#ip route 192.168.1.0 255.255.255.0 172.16.3.2
r3(config)#ip route 10.3.3.0 255.255.255.0 172.16.3.2
r3(config)#ip route 10.1.1.0 255.255.255.0 172.16.3.2
r3(config)#ip route 10.2.2.0 255.255.255.224 172.16.3.2

然后再次验证:

r1#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/59/60 ms
其余略......

可以ping通。
查看一下r1的路由表:

r1#show 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
     172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
S       172.16.1.0/24 [1/0] via 10.3.3.2
S       172.16.2.0/27 [1/0] via 10.3.3.2
S       172.16.3.0/24 [1/0] via 10.3.3.2
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.3.3.0/24 is directly connected, Serial1/1
C       10.2.2.0/27 is directly connected, Loopback1
C       10.1.1.0/24 is directly connected, Loopback0
S    192.168.1.0/24 [1/0] via 10.3.3.2

S代表静态路由。(其余路由器略......)
总结:其实如果路由器属于末梢节点的话,可以只用一条默认路由也可以实现上面的效果,例如r1:

r1(config)#ip route 0.0.0.0 0.0.0.0 10.3.3.2

这样也可以ping通其余的ip地址。