OSPF-MGRE综合实验详解

实验拓扑:

 实验需求

1、R4为ISP,所连接的所有物理接口为公有网段,任意指定ip即可
2、R1-2-3 构建一个星型结构的MGRE结构,其中R1为中心点,假设R1的公有ip为固定地址
3、R1-5-6 构建另个全连网状的MGRE网络,其中R1/5均为中心区域
4、使用osPF实现整个私有网络的互通,同时所有pc可以正常访问R4的环回

实验步骤

配置IP地址

R1:

[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[r1-GigabitEthernet0/0/0]int g 0/0/1	
[r1-GigabitEthernet0/0/1]ip address 14.1.1.1 24
[r1-GigabitEthernet0/0/1]int g 0/0/2
[r1-GigabitEthernet0/0/2]ip address 41.1.1.1 24

R2:

[Huawei]sys r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip address 24.1.1.2 24 
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.2.1 24

R3:

[Huawei]sys r3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 34.1.1.3 24
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.3.1 24

R4:

[Huawei]sys r4
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip address 41.1.1.4 24
[r4-GigabitEthernet0/0/1]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip address 14.1.1.4 24 
[r4-GigabitEthernet0/0/1]int g 0/0/2	
[r4-GigabitEthernet0/0/2]ip address 45.1.1.4 24
[r4-GigabitEthernet0/0/2]int g 1/0/0
[r4-GigabitEthernet1/0/0]ip address 46.1.1.4 24
[r4-GigabitEthernet1/0/0]int g 2/0/0
[r4-GigabitEthernet2/0/0]ip address 34.1.1.4 24
[r4-GigabitEthernet2/0/0]int g 3/0/0
[r4-GigabitEthernet3/0/0]ip address 24.1.1.4 24
[r4]int l 0
[r4-LoopBack0]ip address 4.4.4.4 24

R5:

[Huawei]sys r5
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip address 45.1.1.5 24
[r5-GigabitEthernet0/0/0]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip address 192.168.4.1 24

R6:

[Huawei]sys R6
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip address 46.1.1.6 24
[R6-GigabitEthernet0/0/0]int g 0/0/1
[R6-GigabitEthernet0/0/1]ip address 192.168.5.1 24

配置NAT

R1:

[r1]acl 2000	
[r1-acl-basic-2000]rule 1 permit source any 
[r1-acl-basic-2000]q
[r1]int g 0/0/1	
[r1-GigabitEthernet0/0/1]nat outbound 2000
[r1-GigabitEthernet0/0/1]int g 0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000
[r1-GigabitEthernet0/0/2]q
[r1]ip route-static 0.0.0.0 0 14.1.1.4 
[r1]ip route-static 0.0.0.0 0 41.1.1.4

R2:

[r2]acl 2000	
[r2-acl-basic-2000]rule 1 permit source any 
[r2-acl-basic-2000]q
[r2]ip route-static 0.0.0.0 0 24.1.1.4
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2000

R3:

[r3]acl 2000	
[r3-acl-basic-2000]rule 1 permit source any 
[r3-acl-basic-2000]q
[r3]ip route-static 0.0.0.0 0 34.1.1.4
[r3]int g 0/0/0	
[r3-GigabitEthernet0/0/0]nat outbound 2000

R5:

[r5]acl 2000
[r5-acl-basic-2000]rule 1 permit source any 
[r5-acl-basic-2000]q
[r5]ip route-static 0.0.0.0 0 45.1.1.4
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]nat outbound 2000

R6:

[R6]acl 2000	
[R6-acl-basic-2000]rule 1 permit source any 
[R6-acl-basic-2000]q
[R6]ip route-static 0.0.0.0 0 46.1.1.4
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]nat outbound 2000

此时公网通

创建MGRE环境

R1:

[r1]int t 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 41.1.1.1
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 

R2:

[r2]int t 0/0/0
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r2-Tunnel0/0/0]source 24.1.1.2
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 41.1.1.1 register 
[r2-Tunnel0/0/0]ip address 10.1.1.2 24

R3:

[r3]int t0/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]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 41.1.1.1 register 
[r3-Tunnel0/0/0]source 34.1.1.3

查看R1的hnrp注册表:

 注册成功

R1:

[r1]int t 0/0/1
[r1-Tunnel0/0/1]ip address 20.1.1.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/1]source 14.1.1.1
Jul 22 2023 00:34:14-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 200
[r1-Tunnel0/0/1]nhrp entry multicast dynamic 

R5:

[r5]int t 0/0/1
[r5-Tunnel0/0/1]ip address 20.1.1.2 24
[r5-Tunnel0/0/1]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/1]source 45.1.1.5
Jul 22 2023 00:36:09-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/1 has entered the UP state. 
[r5-Tunnel0/0/1]nhrp network-id 200
[r5-Tunnel0/0/1]nhrp entry multicast dynamic 
[r5-Tunnel0/0/1]nhrp entry 20.1.1.1 14.1.1.1 register 

R6:

[R6]int t 0/0/1
[R6-Tunnel0/0/1]ip address 20.1.1.3 24
[R6-Tunnel0/0/1]tunnel-protocol gre p2mp 
[R6-Tunnel0/0/1]so	
[R6-Tunnel0/0/1]source 46.1.1.6
Jul 22 2023 00:37:32-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/1 has entered the UP state. 
[R6-Tunnel0/0/1]nhrp network-id 200
[R6-Tunnel0/0/1]nhrp entry multicast dynamic 
[R6-Tunnel0/0/1]nhrp entry 20.1.1.1 14.1.1.1 r	
[R6-Tunnel0/0/1]nhrp entry 20.1.1.1 14.1.1.1 register 
[R6-Tunnel0/0/1]nhrp entry 20.1.1.2 45.1.1.5 register

分别查看路由器的NHRP注册表:

nhrp注册表正常

配置OSPF:

R1:

[r1]ospf 1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]ne	
[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]ne	
[r1-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]ne	
[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]int t 0/0/0
[r1-Tunnel0/0/0]ospf network-type broadcast

R2:

[r2]ospf 1 router-id 2.2.2.2
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r2-ospf-1]ar	
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.255.255.255
[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]int t 0/0/0
[r2-Tunnel0/0/0]ospf network-type broadcast 

R3:

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]ar	
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]ne	
[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 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]int t 0/0/0
[r3-Tunnel0/0/0]os	
[r3-Tunnel0/0/0]ospf n	
[r3-Tunnel0/0/0]ospf network-type d	
[r3-Tunnel0/0/0]ospf network-type b	
[r3-Tunnel0/0/0]ospf network-type broadcast 

R5:

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]ar	
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]int t 0/0/1
[r5-Tunnel0/0/1]ospf network-type broadcast 
[r5-Tunnel0/0/1]ospf dr-priority 0

R6:

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]ar	
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]ne	
[R6-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[R6-Tunnel0/0/1]ospf dr-priority 0

连通性测试

 

 

其实R1的OSPF路由表就可以也证明我们的配置是没错的。

 总结

OSPF在MGRE环境的配置中要注意隧道的端口类型以及路由器的条件匹配

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值