OSPF-MGRE综合实验

 拓扑结构:

 要求:

1、R6为ISP只能配置IP地址,R1~R5的环回为私有网段

2、R1/4/5为全连的MGRE结构,R1/2/3为星型的拓扑结构,R1为中心站点

3、所有私有网段可以互相通讯,私有网段使用OSPF协议完成

 使用的设备:6台路由器

解决网络拓扑

1、确定广播域的个数

2、分配网段

3、配置IP地址 (优先配置路由器)

确定广播域的个数

根据拓扑结构图以及要求可知,本拓扑结构一共拥有9个网段,包括4个给定网段,一个环回网段和四个内网网段

分配网段

自主分配网段

192.168.0.0/24和10.1.1.0/8和15.1.1.0/24网段

 配置路由器IP地址

AR1:

<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 16.1.1.1 24
[r1-GigabitEthernet0/0/0]
Apr 29 2023 20:17:37-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]q
[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ip address 15.1.1.1 24
Apr 29 2023 20:17:52-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]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 24
[r1-LoopBack0]q
[r1]

AR2:

<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 17.1.1.1 24
[r2-GigabitEthernet0/0/0]
Apr 29 2023 20:18:34-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]q
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.2.1 24
[r2-LoopBack0]q
[r2]

AR3:

<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r3
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 18.1.1.1 24
[r3-GigabitEthernet0/0/0]
Apr 29 2023 20:19:15-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]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.3.1 24
[r3-LoopBack0]q
[r3]

AR4:

<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 19.1.1.1 24
[r4-GigabitEthernet0/0/0]
Apr 29 2023 20:19:56-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]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.4.1 24
[r4-LoopBack0]q
[r4]

AR5:

<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r5
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip address 20.1.1.1 24
[r5-GigabitEthernet0/0/0]
Apr 29 2023 20:20:49-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-GigabitEthernet0/0/0]q
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.5.1 24
[r5-LoopBack0]q
[r5]

AR6:

<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname isp
[isp]interface GigabitEthernet 0/0/0
[isp-GigabitEthernet0/0/0]ip address 16.1.1.2 24
[isp-GigabitEthernet0/0/0]
Apr 29 2023 20:21:33-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]q
[isp]interface GigabitEthernet 0/0/1
[isp-GigabitEthernet0/0/1]ip address 17.1.1.2 24
Apr 29 2023 20:21:48-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]q
[isp]interface GigabitEthernet 0/0/2
[isp-GigabitEthernet0/0/2]ip address 15.1.1.2 24
Apr 29 2023 20:22:05-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]q
[isp]interface GigabitEthernet 1/0/0
[isp-GigabitEthernet1/0/0]ip address 18.1.1.2 24
Apr 29 2023 20:22:22-08:00 isp %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface GigabitEthernet1/0/0 has entered the UP state. 
[isp-GigabitEthernet1/0/0]q
[isp]interface GigabitEthernet 2/0/0
[isp-GigabitEthernet2/0/0]ip address 19.1.1.2 24
Apr 29 2023 20:22:38-08:00 isp %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP on the interface GigabitEthernet2/0/0 has entered the UP state. 
[isp-GigabitEthernet2/0/0]q
[isp]interface GigabitEthernet 3/0/0
[isp-GigabitEthernet3/0/0]ip address 20.1.1.2 24
Apr 29 2023 20:22:53-08:00 isp %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP on the interface GigabitEthernet3/0/0 has entered the UP state. 
[isp-GigabitEthernet3/0/0]q
[isp]interface LoopBack 0
[isp-LoopBack0]ip address 3.3.3.3 24
[isp-LoopBack0]q
[isp]

配置MGRE部分

AR1:中心站点

[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 16.1.1.1 
Apr 29 2023 20:31:32-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 entry multicast dynamic 
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]q
[r1]

AR2:

[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
Apr 29 2023 20:34:49-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. 
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.1.1 register
[r2-Tunnel0/0/0]q
[r2]

AR3:

[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
Apr 29 2023 20:35:57-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 entry 10.1.1.1 16.1.1.1 register
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]q
[r3]

配置全连网状的MGRE,没有中心站点,双向注册

AR1:

[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 10.1.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/1]source 15.1.1.1
Apr 29 2023 21:31:25-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state. 
[r1-Tunnel0/0/1]nhrp entry multicast dynamic 
[r1-Tunnel0/0/1]nhrp network-id 101
[r1-Tunnel0/0/1]q
[r1]

AR4:

[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 10.1.2.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r4-Tunnel0/0/0]source GigabitEthernet 0/0/0
Apr 29 2023 21:36:39-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 101
[r4-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register 
[r4-Tunnel0/0/0]nhrp entry 10.1.2.3 20.1.1.1 register
[r4-Tunnel0/0/0]q
[r4]

AR5:R4可以和R5进行通信,但是R5并不能向R4进行注册,所以需要在5上也开启伪广播

[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ip address 10.1.2.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]source GigabitEthernet 0/0/0
Apr 29 2023 21:38:10-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 101
[r5-Tunnel0/0/0]nhrp entry 10.1.2.1 15.1.1.1 register
[r5-Tunnel0/0/0]nhrp entry 10.1.2.2 19.1.1.1 register
Info: This peer protocol address conflicts with hub register peer protocol address.
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]q
[r5] 

配置了MGRE之后,真实的拓扑结构

 然后R1~R5的每一个路由器上都写上一条指向R6的静态缺省路由

[r1]ip route-static 0.0.0.0 0 16.1.1.2
[r1]ip route-static 0.0.0.0 0 15.1.1.2
[r2]ip route-static 0.0.0.0 0 17.1.1.2
[r3]ip route-static 0.0.0.0 0 18.1.1.2
[r4]ip route-static 0.0.0.0 0 19.1.1.2
[r5]ip route-static 0.0.0.0 0 20.1.1.2

此时配置了MGRE的设备之间可以相互通信,但是两个MGRE之间不能通信,还得运行OSPF协议

配置OSPF动态路由协议

AR1:

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[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 10.1.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]q
[r1-ospf-1]q
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ospf network-type broadcast 
[r1-Tunnel0/0/0]q
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ospf network-type broadcast 
[r1-Tunnel0/0/1]q
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 123456
[r1-Tunnel0/0/0]q
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ospf authentication-mode md5 1 cipher 123456
[r1-Tunnel0/0/1]q
[r1]

AR2:不进行DR/BDR选举

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]q
[r2-ospf-1]q
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ospf network-type broadcast 
[r2-Tunnel0/0/0]ospf dr-priority 0
[r2-Tunnel0/0/0]q
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 123456
[r2-Tunnel0/0/0]q
[r2]

AR3:不进行DR/BDR选举

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]q
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast 
[r3-Tunnel0/0/0]ospf dr-priority 0
[r3-Tunnel0/0/0]q
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3-Tunnel0/0/0]q
[r3]

AR4:

[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[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 10.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]q
[r4-ospf-1]q
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ospf network-type broadcast
[r4-Tunnel0/0/0]q
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 123456
[r4-Tunnel0/0/0]q
[r4]

AR5:

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[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 10.1.1.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]q
[r5-ospf-1]q
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
[r5-Tunnel0/0/0]q
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 123456
[r5-Tunnel0/0/0]q
[r5]

配置OSPF动态路由协议,配置认证,保证更新安全

配置之后,全网可以正常相互访问

 

 并且都可以访问R6(isp)的环回,但是以ping -a 的命令指定他们访问R6环回的地址却访问不到R6的环回,这个问题暂时得不到解决。

 实验到此为止,就完成了 ,要求也是全部完成。

猜你喜欢

转载自blog.csdn.net/mxxcxy/article/details/130443262