目录
一、题目拓扑
二、实验步骤
2.1 IP配置如下:
R1:
R2:
R3:
R4:
2.2 RIP和OSPF协议配置:
R1:
R2
R3:
R4:
2.3 进行双向重发布
R2:
[r2-rip-1]im
[r2-rip-1]import-route os
[r2-rip-1]import-route ospf 1
[r2-rip-1]ospf
[r2-ospf-1]imp
[r2-ospf-1]import-route r
[r2-ospf-1]import-route rip 1
R3:
[r3]rip 1
[r3-rip-1]im
[r3-rip-1]import-route o
[r3-rip-1]import-route ospf 1
[r3-rip-1]ospf
[r3-rip-1]ospf 1
[r3-ospf-1]im
[r3-ospf-1]import-route r
[r3-ospf-1]import-route rip 1
三、路由表优化
3.1查看R1路由表:
问题:因为重发布R1去往24.0.0.0和34.0.0.0和2.2.2.0 网段分别有两个下一跳,造成选路不佳!
3.1.1 问题改善
在R1上分别抓取流量然后用过滤列表实现:
修改24.0.0.0 24 网段
[r1]ip ip
[r1]ip ip-prefix aaa p
[r1]ip ip-prefix aaa permit 24.0.0.0 24
[r1]
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]rip me
[r1-GigabitEthernet0/0/1]rip metricin ?
[r1-GigabitEthernet0/0/1]rip metricin ip-prefix aaa 10
修改2.2.2.0 24 网段
[r1]ip ip-prefix aaa p
[r1]ip ip-prefix aaa permit 2.2.2.0 24
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]rip m
[r1-GigabitEthernet0/0/0]rip metricin
[r1-GigabitEthernet0/0/0]rip metricout ip
[r1-GigabitEthernet0/0/0]rip metricout ip-prefix aaa 10
修改34.0.0.0 24 网段
[r1]ip ip-prefix bb de
[r1]ip ip-prefix bb deny 34.0.0.0 24
[r1]rip
[r1-rip-1]f
[r1-rip-1]filter-policy ip
[r1-rip-1]filter-policy ip-prefix b
[r1-rip-1]filter-policy ip-prefix bb
[r1-rip-1]filter-policy ip-prefix bb i
[r1-rip-1]filter-policy ip-prefix bb import g
[r1-rip-1]filter-policy ip-prefix bb import GigabitEthernet 0/0/0
[r1]ip ip-prefix bb p
[r1]ip ip-prefix bb permit 0.0.0.0 0le
[r1]ip ip-prefix bb permit 0.0.0.0 0 less-equal 32
3.1.2 修改后R1路由表:
3.2 查看R2路由表: ![](https://i-blog.csdnimg.cn/direct/15df5ecad1d94be3a47e07ffb7c0bfc5.png)
问题:因为重发布R4去往12.0.0.0和13.0.0.0 网段分别有两个下一跳,造成选路不佳!
3.2.1 问题改善
优化12.0.0.0 24
[r3]route-policy hh permit node 1000
Info: New Sequence of this List.
[r3-route-policy]q
[r3]ip ip
[r3]ip ip-prefix yy p
[r3]ip ip-prefix yy permit 12.0.0.0 24
[r3]rou
[r3]route
[r3]route-policy aa pe
[r3]route-policy hh p
[r3]route-policy hh permit no
[r3]route-policy hh permit node 20
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix yy
[r3-route-policy]a
[r3-route-policy]apply c
[r3-route-policy]apply community
[r3-route-policy]apply cost 10
[r3]ospf
[r3-ospf-1]imp
[r3-ospf-1]import-route rip r
[r3-ospf-1]import-route rip route-policy hh
优化13.0.0.0 24
[r2]route-policy hh permit node 500
Info: New Sequence of this List.
[r2]ip ip
[r2]ip ip-prefix yy p
[r2]ip ip-prefix yy permit 13.0.0.0 24
[r2]route-policy aa pe
[r2]route-policy aa permit n
[r2]route-policy aa permit node 10
Info: New Sequence of this List.
[r2-route-policy]if
[r2-route-policy]if-match ip
[r2-route-policy]if-match ip-prefix hh
[r2-route-policy]a
[r2-route-policy]apply c
[r2-route-policy]apply cost 10
[r2-ospf-1]im
[r2-ospf-1]import-route rip rou
[r2-ospf-1]import-route rip route-policy hh
3.2.2 修改R2路由表:
优化完成!!!