要求:
1.RIP中只有L0环回
2.优化路由
步骤1---配IP
R1
[R1]in g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
[R1-GigabitEthernet0/0/0]in g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.13.1 24
[R1]in l0
[R1-LoopBack0]ip add 1.1.1.1 24
R2
[R2]in g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2-GigabitEthernet0/0/0]in g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.24.2 24
R3
[R3]in g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.13.3 24
[R3-GigabitEthernet0/0/0]in g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.34.3 24
R4
[R4]in g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.24.4 24
[R4-GigabitEthernet0/0/0]in g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.34.4 24
步骤2---写OSPF和RIP
R1
[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.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.13.0 0.0.0.255
[R1-ospf-1]import-route direct
R2
[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.0 0.0.0.255
[R2-rip-1]version 2
[R2-rip-1]undo summary
[R2-rip-1]network 192.168.24.0
R3
[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.255
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]undo summary
[R3-rip-1]network 192.168.34.0
R4
[R4]rip
[R4-rip-1]version 2
[R4-rip-1]undo summary
[R4-rip-1]network 192.168.24.0
[R4-rip-1]network 192.168.34.0
步骤2---重发布
R2
[R2]ospf 1
[R2-ospf-1]import-route rip
[R2-ospf-1]rip
[R2-rip-1]import-route ospf 1
R3
[R3]ospf 1
[R3-ospf-1]import-route rip
[R3-ospf-1]rip
[R3-rip-1]import-route ospf 1
查看路由表
步骤4---把L0环回接入RIP中
R2
[R2]ip ip-prefix aa permit 1.1.1.1 24
[R2]route-policy huawei permit node 10
[R2-route-policy]if-match ip-prefix aa
[R2-route-policy]apply preference 90
[R2-route-policy]ospf 1
[R2-ospf-1]preference ase route-policy huawei
R3
[R3]ip ip-prefix aa permit 1.1.1.1 24
[R3]route-policy huawei permit node 10
[R3-route-policy]if-match ip-prefix aa
[R3-route-policy]apply preference 90
[R3-route-policy]ospf 1
[R3-ospf-1]preference ase route-policy huawei
测试
步骤5---优化路由
抓流量
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.12.0 0
[R2-acl-basic-2000]acl 2100
[R2-acl-basic-2100]rule permit source 192.168.24.0 0
做策略
[R2]route-policy huawei deny node 10
[R2-route-policy]if-match acl 2000
[R2-route-policy]apply cost 10
[R2]route-policy huawei deny node 20
[R2-route-policy]if-match acl 2100
[R2-route-policy]apply cost 10
[R2]route-policy huawei deny node 100
调用
[R2]rip
[R2-rip-1]import-route ospf 1 route-policy huawei
[R2-rip-1]ospf 1
[R2-ospf-1]import-route rip 1 route-policy huawei
测试