1.IP地址及相关配置
R1
[r1]int l0
[r1-LoopBack0]ip address 1.1.1.1 24
[r1-LoopBack0]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.0.0.1 24
[r1-GigabitEthernet0/0/0]q
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 13.0.0.1 24
[r1]rip
[r1-rip-1]ver 2
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 13.0.0.0
[r1-rip-1]network 1.0.0.0
R2
[r2]int l0
[r2-LoopBack0]ip address 2.2.2.2 24
[r2-LoopBack0]q
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 12.0.0.2 24.
[r2-GigabitEthernet0/0/0]q
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 24.0.0.1 24
[r2-GigabitEthernet0/0/1]q
[r2]rip
[r2-rip-1]ver 2
[r2-rip-1]network 12.0.0.0
[r2-rip-1]network 2.0.0.0
[r2-rip-1]q
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 24.0.0.0 0.0.0.255
R3
[r3]int l0
[r3-LoopBack0]ip address 3.3.3.3 24
[r3-LoopBack0]q
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 13.0.0.2 24
[r3-GigabitEthernet0/0/0]q
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 34.0.0.1 24
[r3]rip
[r3-rip-1]ver 2
[r3-rip-1]network 13.0.0.0
[r3-rip-1]q
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
R4
[r4]int l0
[r4-LoopBack0]ip add
[r4-LoopBack0]ip address 4.4.4.4 24
[r4-LoopBack0]q
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add
[r4-GigabitEthernet0/0/0]ip address 24.0.0.2 24
Jul 16 2024 18:37:48-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]q
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add
[r4-GigabitEthernet0/0/1]ip address 34.0.0.2 24
[r4-GigabitEthernet0/0/1]q
[r4-ospf-1]q
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 24.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 24.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]q
2.双向重发布
R2
[r2]rip
[r2-rip-1]import-route ospf 1
[r2-rip-1]q
[r2]ospf 1
[r2-ospf-1]import-route rip
R3
[r3]rip
[r3-rip-1]import-route ospf 1
[r3-rip-1]q
[r3]ospf 1
[r3-ospf-1]import-route rip
3.路由策略
由图知12.0.0.0 13.0.0.0出现了选路不佳
1.解决12.0.0.0
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 12.0.0.0 0.0.0.255
[r3-acl-basic-2000]q
[r3]route-policy aaa deny node 10
Info: New Sequence of this List.
[r3-route-policy]if-match acl 2000
[r3-route-policy]q
[r3]ospf 1
[r3-ospf-1]import-route rip route-policy aaa
[r3-ospf-1]q
[r3]route-policy aaa permit node 1000
2.解决13.0.0.0
[r2]ip ip-prefix bb permit 13.0.0.0 24
[r2]route-policy bbb deny node 10
Info: New Sequence of this List.
[r2-route-policy]if-match ip-prefix bb
[r2-route-policy]q
[r2]ospf 1
[r2-ospf-1]import-route rip route-policy bbb
[r2-ospf-1]q
[r2]route-policy bbb permit node 1000
检验