| 
      
        
 编者按:在针对常见的网络流量的拥塞问题的时候,可以通过利用对路由器的巧妙的设置来达到限速和顺畅的效果,尤其是修改管理距离来影响路径。管理路径越小,RIP环境的管理距离就要设得更小,就能实现想要的目的。    
上一篇博文介绍了如何配置策略路由影响路由途径,缓解路由流量拥塞的问题,上篇博文的遗留问题先解决一下:当一个问题没有解决时是难受的,相信自己的理解和配置没问题,那么肯定存在一个很小的疏忽,所以当把这个很小的疏忽解决掉之后,心情是最爽的,幸福都能体现出来,这种感觉是需要用心去寻找,用耐心去体验,所以第一关就是克服自己。 
下面给出30网段路由的路径: 
R1# 
R1#traceroute 
Protocol [ip]: 
Target IP address: 192.168.10.1 
Source address: 192.168.30.1 
Numeric display [n]: 
Timeout in seconds [3]: 
Probe count [3]: 
Minimum Time to Live [1]: 
Maximum Time to Live [30]: 5 
Port Number [33434]: 
Loose, Strict, Record, Timestamp, Verbose[none]: 
Type escape sequence to abort. 
Tracing the route to 192.168.10.1 
  
  1 202.110.100.2 36 msec 60 msec 48 msec 
  2 202.110.104.1 96 msec 156 msec 96 msec 
  3 202.110.103.1 192 msec 204 msec * 
R1# 
    
实现我们的预期的目的,解决了网络流量的拥塞难题,达到设备的合理利用。 
前途是光明的,道路是曲折的,所以我们需要共同努力,刻不容缓,让我们一起飞的更高,走进我的技术圈飞的更高……… 
下面来看今天新内容: 
那么方法不止一种,今天这篇博文将通过修改管理距离来影响路由的途径。 
  R2 :.   S1/1    202.110.101.1 255.255.255.0 
S1/2    202.110.104.2 255.255.255.0 
  
R3:S1/1    202.110.101.2 255.255.255.0 
.          S1/2   202.110.102.1 255.255.255.0 
R4 :S1/2    202.110.102.2 255.255.255.0 
.          S1/1  202.110.103.1 255.255.255.0 
R5 :S1/1    202.110.103.2 255.255.255.0 
.          S1/2  202.110.104.1 255.255.255.0 
  
在R1上做: 
Router(config)#host R2   
R2(config)#int s1/1 
R2(config-if)#ip addr 202.110.101.1 255.255.255.0 
R2(config-if)#encap hclc 
                     ^ 
% Invalid input detected at '^' marker. 
  
R2(config-if)#encap hdlc 
R2(config-if)#clock rate 56000 
R2(config-if)#no shut 
R2(config-if)# 
*Apr 21 17:05:13.907: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up 
*Apr 21 17:05:14.911: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up 
R2(config-if)#int s1/2 
R2(config-if)#ip addr 202.110.104.2 255.255.255.0 
R2(config-if)#encap hdlc 
R2(config-if)#clock rate 56000 
R2(config-if)#no shut 
R2(config-if)# 
*Apr 21 17:06:34.147: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up 
*Apr 21 17:06:35.151: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up 
R2(config-if)#exit   
R2(config)#router rip 
R2(config-router)#ver 2 
R2(config-router)#net 202.110.101.0 
R2(config-router)#net 202.110.104.0 
在R2上做: 
  
Router(config)#host R3 
R3(config)#int s1/1 
R3(config-if)#ip addr 202.110.101.2 255.255.255.0 
R3(config-if)#encap hdlc 
R3(config-if)#no shut 
R3(config-if)# 
*Apr 21 17:08:15.767: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up 
*Apr 21 17:08:16.771: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up 
R3(config-if)#int s1/2 
R3(config-if)#ip addr 202.110.102.1 255.255.255.0 
R3(config-if)#encap hdlc 
                        ^ 
% Invalid input detected at '^' marker. 
  
R3(config-if)#encap hdlc 
R3(config-if)#clock rate 56000 
R3(config-if)#no shut 
R3(config-if)#ex 
*Apr 21 17:08:58.267: %LINK-3-UPDOWN: Interface Serial1/2, changed state to upit   
R3(config)# 
*Apr 21 17:08:59.271: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up 
R3(config)#router rip 
R3(config-router)#net 202.110.101.0 
R3(config-router)#exit 
R3(config)#router ospf 100 
R3(config-router)#net 202.110.102.0 
注意:将R3的左端口配置为rip协议,右端口配置为ospf协议。 
在R4上做: 
Router(config)#host R4 
R4(config)#int s1/2 
R4(config-if)#ip addr 202.110.102.2 255.255.255.0 
R4(config-if)#encap hdlc 
R4(config-if)#no shut 
R4(config-if)# 
*Apr 21 17:11:09.087: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up 
*Apr 21 17:11:10.091: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up 
R4(config-if)#exit 
R4(config)#router ospf 100 
R4(config-router)#no router ospf 100 
R4(config)#int s1/1 
R4(config-if)#ip addr 202.110.103.1 255.255.255.0 
R4(config-if)#encap hdlc 
R4(config-if)#clock rate 56000   
http://www.luyouqiwang.com/14170 
R4(config-if)#no shut 
R4(config-if)#exit 
R4(config)# 
*Apr 21 17:12:34.627: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up 
R4(config)# 
*Apr 21 17:12:35.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up 
R4(config)#router ospf 100 
R4(config-router)#net 202.110.102.2 0.0.0.0 area 1 
R4(config-router)#ne t 
*Apr 21 17:12:57.895: %OSPF-5-ADJCHG: Process 100, Nbr 202.110.102.1 on Serial1/2 from LOADING to FULL, Loading Do 
% Incomplete command. 
  
R4(config-router)#net 202.110.103.1 0.0.0.0 area 1 
在R5上做: 
  
Router(config)#host R5 
R5(config)#int s1/1 
R5(config-if)#ip addr 202.110.103.2 255.255.255.0 
R5(config-if)#encap hdlc 
R5(config-if)#no shut 
R5(config-if)# 
*Apr 21 17:14:26.439: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up   
*Apr 21 17:14:27.443: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up 
R5(config-if)#exit 
R5(config)#int s1/2 
R5(config-if)#ip addr 202.110.104.1 255.255.255.0 
R5(config-if)#encap hdlc 
R5(config-if)#no shut 
R5(config-if)# 
*Apr 21 17:14:57.911: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up 
*Apr 21 17:14:58.915: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up 
R5(config-if)#exit 
R5(config)#router rip 
R5(config-router)#net 202.110.104.0 
R5(config-router)#ver2 
                     ^ 
% Invalid input detected at '^' marker. 
  
R5(config-router)#no router rip 
R5(config)#router rip 
R5(config-router)#ver 2 
R5(config-router)#net 202.110.104.0 
R5(config-router)#exit 
R5(config)#router ospf 100 
R5(config-router)#net 202.110.103.2 0.0.0.0 area 1   
  
由于不同路由协议间是不能通信的,所以必须要做路由的再发布,在边缘路由器上配置路由的再发布。 
首先是R3上: 
  
R3(config)#router ospf 100 
R3(config-router)#redistribute rip subnets 
R3(config-router)#router rip 
R3(config-router)#redistribute ospf 100 metric 3 
R5上同理: 
为了看到下面修改管理距离的清楚,我将发布的路由度量设置为相同的,假如都是3. 
R5(config)#router ospf 100 
R5(config-router)#redis 
R5(config-router)#redistribute rip subnets 
R5(config-router)#router rip 
R5(config-router)#redistribute ospf 100 metric 3 
  
测试:在R5上测试路由是有左侧的rip环境学到的,还是有右边的ospf环境学到的。 
  
R5#show ip ro 
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 
  
O E2 202.110.101.0/24 [110/20] via 202.110.103.1, 00:00:55, Serial1/1 
O    202.110.102.0/24 [110/128] via 202.110.103.1, 00:00:55, Serial1/1 
C    202.110.103.0/24 is directly connected, Serial1/1 
C    202.110.104.0/24 is directly connected, Serial1/2 
显然我们能看出,R5上路由是通过右边的ospf环境学到的,下面我将通过修改管理距离改变路由的路径,这篇博文的精彩点是由这一刻开始的,还望耐心学习下去。 
由于管理距离越小越好,所以人为将rip环境的管理距离设小一点,让R5学到的路由从rip学到,我们今天的任务就圆满成功了。   
下面配置修改管理距离: 
R3: 
R3(config)#router ospf 100 
R3(config-router)#distance 150 0.0.0.0 255.255.255.255  5 //匹配5号表 
R3(config-router)#exit 
R3(config)#access-list 5 permit 202.110.101.0 0.0.0.255 
R5上做修改: 
  
R5(config)#router ospf 100 
R5(config-router)#distance 100 0.0.0.0 255.255.255.255 6//匹配6号表 
  
R5(config-router)#exit 
R5(config)#access-list 6 permit 202.110.104.0 0.0.0.255 
再在R5上测试看学习到的101网段的路由路径: 
尚未完善,有待解决。 (作者:shenleigang)    |