【HCIP】重发布实验

题目:

【HCIP】重发布实验_第1张图片

 

配置:

R1

//配置ip地址
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
[r1-GigabitEthernet0/0/1]int lo0
[r1-LoopBack0]ip add 1.1.1.1 24

//配置路由(启动双协议)

[r1]rip 1

[r1-rip-1]version 2

[r1-rip-1]network 12.0.0.0

[r1-rip-1]network 13.0.0.0

[r1-rip-1]network 1.0.0.0

R2

//配置ip地址
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 24.1.1.1 24
[r2-GigabitEthernet0/0/1]int lo0
[r2-LoopBack0]ip add 2.2.2.2 24
[r2-LoopBack0]q

//配置路由(启动双协议)

[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]network 12.0.0.0
[r2-rip-1]q
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

//两点双向重发布

[r2]ospf 1

[r2-ospf-1]import-route rip 1

[r2-ospf-1]q

[r2]rip 1

[r2-rip-1]import-route ospf 1

R3

//配置ip地址
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 13.1.1.2 24
[r3-GigabitEthernet0/0/1]int lo0
[r3-LoopBack0]ip add 3.3.3.3 24
[r3-LoopBack0]q

//配置路由(启动双协议)

[r3]rip
[r3-rip-1]version 2
[r3-rip-1]network 13.0.0.0
[r3-rip-1]q
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0

//两点双向重发布

[r3-ospf-1]import-route rip 1

[r3-ospf-1]q

[r3]rip 1

[r3-rip-1]import-route ospf 1

//通过修改R3的环回OSPF的接口工作类型为broadcast(广播)

路由回馈产生原因:在OSPF内部学习到的/32的路由,和R3重发布进入RIP后,再通过R2重发布进入OSPF学习到/24的路由,致使路由回馈
[r3]int lo0
[r3-LoopBack0]ospf network-type broadcast

R4

//配置ip地址
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[r4-GigabitEthernet0/0/0]int g0/0/1 
[r4-GigabitEthernet0/0/1]ip add 24.1.1.2 24
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 45.1.1.1 24
[r4-GigabitEthernet0/0/2]int lo0
[r4-LoopBack0]ip add 4.4.4.4 24

//配置路由(启动双协议)

[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 45.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0

R5

//配置ip地址
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
[r5-GigabitEthernet0/0/1]int lo0
[r5-LoopBack0]ip add 5.5.5.5 24
[r5-LoopBack0]q

//配置路由(启动双协议)

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]network 45.1.1.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 56.1.1.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0

R6

//配置ip地址
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 67.1.1.1 24
[r6-GigabitEthernet0/0/1]int lo0
[r6-LoopBack0]ip add 6.6.6.6 24
[r6-LoopBack0]q

//配置路由(启动双协议)

[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]a 0
[r6-ospf-1-area-0.0.0.0]network 56.1.1.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 67.1.1.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0

R7

//配置ip地址
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
[r7-GigabitEthernet0/0/0]int lo0
[r7-LoopBack0]ip add 7.7.7.7 24
[r7-LoopBack0]q

//配置路由(启动双协议)

[r7]ospf 1 router-id 7.7.7.7

[r7-ospf-1]a 0

[r7-ospf-1-area-0.0.0.0]network 67.1.1.0 0.0.0.255

//环回重发布

[r7]ospf 1
[r7-ospf-1]import-route direct 

解决出环问题
通过前缀列表与路由策略修改优先级进行防环

R2:

[r2]ip ip-prefix a index 10 permit 7.7.7.0 24//创建名为a,序号为10的前缀列表抓取流量  
[r2]route-policy b permit node 10//创建名为b,大动作为允许,序号为10的路由策略
Info: New Sequence of this List.
[r2-route-policy]q
[r2]route-policy b permit node 10
Info: You are overwriting this sequence.
[r2-route-policy]if-match ip-prefix a//匹配名为a的前缀列表
[r2-route-policy]apply preference 151//定义小动作,修改优先级为151
[r2-route-policy]rip 1
[r2-rip-1]preference route-policy b//进入RIP调用名为b的路由策略修改优先级
[r2-rip-1]q

R3

[r3]ip ip-prefix a index 10 permit 7.7.7.0 24
[r3]route-policy b permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix a
[r3-route-policy]apply  preference 151
[r3-route-policy]rip 1
[r3-rip-1]pre
[r3-rip-1]preference route-policy b
[r3-rip-1]q

路由环路产生原因:R7将其直连发布进OSPF协议中时,该路由优先级为150,在ENSP中,OSPF优先级为10,RIP为100,OSPF重发布后为150。则R7将路由重发布后,R2又将其重发布进入RIP中,RIP又将其优先级改为100并重发布进入OSPF中,则致使R4信任由R3过来的优先级为100的路由,导致出现环路

优化路由
在R2/R3上抓取与R1直连的网段和自身的环回,前缀为qq,定义小动作为修改度量类型,为类型1

R2

[r2]ip ip-prefix qq permit 3.3.3.0 24
[r2]ip ip-prefix qq permit 34.1.1.0 24
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]rip metricout ip-prefix qq 2
[r2-GigabitEthernet0/0/0]q
[r2]ip ip-prefix z permit 12.1.1.0 24
[r2]ip ip-prefix z permit 2.2.2.0 24 
[r2]route-policy z permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-match ip-prefix z
[r2-route-policy]apply cost-type type-1
[r2-route-policy]q  
[r2]route-policy z permit node 20
 

R3

[r3]ip ip-prefix hh index 10 permit 24.1.1.0 24
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]rip metricout ip-prefix hh 2
[r3-GigabitEthernet0/0/1]q
[r3]ip ip-prefix z permit 13.1.1.0 24
[r3]ip ip-prefix z permit 3.3.3.0 24 
[r3]route-policy z permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix z
[r3-route-policy]apply cost-type type-1
[r3-route-policy]q
[r3]route-policy z permit node 20

R2/3上的OSPF开始调用

R2:
[r2-ospf-1]import-route rip route-policy qq
R3:
[r3-ospf-1]import-route rip route-policy qq
 

测试

R1的环回也能ping通其他的环回

【HCIP】重发布实验_第2张图片

 查看R1的路径

【HCIP】重发布实验_第3张图片

 

你可能感兴趣的:(hcip,网络协议,网络)