搭建实验拓扑图
要求:重发布
配地址
r1
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 1.1.1.1 32
[r1-LoopBack0]q
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[r1-GigabitEthernet0/0/0]q
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 13.1.1.1 24
[r1-GigabitEthernet0/0/1]q
r2
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 2.2.2.2 32
[r2-LoopBack0]q
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[r2-GigabitEthernet0/0/0]q
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]ip address 24.1.1.1 24
[r2-GigabitEthernet0/0/1]q
r3
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 3.3.3.3 32
[r3-LoopBack0]q
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ip address 13.1.1.2 24
[r3-GigabitEthernet0/0/1]q
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 34.1.1.1 24
[r3-GigabitEthernet0/0/0]q
r4
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 4.4.4.4 32
[r4-LoopBack0]q
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 24.1.1.2 24
[r4-GigabitEthernet0/0/0]q
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ip address 34.1.1.2 24
[r4-GigabitEthernet0/0/1]q
查看
RIP协议
r1
[r1]rip 1
[r1-rip-1]version 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]rip 1
[r2-rip-1]version 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.1.1.1 0.0.0.0
r3
[r3]rip 1
[r3-rip-1]version 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 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
r4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
r2
[r2]rip 1
[r2-rip-1]import-route ospf 1
[r2-rip-1]q
[r2]ospf 1
[r2-ospf-1]import-route rip 1
r3
[r3-ospf-1]import-route rip 1
[r3-ospf-1]q
[r3]rip 1
[r3-rip-1]import-route ospf 1
在r4上查看路由表
抓取流量
r1
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 3.3.3.3 0.0.0.0
[r1-acl-basic-2000]q
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]rip metricin 2000 3
路由策略
r1
[r1]ip ip-prefix xx deny 24.1.1.0 24
[r1]ip ip-prefix xx permit 0.0.0.0 0 less-equal 32
[r1]rip 1
[r1-rip-1]filter-policy ip-prefix xx import g0/0/1
r2
[r2]ip ip-prefix xx permit 34.1.1.0 24
[r2]route-policy hcip deny node 10
[r2-route-policy]if-match ip-prefix xx
[r2-route-policy]q
[r2]route-policy hcip permit node 20
[r2-route-policy]q
[r2]rip 1
[r2-rip-1]import-route ospf 1 route-policy hcip
在r1上查看
r3
[r3]ip ip-prefix xx permit 2.2.2.2 32
[r3]route-policy yy permit node 10
[r3-route-policy]if-match ip-prefix xx
[r3-route-policy]apply cost 5
[r3-route-policy]q
[r3]route-policy yy permit node 20
[r3-route-policy]q
[r3]ospf 1
[r3-ospf-1]import-route rip 1 route-policy yy
在r4上查看
r3
[r3]ip ip-prefix nn permit 12.1.1.0 24
[r3]route-policy mm permit node 10
[r3-route-policy]if-match ip-prefix nn
[r3-route-policy]apply tag 1
[r3-route-policy]q
[r3]route-policy mm permit node 20
[r3-route-policy]q
[r3]ospf 1
[r3-ospf-1]import-route rip 1 route-policy mm
r4
[r4-route-policy]if-match tag 5
[r4-route-policy]q
[r4]route-policy nn permit node 20
[r4-route-policy]q
[r4]ospf 1
[r4-ospf-1]filter-policy route-policy mm import
查看