基础配置:
[r1]int l0
[r1-LoopBack0]ip add 1.1.1.1 24
[r1-LoopBack0]int g0/0/0
[r1-GigabitEthernet0/0/0]ip ad 192.168.12.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.123.1 24
[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.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
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.12.2 0.00.0.0[r2]rip
[r2-rip-1]v 2
[r2-rip-1]network 192.168.24.0[r3-ospf-1]ospf 1 rout 3.3.3.3
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.13.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]rip
[r3-rip-1]v 2
[r3-rip-1]network 192.168.34.0
[r4]rip
[r4-rip-1] v 2
[r4-rip-1]network 192.168.24.0
[r4-rip-1]network 192.168.34.0
路由策略:
[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
[r1-acl-basic-2000]q
[r1]route-policy direct-ospf deny node 10
Info: New Sequence of this List.
[r1-route-policy]if-match acl 2000
[r1]route-policy direct-ospf permit node 20
Info: New Sequence of this List.
[r1-route-policy]ospf 1
[r1-ospf-1]import-route direct
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.13.0 0
[r2-acl-basic-2000]q
[r2]route-policy ospf- rip permit node 10
[r2]route-policy ospf-rip permit node 1
Info: New Sequence of this List.
[r2-route-policy]if-match acl 2000
[r2-route-policy]apply cost 2
[r2]route-policy ospf-rip permit node 20
Info: New Sequence of this List.
[r2-route-policy]q
[r2]rip 1
[r2-rip-1]import-route ospf 1 route-policy ospf-rip
路由表: