实验拓扑:
实验配置:
ip配置
#R1配置
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 100.1.1.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 192.168.0.1 32
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.1.1 32
#R2配置
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.2.2.2 24
#R3配置
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.2.2.3 24
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 100.3.3.3 24
[R3-GigabitEthernet0/0/0]int l0
[R3-LoopBack0]ip add 192.168.2.1 32
[R3-LoopBack0]int l1
[R3-LoopBack1]ip add 192.168.3.1 24
#R4配置
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 100.3.3.4 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip add 192.168.4.1 32
[R4-LoopBack0]int l1
[R4-LoopBack1]ip add 192.168.5.1 32
#R1配置
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]net 100.0.0.0
[R1-rip-1]net 192.168.0.0
[R1-rip-1]net 192.168.1.0
#R2配置
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]undo summary
[R2-rip-1]net 100.0.0.0
ospf 配置:
area 0
#R2配置
[R2]ospf 1 router-id 1.1.1.1
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.0.255
#R3配置
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]net 192.168.2.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 192.168.3.1 0.0.0.0
area 1
#R配置
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]net 100.3.3.0 0.0.0.255
#R4配置
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 1
[R4-ospf-1-area-0.0.0.1]net 100.3.3.0 0.0.0.255
[R4-ospf-1-area-0.0.0.1]net 192.168.4.1 0.0.0.0
[R4-ospf-1-area-0.0.0.1]net 192.168.5.1 0.0.0.0
路由引入:
[R2]rip 1
[R2-rip-1]import-route ospf
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]import-route rip
路由表学习情况
R1
R4
路由过滤
在R2上配置路由过滤,使RIP部分无法学到R4业务网段的信息
#抓取流量
[R2]acl 2000
[R2-acl-basic-2000]rule deny source 192.168.4.0 0.0.1.255
[R2-acl-basic-2000]rule permit source 0.0.0.0 255.255.255.255
#路由过滤
[R2]route-policy 123 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match acl 2000
[R2-route-policy]q
[R2]rip 1
[R2-rip-1]import-route ospf 1 route-policy 123
R1路由表(R4业务网段没有被引入rip)
在R4上进行路由过滤(地址前缀列表),使 R4 无法学习到 R1的业务网段路由
[R4]ip ip-prefix aa index 10 deny 192.168.0.0 23 less-equal 32 //将R1的两条业务网段合并成一条
[R4]ip ip-prefix aa index 20 permit 0.0.0.0 0 less-equal 32 //允许除R1业务网段之外的流量通过
[R4]ospf 1
[R4-ospf-1]filter-policy ip-prefix aa import //进入ospf,配置路由过滤,调用上一步创建的 prefix-list
R4路由表
R3路由表
在R2上进入rip配置静默接口,使0SPF 区域中不能出现 RIP 协议报文
[R2]rip 1
[R2-rip-1]silent-interface GigabitEthernet 0/0/1