一、实验目的
二 、实验要求
1.两个协议间进行多点双向重发布
2.R7的环回没有宣告在OSPF协议中,而是后期重发布进入的
3.解决环路,所有路径选择最优,且存在备份
三、实验拓扑
分析:
- 分配IP如上拓扑
- R2学到了两条R3的环回,因为网段不同所以路由器认为他们是两条不同的路由。则需要修改R3环回接口类型为broadcast。
- rip中R7环回的优先级为100,ospf中R7环回的优先级为150。R3丢弃了从ospf学到的R7的环回,R3再将R7的环回传递给R4,则会出现环路。需要使用路由策略,修改R1给R3、R7环回的路由的优先级,让R3学ospf中的R7环回
- R1上到34网段和R3环回是负载均衡,属于选路不佳,R4同理。需要使用路由策略,修改优先级和路由类型使选路最佳,并且保留备份
四、实验步骤
- IP配置
R1:
[R1]int LoopBack 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
Jan 27 2023 14:06:46-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
R2:
[R2]int LoopBack 0
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0]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
R3:
[R3]int LoopBack 0
[R3-LoopBack0]ip add 3.3.3.3 24
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 13.1.1.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
R4:
[R4]int LoopBack 0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 24.1.1.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip add 45.1.1.1 24
R5:
[R5]int LoopBack 0
[R5-LoopBack0]ip add 5.5.5.5 24
[R5-LoopBack0]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
R6:
[R6]int LoopBack 0
[R6-LoopBack0]ip add 6.6.6.6 24
[R6-LoopBack0]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
R7:
[R7]int LoopBack 0
[R7-LoopBack0]ip add 7.7.7.7 24
[R7-LoopBack0]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
2. 配置协议
R1:
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 1.0.0.0
[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 13.0.0.0
R2:
[R2]RIP 1
[R2-rip-1]ver 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 2.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.1 0.0.0.0
R3:
[R3]rip 1
[R3-rip-1]ver 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 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
R4:
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 45.1.1.1 0.0.0.0
R5:
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 56.1.1.1 0.0.0.0
R6:
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 56.1.1.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 67.1.1.1 0.0.0.0
R7:
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 67.1.1.2 0.0.0.0
- 重发布
R7:
[R7-ospf-1]import-route direct
R2:
[R2]rip 1
[R2-rip-1]import-route ospf 1
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]import-route rip
R3:
[R3]rip 1
[R3-rip-1]im
[R3-rip-1]import-route ospf 1
[R3-rip-1]q
[R3]ospf 1
[R3-ospf-1]import-route rip
- 将R3环回工作方式修改未broadcast
[R3]int LoopBack 0
[R3-LoopBack0]ospf network-type broadcast
- 修改R7在rip中学到的优先级,解决R7环回重发布产生的环路。 修改为151
R2:
[R2]ip ip-prefix a permit 7.7.7.0 24
[R2]route-policy a permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix a
[R2-route-policy]apply preference 151
[R2]ospf 1
[R2-ospf-1]preference route-policy a
R3:
[R3]ip ip-prefix a permit 7.7.7.0 24
[R3]route-policy a 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]q
[R3]rip 1
[R3-rip-1]preference route-policy a
查看路由表:
(查看R1路由表,R3环回、24网段和34网段为负载均衡,选路不佳)
6. 给R1的rip增加度量
R2:
[R2]ip ip-prefix aa permit 3.3.3.0 24
[R2]ip ip-prefix aa permit 34.1.1.0 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]rip metricin ip-prefix aa 2
R3:
[R3]ip ip-prefix aa permit 24.1.1.0 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]rip metricin ip-prefix aa 2
查看R4路由表
8. 将R2环回、12网段和13网段改为类型1
R2:
[R2]ip ip-prefix qq permit 12.1.1.0 24
[R2]ip ip-prefix qq permit 2.2.2.0 24
[R2]route-policy bb permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix qq
[R2-route-policy]apply cost-type type-1
[R2-route-policy]q
[R2]route-policy bb permit node 20
Info: New Sequence of this List.
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]import-route rip 1 route-policy bb
R3:
[R3]ip ip-prefix aa permit 13.1.1.0 24
[R3]route-policy bb permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix aa
[R3-route-policy]apply cost-type type-1
[R3-route-policy]q
[R3]route-policy bb permit node 20
Info: New Sequence of this List.
[R3-route-policy]q
[R3]ospf 1
[R3-ospf-1]import-route rip 1 route-policy bb
五、实验结果
检查路由表,负载均衡已消除
R1:
R4:
测试: