OSPF与EIGRP协议的路由重分布
- 格式:doc
- 大小:212.00 KB
- 文档页数:5
RGNOSv10.3(3)BGP和OSPF在路由重分发时的注意点2008-5-15福建星网锐捷网络有限公司版权所有侵权必究前言本文档介绍了RGNOS V10.3(3)中BGP和OSPF路由重发布时的一些实现特点。
由于这些特点区别于友商CISCO的BGP功能实现,在具体的项目实施过程中需要注意。
1.☹本文档仅限公司内部使用,严禁外传。
1.☺如果您在阅读中产生疑问,请与文档维护人联系。
目录1. 1OSPF重分发BGP路由1. 1.1注意点1. 这里Cisco验证的版本为c7200-adventerprisek9-mz.124-9.T1.bin2. 1.2应用实例1. 1.2.1网络拓扑四台设备之间建立EBGP/IBGP/EBGP连接。
C1为CISCO 3550、C2、C3是Cisco模拟器,R1是我司设备,实验设备为RG-S5750。
C1和R1建立EBGP连接,R1和C2建立IBGP连接,C2和C3建立EBGP连接。
其中C1和C3主要是发送路由,具体的操作在R1和C2。
2. 1.2.2配置文件C1 简化配置C1#sho running-configBuilding configuration...Current configuration : 2557 bytes!version 12.2no service padservice timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname C1!!no aaa new-modelip subnet-zeroip routing!!!!!!no file verify autospanning-tree mode pvstspanning-tree extend system-id!vlan internal allocation policy ascending!!interface Loopback0ip address 1.1.1.1 255.255.255.255!interface FastEthernet0/1no switchportip address 192.168.16.1 255.255.255.248!interface FastEthernet0/2switchport mode dynamic desirable!interface FastEthernet0/3switchport mode dynamic desirable!...!router bgp 1no synchronizationbgp log-neighbor-changesredistribute staticneighbor 192.168.16.2 remote-as 23no auto-summary!ip classlessip route 192.168.111.0 255.255.255.0 Loopback0ip route 192.168.112.0 255.255.255.0 Loopback0ip http serverip http secure-server!!!control-plane!!line con 0line vty 0 4privilege level 15password wlogin!!endC1#C2简化配置C2#sho runnBuilding configuration...Current configuration : 1450 bytes!version 12.4service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname C2!boot-start-markerwarm-rebootboot-end-marker!!no aaa new-model!resource policy!ip cef!!!!interface Loopback0ip address 192.168.125.1 255.255.255.0 secondary ip address 192.168.126.1 255.255.255.0 secondary ip address 2.2.2.2 255.255.255.255!interface FastEthernet0/0ip address 192.168.26.2 255.255.255.248duplex full!interface Ethernet1/0no ip addressshutdownduplex half!interface Ethernet1/1no ip addressshutdownduplex half!interface Ethernet1/2no ip addressshutdownduplex half!interface Ethernet1/3ip address 192.168.23.1 255.255.255.248duplex full!router ospf 1log-adjacency-changesnetwork 2.2.2.2 0.0.0.0 area 0network 192.168.26.0 0.0.0.7 area 0!router bgp 23no synchronizationbgp log-neighbor-changesnetwork 192.168.125.0network 192.168.126.0neighbor 6.6.6.6 remote-as 23neighbor 6.6.6.6 update-source Loopback0neighbor 6.6.6.6 next-hop-selfneighbor 192.168.23.2 remote-as 3no auto-summary!no ip http serverno ip http secure-server!!...!line con 0stopbits 1line aux 0line vty 0 4privilege level 15password wlogin!!endC2#C3简化配置C3#sho runnBuilding configuration...Current configuration : 1178 bytes!version 12.4service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname C3!boot-start-markerboot-end-marker!!no aaa new-model!resource policy!ip cef!!!!!!interface Loopback0ip address 3.3.3.3 255.255.255.255!interface FastEthernet0/0no ip addressshutdownduplex full!interface Ethernet1/0no ip addressshutdownduplex half!interface Ethernet1/1no ip addressshutdownduplex half!interface Ethernet1/2no ip addressshutdownduplex half!interface Ethernet1/3ip address 192.168.23.2 255.255.255.248duplex full!router bgp 3no synchronizationbgp log-neighbor-changesredistribute staticneighbor 192.168.23.1 remote-as 23no auto-summary!ip route 192.168.131.0 255.255.255.0 Loopback0ip route 192.168.132.0 255.255.255.0 Loopback0no ip http serverno ip http secure-server!!!logging alarm informational!...!line con 0stopbits 1line aux 0line vty 0 4privilege level 15password wlogin!!endC2#R1简化配置R1#show runnBuilding configuration...Current configuration : 2080 bytes!version RGNOS 10.3.00(3), Release(38105)(Fri Apr 25 15:29:44 CST 2008 -ngcf31)hostname R1co-operate enable!!!!route-map ospf_redist permit 10match route-type external!vlan 1!!!!!interface GigabitEthernet 0/1no switchportno ip proxy-arpip address 192.168.26.1 255.255.255.248!interface GigabitEthernet 0/2!...!interface GigabitEthernet 0/23!interface GigabitEthernet 0/24no switchportno ip proxy-arpip address 192.168.16.2 255.255.255.248!interface Loopback 0ip address 6.6.6.6 255.255.255.255ip address 192.168.165.1 255.255.255.0 secondaryip address 192.168.166.1 255.255.255.0 secondary!!!!!!!!router bgp 23neighbor 2.2.2.2 remote-as 23neighbor 2.2.2.2 update-source Loopback 0neighbor 192.168.16.1 remote-as 1!address-family ipv4network 192.168.165.0network 192.168.166.0neighbor 2.2.2.2 activateneighbor 2.2.2.2 next-hop-selfneighbor 192.168.16.1 activateexit-address-family!!router ospf 1router-id 6.6.6.6network 6.6.6.6 0.0.0.0 area 0network 192.168.26.0 0.0.0.7 area 0!!!ip route 192.168.161.0 255.255.255.0 Loopback 0ip route 192.168.162.0 255.255.255.0 Loopback 0!!line con 0line vty 0 10privilege level 15loginpassword w!!end3. 1.2.3检验配置效果C2使用show ip bgp可以看到125.0/126.0是源发路由,111.0/112.0/165.0/166.0是IBGP路由,131.0/132.0是EBGP路由。
【实验要求】按照拓扑搭建网络,对RIP 和OSPF 做双点双向重分发。
使得全网全互联。
并对重分发带来的故障解决和分析。
【实验步骤】一、 按照拓扑,对各个路由器的基本命令及重分发配置完成,可参考实验《重分发一》和《重分发二》。
R1:interface Loopback0ip address 1.1.1.1 255.255.255.0interface Serial0/0ip address 192.168.13.1 255.255.255.0serial restart-delay 0interface Serial0/1ip address 192.168.14.1 255.255.255.0serial restart-delay 0router ospf 1router-id 1.1.1.1log-adjacency-changesredistribute rip subnetsnetwork 1.1.1.0 0.0.0.255 area 0network 192.168.14.0 0.0.0.255 area 0router ripversion 2redistribute ospf 1 metric 1network 192.168.13.0no auto-summaryRIP OSPFR1R2R3R4S 0/0 192.168.13.0/24 S 0/0S 0/0 192.168.24.0/24 S 0/0S 0/1 192.168.14.0/24 S 0/1S 0/1 192.168.23.0/24 S 0/1lo 0:1.1.1.1/24lo 0:2.2.2.2/24lo 0:3.3.3./24lo 0:3.3.3.3/24IGP 中4种路由协议的重分布三、OSPF 双点双向重分布R2:!interface Loopback0ip address 2.2.2.2 255.255.255.0interface Serial0/0ip address 192.168.24.2 255.255.255.0serial restart-delay 0interface Serial0/1ip address 192.168.23.2 255.255.255.0serial restart-delay 0router ospf 1router-id 2.2.2.2log-adjacency-changesredistribute rip subnetsnetwork 2.2.2.0 0.0.0.255 area 0network 192.168.24.0 0.0.0.255 area 0!router ripversion 2redistribute ospf 1 metric 1network 192.168.23.0no auto-summaryR3:interface Loopback0ip address 3.3.3.3 255.255.255.0interface Serial0/0ip address 192.168.13.3 255.255.255.0serial restart-delay 0interface Serial0/1ip address 192.168.23.3 255.255.255.0serial restart-delay 0router ripversion 2network 3.0.0.0network 192.168.13.0network 192.168.23.0R4:interface Loopback0ip address 4.4.4.4 255.255.255.0interface Serial0/0ip address 192.168.24.4 255.255.255.0serial restart-delay 0interface Serial0/1ip address 192.168.14.4 255.255.255.0serial restart-delay 0router ospf 1router-id 4.4.4.4log-adjacency-changesnetwork 4.4.4.0 0.0.0.255 area 0network 192.168.14.0 0.0.0.255 area 0network 192.168.24.0 0.0.0.255 area 0R1#sh ip rou//查看R1的路由表1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback0C 192.168.13.0/24 is directly connected, Serial0/02.0.0.0/8 is variably subnetted, 2 subnets, 2 masksO 2.2.2.2/32 [110/129] via 192.168.14.4, 00:03:05, Serial0/1 R 2.2.2.0/24 [120/2] via 192.168.13.3, 00:00:24, Serial0/0C 192.168.14.0/24 is directly connected, Serial0/13.0.0.0/24 is subnetted, 1 subnetsO E2 3.3.3.0 [110/20] via 192.168.14.4, 00:03:05, Serial0/14.0.0.0/32 is subnetted, 1 subnetsO 4.4.4.4 [110/65] via 192.168.14.4, 00:03:06, Serial0/1O 192.168.24.0/24 [110/128] via 192.168.14.4, 00:03:06, Serial0/1 O E2 192.168.23.0/24 [110/20] via 192.168.14.4, 00:03:06, Serial0/1 R1#R2#sh ip rou//查看R2的路由表1.0.0.0/8 is variably subnetted, 2 subnets, 2 masksO 1.1.1.1/32 [110/129] via 192.168.24.4, 00:02:46, Serial0/0 R 1.1.1.0/24 [120/2] via 192.168.23.3, 00:00:23, Serial0/1O E2 192.168.13.0/24 [110/20] via 192.168.24.4, 00:02:46, Serial0/02.0.0.0/24 is subnetted, 1 subnetsC 2.2.2.0 is directly connected, Loopback0O 192.168.14.0/24 [110/128] via 192.168.24.4, 00:02:46, Serial0/03.0.0.0/24 is subnetted, 1 subnetsR 3.3.3.0 [120/1] via 192.168.23.3, 00:00:23, Serial0/14.0.0.0/32 is subnetted, 1 subnetsO 4.4.4.4 [110/65] via 192.168.24.4, 00:02:46, Serial0/0C 192.168.24.0/24 is directly connected, Serial0/0C 192.168.23.0/24 is directly connected, Serial0/1R1#traceroute 3.3.3.3//R1上跟踪路由3.3.3.3Type escape sequence to abort.Tracing the route to 3.3.3.31 192.168.14.4 116 msec 112 msec 100 msec2 192.168.24.2 136 msec 104 msec 44 msec3 192.168.23.3 152 msec * 244 msecR1#//发现,R1去往3.3.3.0/24的路由,要通过R4,再通过R2,才到达R3,在OSPF区域绕了一圈之后进入RIP,OSPF双点双向重分布会造成环路。
stub(末节区域):使用的前提:如下图示,非骨干路由和其它路由协议(静态、EIGRP、RIP...)均要与骨干路由直连。
作用是:把一个非骨干区域配置成stub区域,而stub区域路由器将从其它协议重分布到OSPF的路由条目(OE1、OE2)替换成默认路由指向骨干区域。
如下图所示:在R1、R2(即ABR)上配置,配置命令如下:R1/R2:router ospf 1area 100stub结果是:由于R2既是处于area 100,又处于area 0,所以,当“show ip route ospf”的时候,只有R1上的OSPF路由条目(OE1、OE2)会被替换成默认路由指向骨干路由,而R2上的路由条目是不会被替换的。
当然,此图右边使用的是EIGRP,也可以使用除OSPF外的其他路由协议,因为,我们要在R3上做“路由重分布”。
totally-stub(完全末节区域):使用的前提条件和stub的一样,只是totally-stub要更“狠”,它的作用是:将从它路由协议重分布到OSPF的路由条目(OE1、OE2)及OIA(区域间学习到的路由)全部替换成默认路由指向骨干区域,但配置命令与上述还是有一点点差别的:R1:router ospf 1area 100 stubR2: router ospf 1area 100 stub no-summary结果:也是只有R1上的所有OSPF路由条目(包括OE1、OE2机OIA)被替换成了一条默认路由指向骨干路由。
nssa和totally-nssa的使用前提是一样的,即当OSPF区域跨非骨干区域连接到骨干区域时,如下图所示,RIP跨了area 10连接到了area 0。
而两者的作用有点不同。
nssa(次末节区域):作用是将从连接骨干区域出口的其它路由协议重发布来的(OE1、OE2)替换成默认路由指向骨干区域配置命令:R2和R3:router ospf 1area 10 nssaR4: router ospf 1area 10 nssa default-information-originatetotally-nssa(完全次末节区域):作用是将从连接骨干区域出口的其它路由协议重发布来的(OE1、OE2)及区域间学习到的路由(OIA)替换成默认路由指向骨干区域。
路由重分发工作原理路由重分发工作原理网络协议有很多种,例如isis、rip、ospf、bgp等,在大型公司中经常会出现网络设备之间运行多种网络协议的情况,各种网络协议之间如果不进行一定的配置那么设备之间是不能进行互通信息的,在这种情况下就出现了路由重分发技术,路由重分发的作用就是为了实现多种路由协议之间的协同工作。
路由重分发的工作原理:通过在各种路由协议的配置中添加一定的配置使将路由协议广播到另外的路由协议中,让各个路由协议都能检测到运行其他的路由协议的网段,从而实现数据的传输。
路由重分发技术需要用到redistribute命令rip协议的redistribute命令redistribute protocol 【metric metric-value】【match internal | external nssa-external type】【route-map map-tag】protocol:路由重分发的源路由协议 metric metric-value:设置路由重分发的度量值(1···6),没有将使用default-metric命令设置的metric值 match internal | external nssa-external type:设置重分发路由的条件,只适合重分发的源路由协议是ospf route-map map-tag应用路由图进行重分发ospf协议的redistribute命令 redistribute protocol 【subnets】【metric metric-value】【metric-type{1 | 2}】【tag tag-value】【route-map map-tag】protocol:路由重分发的源路由协议subnets:设置是否重分发子网metric metric-value:设置路由重分发的度量值(1···16777214),没有将使用default-metric命令设置的metric值metric metric-type:设置重分发的路由度量类型,默认值为2 tag tag-value:设置重分发的路由的tag(0···2147483647)默认为0 route-map map-tag应用路由图进行重分发重分发到ospf中的时候,除了直连路由和默认路由外,其他重分发的路由的默认的度量值是20,默认度量值类型是2,且默认不重分发子网。
动态路由协议:RIP、OSPF、EIGRP简介我们前面已经简单介绍了三种类型的动态路由协议算法分别是距离矢量算法,链路状态算法以及平衡混合算法,那么咱们今天就来看看这几种算法的类型代表:RIP、OSPF、EIGRP。
而且它们都是内部网关协议(IGP),也就是说它们都运行在一个自治系统内部,什么是自治系统,我们来简单看一下:自治系统:就是使用相同路由准则的网络集合,一般是一个ISP,或者是一个大型的行政机构。
大家刚听到这个术语时会感到有点模糊,有点抽象,在CCNP的课程中会有详细的介绍,我们CCNA部分很少会用到自治系统间的协议,使用的基本上都是自治系统内的协议。
所以如果按照在自动系统内运行还是用于连接不同的自治系统,路由协议又分为两种:IGP:内部网关协议,在一个自治系统内运行。
比如:RIP、OSPF、IS-IS、EIGRP等。
EGP:外部网关协议,用于连接不同的自治系统。
比如:BGPRIP:路由信息协议在CCNA部门主要介绍的是内部网关协议,那么我们先从RIP开刀。
RIP是一个典型的距离矢量路由协议,全称是Routing information protocol(路由信息协议)。
它使用的是数据包所经过的网关来做为距离的单位,最大跳数为15跳,超过15跳便无法到达,大家从这个数中就可以看出来,RIP是一个元老级的路由协议,正是因为受到15跳的限制,所以现在使用的是越来越少。
它只适合于一些规模不大的网络,路由器的数量不多的网络中。
因为它评价网络的好处就是依靠跳数,但是这个跳数并不一定说就能代表最佳路径。
如图所示:PC1希望到达PC2,按照RIP协议来说肯定是经过Router3,再转交给Router4就到达PC2,因为这样的话相对于Router3来说,它只要经过两跳,就可以到达PC2所在的网段。
跳数最少。
但是这条线路的带宽是19.2Kbps,而另一条路虽然跳线多,但它是T1线路,带宽大,延迟小。
肯定会比第一条路要优。
项目实训通过路由重分布实现企业网络互联实训目的通过本项目实训可以掌握:1.种子度量值的含义2.不同路由协议默认种子度量值3.路由重分布各个参数的含义4.静态路由重分布进OSPF5.静态路由重分布进EIGRP6.EIGRP和OSPF的重分布7.EIGRP和RIP的重分布8.IP SLA的配置9.查看和调试路由重分布的信息实训拓扑项目实训网络拓扑如图3-23所示。
图3-23通过路由重分布实现多协议企业网络互联实训要求公司B因业务发展需要兼并了公司A,为了确保资源共享、办公自动化和节省人力成本,需要将公司A和公司B原有的网络连接起来。
通过申请一条专线将公司A和公司B原来网络的边缘路由器中间运行EIGEP。
为了可靠性和扩展性的需要,重新规划从上海路由器申请两条线路(ISP1和ISP2)接入Internet。
张同学正在该公司实习,为了提高实际工作的准确性和工作效率,项目经理安排他在实验室环境下完成测试,为设备上线运行奠定坚实的基础。
小张用2台路由器模拟ISP1和ISP2的网络,上海通过浮动静态路由实现到ISP的连接。
各地的内部网络通过边界路由器实现VLAN间路由,他需要完成的任务如下:1.配置四地路由器接口的IP地址。
2.配置四地路由器子接口封装和IP地址,并测试以上所有直连链路的连通性。
3.杭州和北京路由器配置RIPv2路由协议,模拟公司A的网络环境。
4.上海和深圳路由器配置单区域OSPF路由协议,模拟公司B的网络环境。
5.上海和北京路由器配置EIGRP路由协议,模拟连接公司A和公司B的网络环境。
6.在上海路由器上配置浮动静态默认路由,主链路为连接到ISP1的链路,备份链路为连接到ISP2的链路。
同时需要通过IP SLA技术探测ISP1的DNS服务器(198.19.17.1)和ISP2的DNS服务器(212.172.2.1)的可达性,并且将跟踪结果和静态默认路由关联。
7.在上海路由器实现将静态默认路由重分布OSPF和EIGRP网络。
一、实验拓扑图:AucklandSanJose3Singapore 192.168.224.1/30S1/2192.168.240.2/30S1/2 S1/0192.168.224.2/30S1/1192.168.240.1/30 Engineers Lo0 192.168.232.1/24T1 1.544Mbps19.2Kpbs RIP v2Managers Lo1 192.168.236.1/24Lo0 192.168.5.1/24二、实验目的1、在实验中应用到高级路由功能来操作路由更新,这些特性包括分发列表,默认路由,被动接口和路由重分布。
2、掌握高级路由特性来控制路由更新。
三、实验要求1、公司的SanJose3和Singapore 之间的网络使用的RIPV2动态路由协议。
2、在SanJose3上面连接了一个stub network 192.168.5.1/24,为了减少流量,过滤RIPv2更新流量在整个192.168.5.1/24网络发送。
3、在Singapore 有Engineers 和Managers 部门,Managers 网络并不想被SanJose3所学习到。
4、有一条非常慢的19.2Kpbs 的链路连接Singapore 和Auckland ,为了减少这条链路的 流量,我们要禁止动态路由更新通过这条链路5、在满足上述条件的情况下,实现全网互通。
四、实验步骤1、按照拓扑图中IP ,配置好路由器接口的 IP 地址,但是不要配置RIPv2协议,使用CDP 协议检测相邻设备的连通性。
配置如下:Router(config)#hostname SanJose3SanJose3(config)#line c 0SanJose3(config-line)#exec-timeout 0 0SanJose3(config-line)#logging synchronousSanJose3(config)#no ip domain-lookupSanJose3(config)#interface s1/2SanJose3(config-if)#ip address 192.168.224.1 255.255.255.252SanJose3(config-if)#no shutdownSanJose3(config)#interface loopback 0SanJose3(config-if)#ip address 192.168.5.1 255.255.255.0Router(config)#hostname AucklandAuckland (config)#interface s1/2Auckland (config-if)#ip address 192.168.240.2 255.255.255.252Auckland (config-if)#no shutdownAuckland (config)#interface loopback 0Auckland (config-if)#ip address 192.168.248.1 255.255.255.0Router(config)#hostname SingaporeSingapore(config)#interface loopback 0Singapore(config-if)#ip address 192.168.232.1 255.255.255.0Singapore(config-if)#description EngineersSingapore(config)#interface loopback 1Singapore(config-if)#ip address 192.168.236.1 255.255.255.0Singapore(config-if)#description ManagerSingapore(config)#interface s1/0Singapore(config-if)#ip address 192.168.224.2 255.255.255.252Singapore(config-if)#no shutdownSingapore(config)#interface s1/1Singapore(config-if)#ip address 192.168.240.1 255.255.255.252Singapore(config-if)#no shutdown配置完成后使用CDP 协议检查相邻设备的连通性,如下2、在SanJose3上,配置RIPv2协议通告物理直连的网络,配置如下:SanJose3(config)#router ripSanJose3(config-router)#version 2SanJose3(config-router)#network 192.168.224.0SanJose3(config-router)#network 192.168.5.0因为192.158.5.0是一个stub network,这个网络里没有路由器或者主机需要RIPv2协议的更新。
OSPF多进程之间的路由重发布1、实验拓扑如下图:R1R4R3 R2Area 00spf 10Area 0Ospf 1002、实验目的:1、实现R2与R3之间互相访问时的数据分流。
R2访问R3的3.3.3.3/32时走R1,R2访问R3的30.30.30.30/32时走R4。
R3访问R2的2.2.2.2/32时走R1,R3访问R2的20.20.20.20/32时走R1。
2、实现线路的冗余备份。
当R1链路故障时数据可以走R4,当R4链路故障时数据可以走R1。
实现链路的冗余备份。
3、理解并掌握route-map在控制路由方面的应用。
3、实验配置文档R1配置:config terint f0/0ip add 10.0.0.1 255.255.255.252no shutint f1/0ip add 10.0.0.5 255.255.255.252no shutint lo 0ip add 1.1.1.1 255.255.255.255endwriteconfig terrouter ospf 10router-id 1.1.1.1network 10.0.0.0 0.0.0.3 area 0redistribute ospf 100 metric-type 1 subnets route-map ospf100_to_ospf10 distribute-list deny_ospf100 inendconfig terrouter ospf 100router-id 1.1.1.1network 10.0.0.4 0.0.0.3 area 0redistribute ospf 10 metric-type 1 subnets route-map ospf10_to_ospf100 distribute-list deny_ospf10 inendwriteip access-list standard deny_ospf10deny 2.2.2.2 0.0.0.0deny 20.20.20.20 0.0.0.0permit anyip access-list standard deny_ospf100deny 3.3.3.3 0.0.0.0deny 30.30.30.30 0.0.0.0permit anyaccess-list 10 permit 2.2.2.2 0.0.0.0access-list 11 permit 3.3.3.3 0.0.0.0access-list 20 permit 20.20.20.20 0.0.0.0access-list 21 permit 30.30.30.30 0.0.0.0route-map ospf100_to_ospf10 permit 10match ip address 11set metric 100route-map ospf100_to_ospf10 permit 20match ip address 21set metric 200route-map ospf10_to_ospf100 permit 10match ip address 10set metric 100route-map ospf10_to_ospf100 permit 20match ip address 20set metric 200R4配置:config terint f0/0ip add 172.16.0.1 255.255.255.252no shutint f1/0ip add 172.16.0.5 255.255.255.252no shutint lo 0ip add 4.4.4.4 255.255.255.255endwriteconfig terrouter ospf 10router-id 4.4.4.4network 172.16.0.4 0.0.0.3 area 0redistribute ospf 100 metric-type 1 subnets route-map ospf100_to_ospf10 distribute-list deny_ospf100 inendconfig terrouter ospf 100router-id 4.4.4.4network 172.16.0.0 0.0.0.3 area 0redistribute ospf 10 metric-type 1 subnets route-map ospf10_to_ospf100 distribute-list deny_ospf10 inendwriteip access-list standard deny_ospf10deny 2.2.2.2 0.0.0.0deny 20.20.20.20 0.0.0.0permit anyip access-list standard deny_ospf100deny 3.3.3.3 0.0.0.0deny 30.30.30.30 0.0.0.0permit anyaccess-list 10 permit 2.2.2.2 0.0.0.0access-list 11 permit 3.3.3.3 0.0.0.0access-list 20 permit 20.20.20.20 0.0.0.0access-list 21 permit 30.30.30.30 0.0.0.0route-map ospf100_to_ospf10 permit 10 match ip address 11set metric 200route-map ospf100_to_ospf10 permit 20 match ip address 21set metric 100route-map ospf10_to_ospf100 permit 10 match ip address 10set metric 200route-map ospf10_to_ospf100 permit 20 match ip address 20set metric 100R2的配置:config terint f0/0ip add 10.0.0.2 255.255.255.252no shutint f1/0ip add 172.16.0.6 255.255.255.252no shutint lo 0ip add 2.2.2.2 255.255.255.255int lo 1ip add 20.20.20.20 255.255.255.255 endwriteconfig terrouter ospf 10router-id 2.2.2.2network 172.16.0.4 0.0.0.3 area 0 network 10.0.0.0 0.0.0.3 area 0 network 2.2.2.2 0.0.0.0 area 0network 20.20.20.20 0.0.0.0 area 0endwriteR3的配置:config terint f0/0ip add 10.0.0.6 255.255.255.252no shutint f1/0ip add 172.16.0.2 255.255.255.252no shutint lo 0ip add 3.3.3.3 255.255.255.255int lo 1ip add 30.30.30.30 255.255.255.255endwriteconfig termrouter ospf 100router-id 3.3.3.3network 172.16.0.0 0.0.0.3 area 0network 10.0.0.4 0.0.0.3 area 0network 3.3.3.3 0.0.0.0 area 0network 30.30.30.30 0.0.0.0 area 0endwrite4、实验测试1、在R2上show ip route查看结果,可以看出实现了数据分流。
重分布原则(影响的是该协议中其他路由器路由表,不影响本路由器路由表,只影响本路由器数据库)
1.复制粘贴路由表.
2.寻找被直连取代的路由(必须在路由进程下通告出来的直连路由).也会被复制粘贴。
3.往同一个协议的重分布中,重分布直连最优先处理,并且被重分布直连处理过的接口以后都不再处理了.
4.向EIGRP重分布RIP和OSPF时,重分布OSPF被最优先处理。
RIP
重分布EIGRP,OSPF,ISIS协议的时候要挂metric参数或者default-metric 1
重分布直连,静态,rip的时候不需要
EIGRP
重分布ospf,rip,isis协议的时候需要挂metric或者default-metric
重分布静态,直连,eigrp的时候不需要
OSPF
重分布任何协议,静态,直连的时候都不需要挂metric,但是注意subnets参数
IS-IS
IS-IS 度量必须在1 和63 之间。
IS-IS 中没有
default-metric 选项,应该为每个协议定义权值,如果没有为重分配到IS-IS 的路由指定权值,则度量值默认为0。
各个路由器的配置(要求在Router0显示是E1的类型)
Router0
Router>en
Router#conf t
Router(config)#int lo0
Router(config-if)#ip add 1.1.1.1 255.255.255.0
Router(config-if)#exit
Router(config)#int s 0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.0 Router(config-if)#no shut
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#net 192.168.1.0 0.0.0.255 a 0
Router(config-router)#end
Router1
Router>en
Router#conf t
Router(config)#int lo0
Router(config-if)#ip add 2.2.2.2 255.255.255.0
Router(config-if)#exit
Router(config)#int s0/0
Router(config-if)#ip add 192.168.1.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/1
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#clock rate 64000
Router(config-if)#exit
Router(config)#router ospf 1
Router(config-router)#net 192.168.1.0 0.0.0.255 a 0
Router(config-router)#net 2.2.2.0 0.0.0.255 a 0
Router(config-router)#redistribute eigrp 1 metric-type 1(类型1) Router(config-router)#exit
Router(config)#router eigrp 1
Router(config-router)#redistribute ospf 1 metric 1000 100 255 1 1500
(
Bandwidth in kilobytes = 10000或者1000
•Delay in tens of microseconds = 100
•Reliability = 255 (maximum最大
•Load = 1 (minimum最小
•MTU = 1500 bytes
)
Router(config-router)#end
Router#
Router2
Router>en
Router#conf t
Router(config)#int lo0
Router(config-if)#ip add 3.3.3.3 255.255.255.0
Router(config-if)#exit
Router(config)#int s0/0
Router(config-if)#ip add 192.168.2.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#exit
Router(config)#router eigrp 1
Router(config-router)#net 192.168.2.0 0.0.0.255 Router(config-router)#net 3.3.3.0 0.0.0.255
Router(config-router)#end
配置完成以后查看各个路由表
Router0
Router1
Router2。