IE-LAB网络实验室:HCIE认证培训 HCNA培训 路由优化概述和分布控制列表控制路由配置
在当今高性能的网络中,为了保证网络的伸缩性、稳定性、安全性和快速收敛,必须对网络进行优化。路由过滤和策略路由是路由优化的常用方法。路由过滤是指在路由更新中抑制某些路由不被发送和接收,被动接口、分布控制列表、重分布结合路由策略等都可以实现路由过滤。策略路由提供了根据网络管理者制定的标准来进行数据包转发的一种机制。基于策略的路由比传统路由能力更强,使用更灵活,它使网络管理者不仅能够根据目的地址而且能够根据协议类型、报文大小、应用或 IP 源地址来选择转发路径。策略路由的策略由路由映射图(route map)来定义。“route map”命令中最为重要的是“match”和“set”。match 用来定义匹配的条件,匹配语句在路由器的输入端口对数据包进行检测。常用的匹配条件包括 IP 地址、接口、度量值以及数据包长度等。set 定义对符合匹配条件的语句采取的行为。set ip next hop: 设定数据包的下一跳地址 set interface :设定数据包出接口 set ip default next hop :设定缺省的下一跳地址,用于当路由表里没有到数据包目的地址路由条目时 set default interface :设定缺省的出接口 set ip tos :设定 IP 数据包的 IP ToS 值 set ip precedence :设定 IP 数据包的优先级1. 一个 route map 的最后默认“deny any”。这个 deny 的使用结果依赖于这个 route map是怎样使用的。如果一个数据包对于 route map 没有匹配项,它会按照正常的目的地址路由转发,而对于路由条目如果 route map 没有匹配项,则被拒绝; 2. 一个 route map 可以包含多个 route map 陈述,这些语句的执行顺序像 ACL 一样,从上到下被执行。用分布控制列表控制路由更新:
本实验通过使用分布控制列表控制路由器 R1 只发送环回接口中第三位为奇数的路由和g0/0 接口的路由更新给 R2,整个网络运行 RIPv2 路由协议。实验步骤:路由器R1模拟PC机。路由器R2作为R1,路由器R3作为R2。配置接口IP地址:Router>enable Router#configure terminalRouter(config)#line console 0Router(config-line)#exec-timeout 0 0Router(config-line)#logging synchronous Router(config-line)#exit Router(config)#no ip domain-loRouter(config)#no ip domain-lookup Router(config)#hostname PCPC(config)#interface fastEthernet 0/0PC(config-if)#ip address 172.16.1.1 255.255.255.0PC(config-if)#no shutdown
Router>enable Router#configure terminalRouter(config)#line console 0Router(config-line)#exec-timeout 0 0Router(config-line)#logging synchronous Router(config-line)#exit Router(config)#no ip domain-lookup Router(config)#hostname R1R1(config)#interface fastEthernet 0/0 R1(config-if)#ip address 172.16.1.254 255.255.255.0R1(config-if)#no shutdown R1(config)#interface serial 2/0R1(config-if)#ip address 192.168.12.1 255.255.255.0R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface lo0R1(config-if)#ip address 1.1.0.1 255.255.255.0R1(config)#interface lo1R1(config-if)#ip address 1.1.1.1 255.255.255.0R1(config-if)#int lo2R1(config-if)#ip address 1.1.2.1 255.255.255.0R1(config-if)#int lo3R1(config-if)#ip address 1.1.3.1 255.255.255.0R1(config-if)#int lo4 R1(config-if)#ip address 1.1.4.1 255.255.255.0R1(config-if)#int lo5R1(config-if)#ip address 1.1.5.1 255.255.255.0R1(config-if)#int lo6R1(config-if)#ip address 1.1.6.1 255.255.255.0R1(config-if)#int lo7 R1(config-if)#ip address 1.1.7.1 255.255.255.0R1(config-if)#exit
Router>enable Router#configure terminalRouter(config)#line console 0Router(config-line)#exec-timeout 0 0Router(config-line)#logging synchronous Router(config-line)#exit Router(config)#no ip domain-lookup Router(config)#hostname R2R2(config)#interface serial 2/0R2(config-if)#ip address 192.168.12.2 255.255.255.0R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface lo0R2(config-if)#ip address 2.2.2.2 255.255.255.0R2(config-if)#exit
配置RIP动态路由协议。R1(config)#access-list 1 permit 172.16.1.0R1(config)#access-list 1 permit 1.1.1.0 0.0.254.0 //配置访问控制列表,允许第三位为奇数的路由R1(config)#router rip R1(config-router)#version 2R1(config-router)#no auto-summary R1(config-router)#network 1.0.0.0R1(config-router)#network 172.16.0.0R1(config-router)#network 192.168.12.0R1(config-router)#passive-interface default //默认为被动接口R1(config-router)#no passive-interface s2/0 //关闭默认接口R1(config-router)#distribute-list 1 out s2/0 //出方向配置分布控制列表
“distribute-list”命令可以全局的在一个出或入方向的路由更新中过滤路由,也可以为一个路由进程所涉及到的每一个接口的入方向或出方向设置路由过滤。
R2(config)#router rip R2(config-router)#version 2R2(config-router)#no auto-summary R2(config-router)#network 192.168.12.0R2(config-router)#network 2.0.0.0R2(config-router)#exit
配置完成。在R2上查看路由表:
学习到的路由条目表明R2只收到R1的以太网口和第三位为奇数的环回接口的路由。R1#show ip protocols
以上输出信息表明,全局下没有作用分布控制列表,在S2/0接口的出方向作用了分布控制列表。
CCNP培训机构 CCIE培训中心 HCIE认证培训HCNA培训
助教:马季
ie-lab网络实验室针对思科认证,ccie,ccna,ccnp认证,华为认证等课程! 授课经验丰富,师资力量雄厚! 通过网络报名所有课程6折起!咨询微信13126705344,电话同步!
页:
[1]