一、实验要求
二,实验过程
1. AR1
# 1. 配置IP
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ip address 12.0.0.1 24
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 13.0.0.1 24
[AR1]interface l0
[AR1-LoopBack0]ip address 192.168.1.1 24
# 2. 启动RIP并宣告
[AR1]rip 1
[AR1-rip-1]version 2
[AR1-rip-1]network 12.0.0.0
[AR1-rip-1]network 13.0.0.0
[AR1-rip-1]network 192.168.1.0
# 3. rip区域干涉选路,配置最优路径
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]rip metricin ip-prefix 4 2
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]rip metricin ip-prefix 3 2
[AR1]ip ip-prefix 4 index 10 permit 192.168.3.0 24
[AR1]ip ip-prefix 4 index 20 permit 34.0.0.0 24
[AR1]ip ip-prefix 3 index 10 permit 24.0.0.0 24
2. AR2
# 1. 配置IP
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]ip address 12.0.0.2 24
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]ip address 24.0.0.0 24
[AR2]interface l0
[AR2-LoopBack0]ip address 192.168.2.1 24
# 2. 启动RIP并宣告
[AR2]rip
[AR2-rip-1]version 2
[AR2-rip-1]network 12.0.0.0
[AR2-rip-1]network 192.168.2.0
# 3. 启动OSPF并宣告
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 24.0.0.1 0.0.0.0
# 4. 双向重发布
[AR2]rip 1
[AR2-rip-1]import-route ospf 1
[AR2]ospf 1
[AR2-ospf-1]import-route rip
# 5. 重发布时调用路由策略
[AR2]ospf 1
[AR2-ospf-1]import-route rip 1 route-policy A
# 6. 修改A表中node节点流量的属性,类型改为了1
[AR2]route-policy A permit node 10
[AR2-route-policy]if-match ip-prefix A
[AR2-route-policy]apply cost-type type-1
[AR2]route-policy A permit node 20
[AR2-route-policy]if-match ip-prefix A
[AR2-route-policy]apply cost-type type-1
# 7. 定义空列表,允许其他流量访问
[AR2]route-policy A permit node 30
# 8. 定义要抓取的流量
[AR2]ip ip-prefix A index 10 permit 192.168.2.0 24
[AR2]ip ip-prefix A index 20 permit 12.0.0.0 24
3. AR3
# 1. 配置IP
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]ip address 12.0.0.2 24
[AR3]interface GigabitEthernet 0/0/1
[AR3-GigabitEthernet0/0/1]ip address 34.0.0.1 24
# 2. 启动RIP并宣告
[AR3]rip
[AR3-rip-1]version 2
[AR3-rip-1]network 13.0.0.0
# 3. 启动OSPF并宣告
[AR3]ospf 1 router-id 3.3.3.3
[AR3-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 34.0.0.1 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
# 4. 双向重发布
[AR3]rip 1
[AR3-rip-1]import-route ospf 1
[AR3]ospf 1
[AR3-ospf-1]import-route rip
# 5. 定义要抓取的流量
[AR3]ip ip-prefix A permit 13.0.0.0 24
# 6. 对抓取的流量修改属性
[AR3]route-policy A permit node 10
[AR3-route-policy]if-match ip-prefix A
[AR3-route-policy]apply cost-type type-1
# 7. 定义空列表,允许让其他流量通过
[AR3]route-policy A permit node 50
# 8. 调用
[AR3-ospf-1]import-route rip route-policy A
4. AR4
# 1. 配置IP
[AR4]interface GigabitEthernet 0/0/0
[AR4-GigabitEthernet0/0/0]ip address 24.0.0.2 24
[AR4]interface GigabitEthernet 0/0/1
[AR4-GigabitEthernet0/0/1]ip address 34.0.0.2 24
# 2. 启动OSPF并宣告
[AR4]ospf 1 router-id 4.4.4.4
[AR4-ospf-1]area 0
[AR4-ospf-1-area-0.0.0.0]network 24.0.0.2 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]network 34.0.0.2 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
三,实验测试及结果
1. AR1
2. AR2
3. AR3
4. AR4