实验需求
1、两个协议间进行多点双向重发布
2、R7的环回没有宣告在ospf协议中,而是后期重发布进入的
3、解决环路,所有路径选择最优,且存在备份
实验拓扑
实验分析
这个拓扑图中R1-R4部分是在上一个实验(重发布路由策略实验)中做过了,还有不明白的话点击这里哦【重发布路由策略实验】
拓扑中在ospf中新加了三台路由,都是属于同一个0区域,其中注意的是R7的环回不属于ospf协议当中,需要在全部路由起完协议之后把环回通过重发布导进协议中去
特别注意:起完协议之后,先把r7的环回导入ospf协议当中,目的是产生环路,再去r2、r3做多点双向重发布。
最佳路径做完之后,我们观察r1、r2、r3、r4的路由表上,去往r7的环回在这四个路由上已经出现了环路,r1指向r2,r2指向r4,r4指向r3,r3再把这个包丢给r1,这就是出环了。解决出环我采用的是过滤策略,用前缀列表抓取流量,再去路由的出接口方向调用。
配置内容
IP地址规划
【R1】
int g0/0/0: 12.1.1.1 24
int g0/0/1: 13.1.1.1 24
int l0: 1.1.1.1 24
【R2】
int g0/0/0: 12.1.1.2 24
int g0/0/1: 24.1.1.1 24
int l0: 2.2.2.2 24
【R3】
int g0/0/0: 43.1.1.2 24
int g0/0/1: 13.1.1.2 24
int l0: 3.3.3.3 24
【R4】
int g0/0/0: 24.1.1.2 24
int g0/0/1: 43.1.1.1 24
int g0/0/2: 45.1.1.1 24
int l0: 4.4.4.4 24
【R5】
int g0/0/0: 45.1.1.2 24
int g0/0/1: 56.1.1.1 24
int l0: 5.5.5.5 24
【R6】
int g0/0/0: 56.1.1.2 24
int g0/0/1: 67.1.1.1 24
int l0: 6.6.6.6 24
【R7】
int g0/0/0: 67.1.1.2 24
int l0: 7.7.7.7 24
rip宣告
【R1】
rip 1
version 2
network 1.0.0.0
network 12.0.0.0
network 13.0.0.0
【R2】
rip 1
version 2
network 12.0.0.0
network 2.0.0.0
【R3】
rip 1
version 2
network 13.0.0.0
OSPF宣告
【R4】
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 24.1.1.0 0.0.0.255
network 43.1.1.0 0.0.0.255
network 45.1.1.0 0.0.0.255
【R2】
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 24.1.1.0 0.0.0.255
【R3】
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 43.1.1.0 0.0.0.255
【R5】
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 45.1.1.0 0.0.0.255
network 56.1.1.0 0.0.0.255
【R6】
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 56.1.1.0 0.0.0.255
network 67.1.1.0 0.0.0.255
【R7】
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 67.1.1.0 0.0.0.255
把R7的环回用直连的方式导入OSPF
【R7】ospf
【R7-ospf-1】import-route direct
多点双向重发布
【R2】
rip 1
import-route ospf 1
ospf 1
import-route rip
【R3】
rip 1
import-route ospf 1
ospf 1
import-route rip
修改R3环回接口的网络类型
[r3-LoopBack0]ospf network-type broadcast
rip区域实现最佳路径,干涉选举
【R1】
# 入接口调用
interface GigabitEthernet0/0/0
rip metricin ip-prefix 43 2
interface GigabitEthernet0/0/1
rip metricin ip-prefix 23 2
# 定义要抓取的流量
ip ip-prefix 7 index 10 deny 7.7.7.0 24
ip ip-prefix 43 index 10 permit 43.1.1.0 24
ip ip-prefix 24 index 11 permit 24.1.1.0 24
ip ip-prefix 3 index 13 permit 3.3.3.0 24
ip ip-prefix 2 index 20 permit 2.2.2.0 24
注意:上方入口调用的时候,我这里是显示的最新调用的那一次,下面每抓一条流量都要去调用,同一接口调用不同的流量,是根据前缀列表中的index来区分!
最短路径效果
标出来的部分需要走最优路径,其余负载均衡
rip区域实现最佳路径,干涉选举
【R2】
# 导入时调用策略
ospf 1
import-route rip 1 route-policy mm
route-policy mm permit node 10
if-match ip-prefix 2
apply cost-type type-1
route-policy mm permit node 20
if-match ip-prefix 12
apply cost-type type-1
# 空列表,允许其余流量通过
route-policy mm permit node 50
# 抓取流量
ip ip-prefix 2 index 10 permit 2.2.2.0 24
ip ip-prefix 12 index 10 permit 12.1.1.0 24
【R3】
ospf 1
import-route rip 1 route-policy mm
route-policy mm permit node 10
if-match ip-prefix mm
apply cost-type type-1
route-policy mm permit node 50
ip ip-prefix mm index 10 permit 13.1.1.0 24
效果
解决出环
使用过滤策略把R3到R1的7.7.7.0/24的出接口流量丢弃
在协议中调用
rip 1
filter-policy ip-prefix 7 export
抓取流量,并拒绝
ip ip-prefix 7 index 10 deny 7.7.7.0 24
测试
R1访问R7的环回
R1访问R2的环回,正常走12网段,现在把r1的 g0/0/0口关闭
发现12网段链路关闭之后,其余所有流量都往13网段走