实验拓扑图:
实验需求:
1、按照图示配置 IP 地址,R1,R3,R4 上使用 loopback 口模拟业务网段
2、R1 和R2 运行 RIPv2,R2,R3和R4运行 oSPF,各自协议内部互通
3、在 RIP 和 oSPF 间配置双向路由引入,要求除 R4 上的业务网段以外,其他业务网段路由都引入到对方协议内部
4、使用路由过滤,使 R4 无法学习到 R1的业务网段路由,要求使用 prefix-list 进行匹配
5、0SPF 区域中不能出现 RIP 协议报文
实验步骤:
配置IP:
R1:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]INT G0/0/0
[R1-GigabitEthernet0/0/0]ip ad 100.1.1.1 24
[R1-GigabitEthernet0/0/0]
Apr 22 2024 19:32:41-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[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
[R1-LoopBack1]q
[R1]q
[R1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.1.1.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.0.1/32 up up(s)
LoopBack1 192.168.1.1/32 up up(s)
NULL0 unassigned up up(s)
[R1]
R2:
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]SYS R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2-GigabitEthernet0/0/0]
Apr 22 2024 19:33:57-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.2.2.2 24
Apr 22 2024 19:34:18-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]
[R2-GigabitEthernet0/0/1]q
[R2]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
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
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[R2]
R3:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]INT G0/0/0
[R3-GigabitEthernet0/0/0]IP ADD 100.2.2.3 24
Apr 22 2024 19:34:53-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]INT G0/0/1
[R3-GigabitEthernet0/0/1]IP ADD 100.3.3.3 24
Apr 22 2024 19:35:14-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]INT L0
[R3-LoopBack0]IP ADD 192.168.2.1 32
[R3-LoopBack0]INT L1
[R3-LoopBack1]IP ADD 192.168.3.1 32
[R3-LoopBack1]Q
[R3]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 1
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
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.2.1/32 up up(s)
LoopBack1 192.168.3.1/32 up up(s)
NULL0 unassigned up up(s)
[R3]
R4:
<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]SYS R4
[R4]INT G0/0/0
[R4-GigabitEthernet0/0/0]IP ADD 100.3.3.4 24
[R4-GigabitEthernet0/0/0]
Apr 22 2024 19:36:16-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[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
[R4-LoopBack1]Q
[R4]Q
[R4]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.3.3.4/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.4.1/32 up up(s)
LoopBack1 192.168.5.1/32 up up(s)
NULL0 unassigned up up(s)
[R4]
运行rip协议:
R1:
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo s
[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 sum
[R2-rip-1]undo summary
[R2-rip-1]net 100.0.0.0
[R2-rip-1]q
查看:
启动ospf协议:
area 0:
R2:
[R2]ospf 1 ro
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.255.255
[R2-ospf-1-area-0.0.0.0]
R3:
[R3]ospf 1 r
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.255.255
[R3-ospf-1-area-0.0.0.0]
[R3-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.1.255
[R3-ospf-1-area-0.0.0.0]q
area 1:
R3:
[R3]ospf 1
[R3-ospf-1]are 1
[R3-ospf-1-area-0.0.0.1]net 100.3.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]
R4:
[R4]ospf 1 ro
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]are 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.0 0.0.1.255
查看;
双向重发布;
R2:
[R2]RIP
[R2-rip-1]im
[R2-rip-1]import-route ospf
[R2-rip-1]q
[R2]ospf
[R2-ospf-1]i
[R2-ospf-1]import-route rip
[R2-ospf-1]q
查看:
路由过滤;
在R2上创建ACL来拒绝R4上的业务网段路由,并将其他网段路由放行。
[R2]acl 2000
[R2-acl-basic-2000]rul
[R2-acl-basic-2000]rule d
[R2-acl-basic-2000]rule deny s
[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上创建路由策略,关联ACL。
[R2]ro
[R2]route-policy 123 permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match acl 2000
[R2-route-policy]q
在ospf中引入rip路由
[R2]rip 1
[R2-rip-1]im
[R2-rip-1]import-route ospf 1 r
[R2-rip-1]import-route ospf 1 route-policy 123
[R2-rip-1]q
[R2]
查看:
此时,除R4上的业务网段以外,其他业务网段路由都引入到对方协议内部。
使用prefix-list
使R4无法学习到R1的业务网段路由
[R4]ip ip-prefix aa index 10 deny 192.168.0.0 23 less-equal 32
[R4]ip ip-prefix aa index 20 permit 0.0.0.0 0 less-equal 32
[R4]ospf 1
[R4-ospf-1]filter-policy ip-prefix aa import
[R4-ospf-1]q
查看;
由于0SPF 区域中不能出现 RIP 协议报文,所以使用静默接口
[R2]rip
[R2-rip-1]si
[R2-rip-1]silent-interface g
[R2-rip-1]silent-interface GigabitEthernet 0/0/1
[R2-rip-1]q
[R2]
最后实验完成!!!