实验题目:重发布实验
实验目的:
- 两个协议间进行多点双向重发布
- R7的环回没有宣告在OSPF协议中,而是后期重发布进入的
- 解决环路,所有路径选择最优,且存在备份
实验内容:
1.ip配置
按照如下的拓扑来配置
2.Rip和ospf的配置
配置完成后开始配置RIP和OPSF
[r1]rip 1
[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]rip 1
[r2-rip-1]ver 2
[r2-rip-1]network 2.0.0.0
[r2-rip-1]network 12.0.0.0
[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]rip 1
[r3-rip-1]ver 2
[r3-rip-1]network 13.0.0.0
[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.1 0.0.0.0
[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 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]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]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]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
3.将r7的环回重发布进来
[r7]ospf 1
[r7-ospf-1]import-route direct
4.将rip和ospf多点双向重发布
[r2]ospf 1
[r2-ospf-1]import-route rip
[r2-ospf-1]quit
[r2]rip 1
[r2-rip-1]import-route ospf 1
[r4]ospf 1
[r4-ospf-1]import-route rip
[r4-ospf-1]quit
[r4]rip 1
[r4-rip-1]import-route ospf 1
5.此时R3会接收到rip和ospf的重发布的环回7.7.7.7
因为重发布进来的路由度量为100 而ospf发布进来的路由度量为150,所以r3会选择相信R1而不相信r4,故r4的7.7.7.7下一跳指向的是R3
形成环路
通过修改度量来让r3选择相信ospf的
[r3]route-policy a permit node 10
Info: You are overwriting this sequence.
[r3-route-policy]if-match acl 2000
[r3-route-policy]apply preference 151
[r3-route-policy]quit
[r3]rip 1
[r3-rip-1]preference route-policy a
此时r3的指向下一跳正常
同理:
[r2]route-policy a permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-match acl 2000
[r2-route-policy]apply preference 151
[r2-route-policy]quit
[r2]rip 1
[r2-rip-1]preference route-policy a
此时环路问题已解决
6.此外为了解决R3上环回路由有多个的问题
我们用:
[r3-LoopBack0]ospf network-type broadcast
而r2的环回也会因为重发布而选路不佳
[r3]acl 2001
[r3-acl-basic-2001]rule permit source 2.2.2.0 0.0.0.0
[r3-acl-basic-2001]quit
[r3-rip-1]quit
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]rip metricout 2001 2
让R1访问r2的环回时能正确走12.1.1.0
7.R1的选路问题
注意:用偏移列表(只能改大度量)或者route-policy
我们选用偏移列表
R2把r1到r3的环回和34.1.1.0跳数加2,让他走r2和24.1.10走上边
[r2]acl 2001
[r2-acl-basic-2001]rule permit source 3.3.3.3 0.0.0.0
[r2-acl-basic-2001]rule permit source 34.1.1.0 0.0.0.0
[r2-acl-basic-2001]quit
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]rip metricout 2001 2
同理:
R3把r1到34.1.1.0跳数加2,让他走r2和24.1.10走上边
[r3-acl-basic-2001]rule permit source 24.1.1.0 0
[r2-GigabitEthernet0/0/0]rip metricout 2001 2
此时:
8.对于R4,多点重发布会把R2和R3的路由和网段都会发给R4,R4要选择最佳的路径
[r2]ip ip-prefix q permit 12.1.1.0 24
[r2]ip ip-prefix q permit 2.2.2.0 24
[r2]route-policy w permit node 10
[r2-route-policy]if-match ip-prefix q
[r2-route-policy]apply cost-type type-1
[r2]route-policy w permit node 20
[r2]ospf 1
[r2-ospf-1]import-route rip route-policy w
让r4到r2和12的网段走上面
[r3]ip ip-prefix q permit 13.1.1.0 24
[r3]route-policy w permit node 10
[r3-route-policy]if-match ip-prefix q
[r3-route-policy]apply cost-type type-1
[r3]route-policy w permit node 20
[r3]ospf 1
[r3-ospf-1]import-route rip route-policy w
让r4到13网段走下面
此时:
全网为最优路径