版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://blacknet.blog.51cto.com/99546/41374
下面的知识点要清楚理解的.具体做法在实验中显示出来
 
Static Routing and default Routing
静态路由管理距离1
静态路由使用在现实生活中就是点对点
动态路由是每秒更新的
下一跳地址不等同于下一跳路由
扩展ping的用法
S 192.168.50.0 [1/0]via 192.168.20.2
S代表静态路由
[1/0]分别为管理距离和度量值
Ip route [目标地址][目标地址子网掩码][下一跳地址]
默认路由
IP route 0.0.0.0 0.0.0.0 192.168.1.1
S*表示默认路由
 
这个知识点要记住:
默认的管理距离
路由源   默认
连接接口  0
静态路由  1          
EIGRP    90
IGRP     100
OSPF     110
RIP       120
Extemal EIGRP 170
未知         255 (这个路由将决不会被使用)
 
 
三台路由的静态路由实验
实验用的拓扑图:
三.三台路由器静态路由和默认路由实验_休闲
 
 
先为三台路由配置基本的IP地址
R1
R1(config)#interface f0/0  
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#interface serial1/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shut
R2
R2(config)#interface serial1/0
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shut
R2(config-if)#interface serial1/1
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shut
R3
R3(config)#interface f0/0
R3(config-if)#ip address 192.168.4.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#interface serial1/0
R3(config-if)#ip address 192.168.3.2 255.255.255.0
R3(config-if)#no shut
 
 
第一.使用静态路由. 配置静态路由,使各个网段能ping.静态路由的配置.
分别配置各个路由.把目标地址转发给下一跳的路由来处理..
  R1
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2
R1(config)#exit
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
S    192.168.4.0/24 [1/0] via 192.168.2.2
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, Serial1/0
S    192.168.3.0/24 [1/0] via 192.168.2.2
R1#ping 192.168.3.1                 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/202/644 ms
R1#ping 192.168.4.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.1, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
R1#ping 192.168.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
 
在还没有配置R2 R3 的静态路由时,ping192.168.3.1 不能ping192.168.3.2 也不能ping192.168.4.1  说明静态路由只能到达下一跳路由的地址.
 
R2
R2(config)#ip route 192.168.1.1 255.255.255.0 192.168.2.1
%Inconsistent address and mask   
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
R2#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 = 72/128/208 ms
R2#ping 192.168.4.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/66/116 ms
这里提示的错误就是把前面的192.168.1.0的网段写成了IP地址,我经常打错.要记得是到达的网络而不是到达的某个主机.  
测试可以ping 192.168.1.1 192.168.4.1
 
 
R3
R3(config)#IP route 192.168.1.0 255.255.255.0 192.168.3.1
R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
R3(config)#exit
R3#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
C    192.168.4.0/24 is directly connected, FastEthernet0/0
S    192.168.1.0/24 [1/0] via 192.168.3.1
S    192.168.2.0/24 [1/0] via 192.168.3.1
C    192.168.3.0/24 is directly connected, Serial1/0
 
ping命令测试成功. 192.168.1.0 ping 192.168.4.0可以通.反过来也是可以通的.
这时候三台路由的静态路由都已经配置好.show ip route 查看各个路由的路由表.观察每一项内容.
 
第二.使用默认路由.配置默认路由.使路由到达每个目标地址都转发到下一跳的地址来处理.
R1
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
R1(config)#exit
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 192.168.2.2 to network 0.0.0.0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, Serial1/0
S*   0.0.0.0/0 [1/0] via 192.168.2.2
 
R2
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.2
R2(config)#exit
R2#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 192.168.2.1 to network 0.0.0.0
C    192.168.2.0/24 is directly connected, Serial1/0
C    192.168.3.0/24 is directly connected, Serial1/1
S*   0.0.0.0/0 [1/0] via 192.168.2.1
               [1/0] via 192.168.3.2
 
R3
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.1
R3(config)#exit
R3#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 192.168.3.1 to network 0.0.0.0
C    192.168.4.0/24 is directly connected, FastEthernet0/0
C    192.168.3.0/24 is directly connected, Serial1/0
S*   0.0.0.0/0 [1/0] via 192.168.3.1
 
经过测试.各个网段都是可以互相ping通的.  这里要记住默认路由的意义和写法.
上面默认路由的源地址也可以用接口来表示(例如:ip route 0.0.0.0 0.0.0.0 s1/0)  还是规范表示的好.
平时我们家庭用的adsl路由就只有一条默认路由命令.有路由命令也叫路由器,哈....  把通向所有的目标地址都交给下一跳地址(这里指的是ISP动态分配给我们的IP,路由器会自动调节.).
 
实验总结:三台路由器的静态路由比二台路由器的复杂一些.但是只要熟悉配置静态路由的命令和理解原理也就不难.关键是要理清思路,理解原理. 掌握默认路由的意义.
路由配置回路. 掌握扩展ping的用法. 会用show ip route 查看并理解路由表的内容.
本文出自 “blacknet” 博客,请务必保留此出处http://blacknet.blog.51cto.com/99546/41374