1.配置地址
2.启动ospf协议
3.启动rip协议
4.将PC1 的路由引入OSPF中
[R1]ospf 1
[R1-ospf-1]import-route direct
5.将 PC2重发布到RIP中
[R4]rip
[R4-rip-1]import-route direct
6.在R2 和R3上进行双点双向重发布
[R3]rip
[R3-rip-1]import-route ospf 1
[R3]ospf 1
[R3-ospf-1]import-route rip u
[R2]rip
[R2-rip-1]import-route ospf 1
[R2]ospf 1
[R2-ospf-1]import-route rip
R1路由表
7.在R3的路由表中 存在一个次优路由
(1)第一种解决办法
[R2]ip ip-prefix pc1 permit 10.1.1.0 24
[R2]route-policy pc1 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix pc1
[R2-route-policy]apply preference 90
[R2-route-policy]qu
[R2]route-policy pc1 permit node 20
Info: New Sequence of this List.
[R2]ospf 1
[R2-ospf-1]preference route-policy pc1
[R2-ospf-1]qu
[R3]ip ip-prefix pc1 permit 10.1.1.0 24
[R3]route-policy pc1 permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix pc1
[R3-route-policy]apply preference 160
[R3-route-policy]qu
[R3]route-policy pc1 permit node 20
Info: New Sequence of this List.
[R3-route-policy]qu
[R3]rip 1
[R3-rip-1]preference route-policy pc1
反应较慢 可以通过shutdown 接口来查看
R2上配置是为了以后R2故障后出现该次优路由
第二种方法:
[R3]ip ip-prefix xwl deny 10.1.1.0 24
[R3]ip ip-prefix xwl permit 0.0.0.0 0 less-equal 32
[R3-rip-1]filter-policy ip-prefix xwl import GigabitEthernet 0/0/1 学习到该次优路由的接口
第三种方法:
[R1]ospf 1
[R1-ospf-1]
[R1-ospf-1]import-route direct ?
cost Set cost
route-policy Route policy
tag Specify route tag
type Metric type of the imported external routes
Please press ENTER to execute command
[R1-ospf-1]import-route direct tag 111
然后在R2 和R3上根据需求采取第一或第二种办法
[R3]route-policy tag permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match tag 111
[R3-route-policy]apply preference 90
[R3-route-policy]qu
[R3]route-policy pc1 permit node 20
Info: New Sequence of this List.
[R3-route-policy]qu
[R2]ospf 1
[R2-ospf-1]preference route-policy tag
[R2-ospf-1]qu