实验要求:
1、按照图示配置 IP 地址,R1,R3,R4 上使用 1oopback 口模拟业务网段
2、R1 和 R2 运行 RIPv2,R2,R3和R4 运行 OSPF,各自协议内部互通
3、在 RIP 和 OSPF 间配置双向路由引入,要求除R4上的业务网段以外,其他业务网段路由都引入到对方协议内部
4、使用路由过滤,使R4无法学习到R1 的业务网段路由,要求使用prefix-list进行匹配
5、OSPF 区域中不能出现RIP协议报文
实验拓扑图如图:
实验配置步骤:
1.按要求配置IP地址
R1:
sysname R1
interface GigabitEthernet0/0/0
ip address 100.1.1.1 255.255.255.0
interface LoopBack0
ip address 192.168.0.1 255.255.255.255
interface LoopBack1
ip address 192.168.1.1 255.255.255.255
R2:
sysname R2
interface GigabitEthernet0/0/0
ip address 100.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 100.2.2.2 255.255.255.0
R3:
sysname R3
interface GigabitEthernet0/0/0
ip address 100.2.2.3 255.255.255.0
interface GigabitEthernet0/0/1
ip address 100.3.3.3 255.255.255.0
interface LoopBack0
ip address 192.168.2.1 255.255.255.255
interface LoopBack1
ip address 192.168.3.1 255.255.255.255
R4:
sysname R4
interface GigabitEthernet0/0/0
ip address 100.3.3.4 255.255.255.0
interface LoopBack0
ip address 192.168.4.1 255.255.255.255
interface LoopBack1
ip address 192.168.5.1 255.255.255.255
2.配置对应rip和ospf协议并且进行网段宣告
R1:
rip 1
undo summary
version 2
network 100.0.0.0
network 192.168.0.0
network 192.168.1.0R2:
rip 1
version 2
network 100.0.0.0
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 100.2.2.0 0.0.0.255R3:
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 100.2.2.0 0.0.0.255
network 192.168.2.1 0.0.0.0
network 192.168.3.1 0.0.0.0
area 0.0.0.1
network 10.3.3.0 0.0.0.255R4:
ospf 1 router-id 4.4.4.4
area 0.0.0.1
network 0.0.0.0 255.255.255.255
3.在R2路由上按要求进行双向路由引入
[R2]rip 1
[R2-rip-1]import-route ospf
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]import-route rip
[R2-ospf-1]q
路由引入成功后观察R1和R4路由条目及来源
R1:
[R1]dis ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 6 Routes : 6RIP routing table status : <Active>
Destinations : 6 Routes : 6Destination/Mask Proto Pre Cost Flags NextHop Interface
100.2.2.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
100.3.3.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.2.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.3.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.4.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.5.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
R4
[R4]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 6 Routes : 6OSPF routing table status : <Active>
Destinations : 6 Routes : 6Destination/Mask Proto Pre Cost Flags NextHop Interface
100.1.1.0/24 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
100.2.2.0/24 OSPF 10 2 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.0.1/32 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.1.1/32 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.2.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.3.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
观察后发现R1所学到的路由中包括R4的环路,R4也学到了R1的环路路由,也就是实现了要求3中的双向路由引入。
4.下一步进行路由过滤,实现除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-acl-basic-2000]q
路由策略
[R2]route-policy yb p
[R2]route-policy yb permit node 10
Info: New Sequence of this List.
[R2-route-policy]if
[R2-route-policy]if-match acl 2000
[R2-route-policy]q
进行路由策略引入
引入[R2]rip 1
[R2-rip-1]import-route ospf 1
[R2-rip-1]import-route ospf 1 route-policy yb
[R2-rip-1]q
测试
测试
[R1]dis ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 4 Routes : 4RIP routing table status : <Active>
Destinations : 4 Routes : 4Destination/Mask Proto Pre Cost Flags NextHop Interface
100.2.2.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
100.3.3.0/24 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.2.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0
192.168.3.1/32 RIP 100 1 D 100.1.1.2 GigabitEthernet
0/0/0RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
过滤成功
5.使R4无法学习到R1 的业务网段路由,要求使用prefix-list进行匹配
路由过滤
[R4]ip ip-prefix yb index 10 deny 192.168.0.0 23 less-equal 32
[R4]ip ip-prefix yb index 20 permit 0.0.0.0 0 less-equal 32
[R4-ospf-1]filter-policy ip-prefix yb import
[R4-ospf-1]q
测试
[R4]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4OSPF routing table status : <Active>
Destinations : 4 Routes : 4Destination/Mask Proto Pre Cost Flags NextHop Interface
100.1.1.0/24 O_ASE 150 1 D 100.3.3.3 GigabitEthernet
0/0/0
100.2.2.0/24 OSPF 10 2 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.2.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0
192.168.3.1/32 OSPF 10 1 D 100.3.3.3 GigabitEthernet
0/0/0OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
测试成功
6、OSPF 区域中不能出现RIP协议报文
配置静默接口静默掉R2的G0/0/1接口
[R2-rip-1]silent-interface GigabitEthernet 0/0/1
[R2-rip-1]q
至此实验所有要求完成!!