目录
实验要求
IP配置
配置动态路由协议
RIP
OSPF
查看建邻情况
双向重发布
路由过滤
地址前缀列表
静默接口
实验要求
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]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 100.1.1.1 24
[R1-GigabitEthernet0/0/0]
Apr 22 2024 19:33:49-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]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>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2-GigabitEthernet0/0/0]
Apr 22 2024 19:35:32-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:35:50-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]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]sysname R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.2.2.3 24
[R3-GigabitEthernet0/0/0]
Apr 22 2024 19:36:59-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 g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 100.3.3.3 24
Apr 22 2024 19:37:21-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]sysname 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:39:54-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]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 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
R2:
[R2]ospf 1 router-id 2.2.2.2
[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.0 0.0.1.255
[R3-ospf-1-area-0.0.0.0]q
[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.0 0.0.1.255
查看建邻情况
R2:
R3:
R4:
双向重发布
R2:
[R2]rip 1
[R2-rip-1]im
[R2-rip-1]import-route ospf
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]im
[R2-ospf-1]import-route rip
查看路由表:
R1:
R2:
OSPF:
RIP:
R3:
R4:
路由过滤
因为需要R4上的业务网段不引入RIP协议网段中,所以在R2上配置路由过滤:
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.4.0 0.0.1.255
[R2-acl-basic-2000]q
[R2]route-policy a deny node 1
Info: New Sequence of this List.
[R2-route-policy]if-match acl 2000
[R2-route-policy]q
[R2]route-policy a permit node 2
Info: New Sequence of this List.
[R2-route-policy]q
[R2]rip 1
[R2-rip-1]import-route ospf route-policy a
查看RIP区域路由表:
R1:
地址前缀列表
R4无法学习到R1的业务网段路由,使用地址前缀列表完成:
R2:
[R2]ip ip-prefix q index 1 deny 192.168.0.0 23 less-equal 32
[R2]ip ip-prefix q index 2 permit 0.0.0.0 0 less-equal 32
[R2]route-policy w permit node 1
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix q
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]import-route rip route-policy w
查看R4路由表:
静默接口
因为RIP协议按主类宣告的特点,area 0区域也被宣告进了RIP的管辖区域,故要实现要求5,可以采用静默接口的方法:
[R2]rip 1
[R2-rip-1]silent-interface g0/0/1
至此配置完成。