双点双向重发布以及路由策略
一、基础配置
[R1]int l0 [R1-LoopBack0]ip add 1.1.1.1 32 [R1-LoopBack0]int s4/0/0 [R1-Serial4/0/0]ip add 12.1.1.1 24 [R1-Serial4/0/0]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 14.1.1.1 24 [R2]int l0 [R2-LoopBack0]ip add 2.2.2.2 32 [R2-LoopBack0]int s4/0/0 [R2-Serial4/0/0]ip add 12.1.1.2 24 [R2-Serial4/0/0]int s4/0/1 [R2-Serial4/0/1]ip add 23.1.1.2 24 [R3]int l0 [R3-LoopBack0]ip add 3.3.3.3 32 [R3-LoopBack0]int s4/0/0 [R3-Serial4/0/0]ip add 23.1.1.3 24 [R3-Serial4/0/0]int s4/0/1 [R3-Serial4/0/1]ip add 34.1.1.3 24 [R4]int l0 [R4-LoopBack0]ip add 4.4.4.4 32 [R4-LoopBack0]int s4/0/0 [R4-Serial4/0/0]ip add 34.1.1.4 24 [R4-Serial4/0/0]int g0/0/0 [R4-GigabitEthernet0/0/0]ip add 14.1.1.4 24
二、书写OSPF和RIP路由协议
[R1]rip 1 [R1-rip-1]ver 2 [R1-rip-1]network 1.0.0.0 [R1-rip-1]network 12.0.0.0 [R1-rip-1]network 14.0.0.0 [R2]rip 1 [R2-rip-1]ver 2 [R2-rip-1]network 2.0.0.0 [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 23.1.0.0 0.0.255.255 [R3]ospf 1 router-id 3.3.3.3 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]network 23.1.0.0 0.0.255.255 [R3-ospf-1-area-0.0.0.0]network 34.1.0.0 0.0.255.255 [R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [R4]ospf 1 router-id 4.4.4.4 [R4-ospf-1]area 0 [R4-ospf-1-area-0.0.0.0]network 34.1.0.0 0.0.255.255 [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]q [R4-ospf-1]q [R4]rip 1 [R4-rip-1]ver 2 [R4-rip-1]network 14.0.0.0
三、进行多点双向重发布
[R2]rip 1 [R2-rip-1]import-route ospf 1 [R2-rip-1]q [R2]ospf 1 [R2-ospf-1]import-route rip 1 [R4]ospf 1 [R4-ospf-1]import-route rip 1 [R4-ospf-1]q [R4]rip 1 [R4-rip-1]import-route ospf 1
四、进行路由策略
对于R1上的路由处理
处理前
[R2]ip ip-prefix 1 permit 4.4.4.4 32 /使4.4.4.4走下边,在R2上增大对4.4.4.4的cost值 [R2]route-policy 1 permit node 10 Info: New Sequence of this List. [R2-route-policy]if-match ip-prefix 1 [R2-route-policy]apply cost + 10 [R2-route-policy]q [R2]route-policy 1 permit node 20 Info: New Sequence of this List. [R2-route-policy]q [R2]rip 1 [R2-rip-1]import-route ospf 1 route-policy 1 [R4]ip ip-prefix 1 permit 23.1.1.0 24 /使23.1.1.0走上边,在R4上增大对23.1.1.0的cost值 [R4]route-policy 1 permit node 10 Info: New Sequence of this List. [R4-route-policy]if-match ip-prefix 1 [R4-route-policy]apply cost + 10 [R4-route-policy]route-policy 1 permit node 20 Info: New Sequence of this List. [R4-route-policy]q [R4]rip 1 [R4-rip-1]import-route ospf 1 route-policy 1 [R2]ip ip-prefix 2 permit 34.1.1.0 24 /使34.1.1.0走下边,在R2上增大对34.1.1.0的cost值 [R2]route-policy 1 permit node 15 Info: New Sequence of this List. [R2-route-policy]if-match ip-prefix 2 [R2-route-policy]apply cost + 10
处理后
对于R3上的路由处理
在R2上修改重发布类型为一,type 1优于type 2,导致重发布的路由全走R2,只需修改一条路由即可
处理前
[R2]ospf 1 [R2-ospf-1]import-route rip 1 type 1
处理后
再对1.4进行操作,在R4上减少或者在R2上增加
[R4]ip ip-prefix 14 permit 14.1.1.0 24 [R4]route-policy 14 permit node 10 Info: New Sequence of this List. [R4-route-policy]if-match ip-prefix 14 [R4-route-policy]apply cost-type type-1 [R4-route-policy]apply cost - 1 [R4-route-policy]q [R4]route-policy 14 permit node 20 Info: New Sequence of this List. [R4]ospf 1 [R4-ospf-1]import-route rip 1 route-policy 14
再次处理后
对于备份路径,其他路径并非直接拒绝,而是修改了cost值。在最优路径出现问题后还会继续使用