一、实验需求
1,R1-R3-R4构建全连的MGRE环境
2,R1-R5-R6建立hub-spoke的MGRE环境,其中R1为中心
3,R1-R3...R6均存在环回网段模拟用户私网,使用OSPF使全网可达
4,其中R2为ISP路由器,仅配置IP地址
二、实验目的
掌握OSPF下的MGRE配置
三、实验步骤
1,布置拓扑
2,改设备名字配置IP
R1配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int l
[r1]int LoopBack 0
[r1-LoopBack0]ip add
[r1-LoopBack0]ip address 192.168.1.1 24
[r1-LoopBack0]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip addre
[r1-GigabitEthernet0/0/0]ip address 12.0.0.1 24
Nov 5 2023 12:40:30-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 g 0/0/1
[r1-GigabitEthernet0/0/1]ip address 21.0.0.1 24
[r1-GigabitEthernet0/0/1]
Nov 5 2023 12:40:43-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]disp
[r1]display i
[r1]display ip i
[r1]display ip ip-prefix
[r1]display ip ipv6-prefix
[r1]display ip interface b
[r1]display ip interface brief
*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 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.1/24 up up
GigabitEthernet0/0/1 21.0.0.1/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.1/24 up up(s)
NULL0 unassigned up up(s)
R2配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys isp
[isp]int g 0/0/0
[isp-GigabitEthernet0/0/0]ip address 12.0.0.2 24
Nov 5 2023 12:48:24-08:00 isp %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[isp-GigabitEthernet0/0/0]int g 0/0/1
[isp-GigabitEthernet0/0/1]ip address 21.0.0.2 24
[isp-GigabitEthernet0/0/1]
Nov 5 2023 12:48:38-08:00 isp %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[isp-GigabitEthernet0/0/1]int g 0/0/2
[isp-GigabitEthernet0/0/2]ip address 23.0.0.2 24
[isp-GigabitEthernet0/0/2]
Nov 5 2023 12:48:57-08:00 isp %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[isp-GigabitEthernet0/0/2]int g 4/0/0
[isp-GigabitEthernet4/0/0]ip address 24.0.0.2 24
[isp-GigabitEthernet4/0/0]
Nov 5 2023 12:49:16-08:00 isp %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[isp-GigabitEthernet4/0/0]int g 4/0/1
[isp-GigabitEthernet4/0/1]ip address 25.0.0.2 24
[isp-GigabitEthernet4/0/1]
Nov 5 2023 12:50:11-08:00 isp %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet4/0/1 has entered the UP state.
[isp-GigabitEthernet4/0/1]int g 4/0/2
[isp-GigabitEthernet4/0/2]ip address 26.0.0.2 24
[isp-GigabitEthernet4/0/2]
Nov 5 2023 12:50:30-08:00 isp %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet4/0/2 has entered the UP state.
[isp-GigabitEthernet4/0/2]q
[isp]dis ip in b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 7
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 7
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.0.0.2/24 up up
GigabitEthernet0/0/1 21.0.0.2/24 up up
GigabitEthernet0/0/2 23.0.0.2/24 up up
GigabitEthernet4/0/0 24.0.0.2/24 up up
GigabitEthernet4/0/1 25.0.0.2/24 up up
GigabitEthernet4/0/2 26.0.0.2/24 up up
GigabitEthernet4/0/3 unassigned down down
NULL0 unassigned up up(s)
R3配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r3
[r3]int l
[r3]int LoopBack 0
[r3-LoopBack0]ip addre
[r3-LoopBack0]ip address 192.168.3.0 24
Error: The specified IP address is invalid.
[r3-LoopBack0]ip address 192.168.3.1 24
[r3-LoopBack0]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 23.0.0.1 24
Nov 5 2023 12:42:41-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]q
[r3]dis
[r3]display ip in
[r3]display ip interface b
[r3]display ip interface brief
*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 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 23.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.3.1/24 up up(s)
NULL0 unassigned up up(s)
R4配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r4
[r4]int l
[r4]int LoopBack 0
[r4-LoopBack0]ip addre
[r4-LoopBack0]ip address 192.168.4.1 24
[r4-LoopBack0]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add
[r4-GigabitEthernet0/0/0]ip address 24.0.0.1 24
Nov 5 2023 12:44:03-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]q
[r4]disp
[r4]display ip
[r4]display ip in
[r4]display ip interface b
[r4]display ip interface brief
*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 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 24.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.4.1/24 up up(s)
NULL0 unassigned up up(s)
R5配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r5
[r5]int
[r5]interface l
[r5]interface LoopBack 0
[r5-LoopBack0]ip addre
[r5-LoopBack0]ip address 192.168.5.1 24
[r5-LoopBack0]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip address 25.0.0.1 24
Nov 5 2023 12:45:42-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5]display ip interface brief
*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 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 25.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.5.1/24 up up(s)
NULL0 unassigned up up(s)
R6配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r6
[r6]int l 0
[r6-LoopBack0]ip addre
[r6-LoopBack0]ip address 192.168.6.1 24
[r6-LoopBack0]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip ad
[r6-GigabitEthernet0/0/0]ip address 26.0.0.1 24
Nov 5 2023 12:47:10-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]q
[r6]display ip in 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 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 26.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.6.1/24 up up(s)
NULL0 unassigned up up(s)
3,R1-R3-R4构建全连的MGRE环境,注意配置静态路由,公网可通(中心要开启伪广播)
R1配置
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.2.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 21.0.0.1
Nov 5 2023 12:54:37-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry 192.168.2.3 23.0.0.1 r
[r1-Tunnel0/0/0]nhrp entry 192.168.2.3 23.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry 192.168.2.4 24.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry multicast d
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1]ip route-static 0.0.0.0 0 12.0.0.2
[r1]ip route-static 0.0.0.0 0 21.0.0.2
R3配置
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 23.0.0.1
Nov 5 2023 13:02:22-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 192.168.2.1 21.0.0.1 re
[r3-Tunnel0/0/0]nhrp entry 192.168.2.1 21.0.0.1 register
Info: This peer protocol address conflicts with hub register peer protocol addre
ss.
[r3-Tunnel0/0/0]nhrp entry 192.168.2.4 24.0.0.1 register
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
[r3-Tunnel0/0/0]q
[r3]ip route-static 0.0.0.0 0 23.0.0.2
R4配置
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]int t 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.2.4 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 24.0.0.1
Nov 5 2023 13:06:15-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]nhrp entry multicast dy
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r4-Tunnel0/0/0]nhrp entry 192.168.2.1 21.0.0.1 re
[r4-Tunnel0/0/0]nhrp entry 192.168.2.1 21.0.0.1 register
Info: This peer protocol address conflicts with hub register peer protocol addre
ss.
[r4-Tunnel0/0/0]nhrp entry 192.168.2.3 23.0.0.1 register
Info: This peer protocol address conflicts with hub register peer protocol addre
ss.
[r4-Tunnel0/0/0]q
[r4]ip route-static 0.0.0.0 0 24.0.0.2
4,R1-R5-R6建立hub-spoke的MGRE环境,其中R1为中心
R1配置
[r1]int t 0/0/1
[r1-Tunnel0/0/1]ip address 192.168.7.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 12.0.0.1
Nov 5 2023 13:10:24-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[r1-Tunnel0/0/1]nhrp network-id 50
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]q
R5配置
[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip address 192.168.7.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 25.0.0.1
Nov 5 2023 13:13:25-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r5-Tunnel0/0/0]nhrp network-id 50
[r5-Tunnel0/0/0]nhrp entry 192.168.7.1 12.0.0.1 register
[r5-Tunnel0/0/0]q
[r5]ip route-static 0.0.0.0 0 25.0.0.2
R6配置
[r6]int t 0/0/0
[r6-Tunnel0/0/0]ip address 192.168.7.6 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source 26.0.0.1
Nov 5 2023 13:15:51-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r6-Tunnel0/0/0]
[r6-Tunnel0/0/0]nhrp network-id 50
[r6-Tunnel0/0/0]nhrp entry 192.168.7.1 12.0.0.1 register
[r6-Tunnel0/0/0]q
[r6]ip route-static 0.0.0.0 0 26.0.0.2
5,使用OSPF使全网可达
R1配置
[r1]ospf 1 ro
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]net
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r1-Tunnel0/0/0]ospf network-type broadcast
[r1-Tunnel0/0/1]ospf network-type broadcast
R3配置
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]netw
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r3-Tunnel0/0/0]ospf network-type broadcast
R4配置
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]net
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r4-Tunnel0/0/0]ospf network-type broadcast
R5配置
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]netwo
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r5-Tunnel0/0/0]ospf network-type broadcast
R6配置
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r6-Tunnel0/0/0]ospf network-type broadcast