实验要求
1.搭建拓扑
路由策略分析:
拓扑左边是rip协议,右边是ospf协议,想要实现全网可达可以采用多点双向重发布的方式。
对于rip协议使用偏移列表来干涉选路,对于ospf协议采用路由策略来干涉选路
2.配置ip
r1
[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
r2
[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
r3
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]ip address 13.0.0.2 24
[AR3]interface GigabitEthernet 0/0/1
[AR3-GigabitEthernet0/0/1]ip address 34.0.0.1 24
[AR3]interface l0
[AR3-LoopBack0]ip address 3.3.3.3 24
r4
[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
[AR4]interface l0
[AR4-LoopBack0]ip address 4.4.4.4 24
3.配置rip协议
r1
[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 1.1.1.1
r2
[AR2]rip
[AR2-rip-1]version 2
[AR2-rip-1]network 12.0.0.0
[AR2-rip-1]network 192.168.2.0
r3
[AR3]rip
[AR3-rip-1]version 2
[AR3-rip-1]network 13.0.0.0
4.ospf协议配置
r2
[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
r3
[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
r4
[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
5.双向重发布
r2
[AR2]rip 1
[AR2-rip-1]import-route ospf 1
[AR2]ospf 1
[AR2-ospf-1]import-route rip
[AR2]ospf 1
[AR2-ospf-1]import-route rip 1 route-policy A
r3
[AR3]rip 1
[AR3-rip-1]import-route ospf 1
[AR3]ospf 1
[AR3-ospf-1]import-route rip
6.路由策略
r2
[AR2]route-policy A permit node 10
[AR2-route-policy]if-match ip-prefix A
[AR2-route-policy]apply cost-type type-1 #修改A表中node节点流量的属性
[AR2]route-policy A permit node 20
[AR2-route-policy]if-match ip-prefix A
[AR2-route-policy]apply cost-type type-1 #修改A表中node节点流量的属性
[AR2]route-policy A permit node 30 #定义空列表,允许其他流量访问
[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
r3
[AR3]ip ip-prefix A permit 13.0.0.0 24 #定义要抓取的流量
[AR3]route-policy A permit node 10
[AR3-route-policy]if-match ip-prefix A
[AR3-route-policy]apply cost-type type-1 #对抓取的流量修改属性
[AR3]route-policy A permit node 50 #定义空列表,允许让其他流量通过
7.全网可达测试
r1 ping r4
<AR1>ping -a 192.168.1.1 192.168.4.1
PING 4.4.4.4: 56data bytes, press CTRL_C to break
Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 192.168.4.1: bytes=56 Sequence=2 tt1=254 time=10 ms
Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 192.168.4.1: bytes=56 Sequence-4 ttl=254 time=30 ms
Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 192.168.4.1ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max=10/22/30ms