配置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
r1进行ospf配置
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.13.0 0.0.0.0
r1和r2进行配置
[R1]ip ip-prefix aa permit 1.1.1.0 24
[R1]route-policy aa permit node 10
Info: New Sequence of this List.
[R1-route-policy]if-match ip-prefix aa
[R1-ospf-1]import-route direct route-policy aa
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.12.0 0.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 192.168.13.0 0.0.0.0
R2和R3进行双点重发布
[R2]ospf 1
[R2-ospf-1]import-route rip 1
[R2]rip 1
[R2-rip-1]import-route ospf 1
[R3]ospf 1
[R3-ospf-1]import-route rip 1
[R3]rip 1
[R3-rip-1]import-route ospf 1
[R3]ip ip-prefix aa permit 1.1.1.0 24
[R3]route-policy aa permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix aa
[R3-route-policy]apply preference 90
[R3]ospf 1
[R3-ospf-1]preference ase route-policy aa
r1进行ospf和限制网段
[R1-ospf-1]import-route direct
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.12.1 0
[R1-acl-basic-2000]rule permit source 192.168.13.1 0
对r2和r3进行路由策略配置
[R2]ip ip-prefix tb permit 0.0.0.0 0 less-equal 32
[R2]ospf 1
[R2-ospf-1]filter-policy ip-prefix tb export
[R3]ip ip-prefix tb deny 192.168.24.0 24
[R3]ip ip-prefixt tb permit 0.0.0.0 0 less-equal 32
[R3-ospf-1]filter-policy ip-prefix tb export