1,配置IP地址
R1:
[R1]dis ip interface brief Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.1.1.1/24 up up
LoopBack0 192.168.0.1/32 up up(s)
LoopBack1 192.168.1.1/32 up up(s) R2:
[R2]dis ip interface brief Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.1.1.2/24 up up
GigabitEthernet0/0/1 100.2.2.2/24 up up R3:
[R3]dis ip interface brief Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.2.2.3/24 up up
GigabitEthernet0/0/1 100.3.3.3/24 up up
LoopBack0 192.168.2.1/32 up up(s)
LoopBack1 192.168.3.1/32 up up(s)R4:
[R4]dis ip interface brief Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.3.3.4/24 up up
LoopBack0 192.168.4.1/32 up up(s)
LoopBack1 192.168.5.1/32 up up(s)
2,R1和R2运行RIPV2,R2,R3和R4运行OSPF,各自协议内部互通
RIP:
R1:
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]network 100.0.0.0
[R1-rip-1]network 192.168.0.0
[R1-rip-1]network 192.168.1.0R2:
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]net
[R2-rip-1]network 100.0.0.0OSPF:
R2:
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255R3:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]network 100.3.3.0 0.0.0.255R4:
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 1
[R4-ospf-1-area-0.0.0.1]network 100.3.3.0 0.0.0.255
3,在RIP和OSPF间配置双向路由引入,要求除R4上的业务网段以外,其他业务网段路由都引入到对方协议内部
[R2]acl 2000
[R2-acl-basic-2000]rule deny source 192.168.4.0 0.0.1.255
//在R2上创建ACL来拒绝R4业务网段 [R2-acl-basic-2000]rule permit source 0.0.0.0 255.255.255.255
//把其他网段路由放行[R2-acl-basic-2000]q
[R2]route-policy o2r permit node 10
[R2-route-policy]if-match acl 2000
//在R2上创建路由策略,关联ACL[R2]rip 1
[R2-rip-1]import-route ospf route-policy o2r
//在RIP中引入OSPF路由,调用路由策略[R2-ospf-1]import-route rip
//在OSPF中引入RIP路由
4,使用路由过滤,使R4无法学习到R1的业务网段路由,要求使用prefix-list进行匹配
[R4]ip ip-prefix g1 index 10 deny 192.168.0.0 23 less-equal 32
//将两条业务网段的路由合成一条[R4]ip ip-prefix g1 index 20 permit 0.0.0.0 0 less-equal 32
//允许其他路由经过[R4]ospf 1
[R4-ospf-1]filter-policy ip-prefix gl import
//配置路由过滤调用上一步创建的prefix-list
5,OSPF区域中不能出现RIP协议报文
[R2-rip-1]silent-interface GigabitEthernet 0/0/1