目录
实验要求:
R1的环回并没有宣告进OSPF网络,需要通过重发布导入到OSPF网络。
保证全网可达,且没有路由回馈以及选路不佳。
一、配置r1、r2、r3、r4的ip地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.13.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.24.2 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.13.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.34.3 24
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.24.4 24
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.34.4 24
二、启动ospf
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]network 192.168.12.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.13.1 0.0.0.0
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]network 192.168.12.2 0.0.0.0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 192.168.13.3 0.0.0.0
三、启动rip
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 192.168.24.0
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 192.168.34.0
[R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]network 192.168.24.0
[R4-rip-1]network 192.168.34.0
四、将R1环回引入OSPF网络
[R1]ip ip-prefix aa permit 1.1.1.0 24
[R1]route-policy aa permit node 10
[R1-route-policy]if-match ip-prefix aa
[R1-route-policy]q
[R1]ospf 1
[R1-ospf-1]import-route direct route-policy aa
五、r2、r3进行双向重发布
[R2]ospf 1
[R2-ospf-1]import-route rip 1
[R2-ospf-1]q
[R2]rip 1
[R2-rip-1]import-route ospf 1
[R3]ospf 1
[R3-ospf-1]import-route rip 1
[R3-ospf-1]q
[R3]rip 1
[R3-rip-1]import-route ospf 1
六、在r2 、r3之间使用路由策略,形成等价路由
[R2]ip ip-prefix aa permit 1.1.1.0 24
[R2]route-policy aa permit node 10
[R2-route-policy]if-match ip-prefix aa
[R2-route-policy]apply preference 90
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]preference ase route-policy aa
[R3]ip ip-prefix aa permit 1.1.1.0 24
[R3]route-policy aa permit node 10
[R3-route-policy]if-match ip-prefix aa
[R3-route-policy]apply preference 90
[R3-route-policy]q
[R3]ospf 1
[R3-ospf-1]preference ase route-policy aa
七、使用偏移列表和过滤策略解决选路不佳
偏移列表:
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 192.168.12.0 0
[R4-acl-basic-2000]q
[R4]acl 2001
[R4-acl-basic-2001]rule permit source 192.168.13.0 0
[R4-acl-basic-2001]q
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]rip metricin 2001 5
[R4-GigabitEthernet0/0/0]q
[R4]int g 0/0/1
[R4-GigabitEthernet0/0/1]rip metricin 2000 5
过滤策略:
[R2]ip ip-prefix bb deny 192.168.34.0 24
[R2]ip ip-prefix bb permit 0.0.0.0 0 less-equal 32
[R2]ospf 1
[R2-ospf-1]filter-policy ip-prefix bb export
[R3]ip ip-prefix bb deny 192.168.24.0 24
[R3]ip ip-prefix bb permit 0.0.0.0 0 less-equal 32
[R3]ospf 1
[R3-ospf-1]filter-policy ip-prefix bb export