CCNP精粹系列之二十--策略路由实战二,博主推荐文章

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介:
        管理距离
上一篇博文介绍了如何配置策略路由影响路由途径,缓解路由流量拥塞的问题,上篇博文的遗留问题先解决一下:
当一个问题没有解决时是难受的,相信自己的理解和配置没问题,那么肯定存在一个很小的疏忽,所以当把这个很小的疏忽解决掉之后,心情是最爽的,幸福都能体现出来,这种感觉是需要用心去寻找,用耐心去体验,所以第一关就是克服自己。
下面给出 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
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 51CTO博客,原文链接: http://blog.51cto.com/shenleigang/152038 ,如需转载请自行联系原作者



 
相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
Shell 数据安全/隐私保护 网络架构
|
网络协议 网络架构 数据安全/隐私保护