• MGRE结合OSPF(超详解)


    目录

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

    1.首先给各个设备分配IP并设置缺省使全网可达

     2.配置完成后ping一下其他路由器发现都通

     二,R1/2/3为星型的拓扑结构(MGRE),R1为中心站点

     R1配置

    R2配置

    R3配置

     在R1中心站点上查询到R2,R3上交的表

     三,R1/4/5为全连的MGRE结构

    R1为中心

    R4为中心

    R5为中心

    四,所有私有网段可以互相通讯,使用OSPF完成

    由于MGRE环境不支持组播,所以需要开启伪广播

    在R1-5上开启OSPF

    最后查路由表可以看到都在 

     所有私有网段互相通信


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

    1.首先给各个设备分配IP并设置缺省使全网可达

     2.配置完成后ping一下其他路由器发现都通

     

     二,R1/2/3为星型的拓扑结构(MGRE),R1为中心站点

     R1配置

    1. [r1]int Tunnel 0/0/0
    2. [r1-Tunnel0/0/0]ip add 192.168.7.1 24
    3. [r1-Tunnel0/0/0]tunnel-protocol gre p2mp
    4. [r1-Tunnel0/0/0]source 16.0.0.1
    5. Sep 18 2022 18:43:45-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    6. on the interface Tunnel0/0/0 has entered the UP state.
    7. [r1-Tunnel0/0/0]nhrp network-id 100

    R2配置

    1. [r2]int t0/0/0
    2. [r2-Tunnel0/0/0]ip add 192.168.7.2 24
    3. [r2-Tunnel0/0/0]tunnel-protocol gre p2mp
    4. [r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
    5. Sep 18 2022 18:44:47-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    6. on the interface Tunnel0/0/0 has entered the UP state.
    7. [r2-Tunnel0/0/0]nhrp network-id 100
    8. [r2-Tunnel0/0/0]nhrp entry 192.168.7.1 16.0.0.1 register

    R3配置

    1. [r3]int t0/0/0
    2. [r3-Tunnel0/0/0]ip add 192.168.7.3 24
    3. [r3-Tunnel0/0/0]tunnel-protocol gre p2mp
    4. [r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
    5. Sep 18 2022 18:46:16-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    6. on the interface Tunnel0/0/0 has entered the UP state.
    7. [r3-Tunnel0/0/0]nhrp network-id 100
    8. [r3-Tunnel0/0/0]nhrp entry 192.168.7.1 16.0.0.1 register

     在R1中心站点上查询到R2,R3上交的表

     三,R1/4/5为全连的MGRE结构

    R1为中心

    R1配置

    1. [r1]int t0/0/1
    2. [r1-Tunnel0/0/1]ip add 192.168.8.1 24
    3. [r1-Tunnel0/0/1]tunnel-protocol gre p2mp
    4. [r1-Tunnel0/0/1]source 61.0.0.1
    5. Sep 18 2022 19:00:23-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    6. on the interface Tunnel0/0/1 has entered the UP state.
    7. [r1-Tunnel0/0/1]nhrp network-id 200

    R4配置

    1. [r4]int t0/0/1
    2. [r4-Tunnel0/0/1]ip add 192.168.8.2 24
    3. [r4-Tunnel0/0/1]tunnel-protocol gre p2mp
    4. [r4-Tunnel0/0/1]source g0/0/0
    5. Sep 18 2022 19:02:34-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    6. on the interface Tunnel0/0/1 has entered the UP state.
    7. [r4-Tunnel0/0/1]nhrp network-id 200
    8. [r4-Tunnel0/0/1]nhrp entry 192.168.8.1 61.0.0.1 register

    R5配置

    1. [r5]int t0/0/1
    2. [r5-Tunnel0/0/1]ip add 192.168.8.3 24
    3. [r5-Tunnel0/0/1]tunnel-protocol gre p2mp
    4. [r5-Tunnel0/0/1]source g0/0/0
    5. Sep 18 2022 19:03:48-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    6. on the interface Tunnel0/0/1 has entered the UP state.
    7. [r5-Tunnel0/0/1]nhrp network-id 200
    8. [r5-Tunnel0/0/1]nhrp entry 192.168.8.1 61.0.0.1 register

    R4为中心

     R4配置

    1. [r4-Tunnel0/0/1]source 46.0.0.1
    2. [r4-Tunnel0/0/1]nhrp network-id 400

    R1配置

    1. [r1-Tunnel0/0/1]source g0/0/0
    2. [r1-Tunnel0/0/1]nhrp network-id 400
    3. [r1-Tunnel0/0/1]nhrp entry 192.168.8.2 46.0.0.1 register

    R5配置

    1. [r5-Tunnel0/0/1]source g0/0/0
    2. [r5-Tunnel0/0/1]nhrp network-id 400
    3. [r5-Tunnel0/0/1]nhrp entry 192.168.8.2 46.0.0.1 register

    R5为中心

     R5配置

    1. [r5-Tunnel0/0/1]source 56.0.0.1
    2. [r5-Tunnel0/0/1]nhrp network-id 500

    R1配置

    1. [r1-Tunnel0/0/1]nhrp network-id 500
    2. [r1-Tunnel0/0/1]nhrp entry 192.168.8.3 56.0.0.1 register

    R4配置

    1. [r4-Tunnel0/0/1]nhrp network-id 500
    2. [r4-Tunnel0/0/1]nhrp entry 192.168.8.3 56.0.0.1 register

    四,所有私有网段可以互相通讯,使用OSPF完成

    由于MGRE环境不支持组播,所以需要开启伪广播

    [r1-Tunnel0/0/0]nhrp entry multicast dynamic

    在R1-5上开启OSPF

    由于通道p2p为点到点所以改为 broadcast

    1. ospf network-type broadcast
    2. #需进入每个接口修改

    最后查路由表可以看到都在 

    1. [r1]display ip routing-table
    2. Route Flags: R - relay, D - download to fib
    3. ------------------------------------------------------------------------------
    4. Routing Tables: Public
    5. Destinations : 27 Routes : 28
    6. Destination/Mask Proto Pre Cost Flags NextHop Interface
    7. 0.0.0.0/0 Static 60 0 RD 61.0.0.2 GigabitEthernet
    8. 0/0/0
    9. Static 60 0 RD 16.0.0.2 GigabitEthernet
    10. 0/0/1
    11. 16.0.0.0/24 Direct 0 0 D 16.0.0.1 GigabitEthernet
    12. 0/0/1
    13. 16.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    14. 0/0/1
    15. 16.0.0.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    16. 0/0/1
    17. 61.0.0.0/24 Direct 0 0 D 61.0.0.1 GigabitEthernet
    18. 0/0/0
    19. 61.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    20. 0/0/0
    21. 61.0.0.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    22. 0/0/0
    23. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    24. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    25. 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    26. 192.168.1.0/24 Direct 0 0 D 192.168.1.1 LoopBack0
    27. 192.168.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
    28. 192.168.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
    29. 192.168.2.1/32 OSPF 10 1562 D 192.168.7.2 Tunnel0/0/0
    30. 192.168.3.1/32 OSPF 10 1562 D 192.168.7.3 Tunnel0/0/0
    31. 192.168.4.1/32 OSPF 10 1562 D 192.168.8.2 Tunnel0/0/1
    32. 192.168.5.1/32 OSPF 10 1562 D 192.168.8.3 Tunnel0/0/1
    33. 192.168.6.0/24 Direct 0 0 D 192.168.6.1 LoopBack1
    34. 192.168.6.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
    35. 192.168.6.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
    36. 192.168.7.0/24 Direct 0 0 D 192.168.7.1 Tunnel0/0/0
    37. 192.168.7.1/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
    38. 192.168.7.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/0
    39. 192.168.8.0/24 Direct 0 0 D 192.168.8.1 Tunnel0/0/1
    40. 192.168.8.1/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/1
    41. 192.168.8.255/32 Direct 0 0 D 127.0.0.1 Tunnel0/0/1
    42. 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

     所有私有网段互相通信

     

  • 相关阅读:
    C++初阶(三)
    apple pencil性价比高吗?高性价比的ipad手写笔推荐
    小菜鸟河北联通上岗培训随笔二
    LeetCode刷题(python版)——Topic81. 搜索旋转排序数组 II
    【云原生之Docker实战】使用Docker部署speedtest测速平台
    反转链表,剑指offer,力扣
    给nginx部署https及自签名ssl证书
    解决交叉编译的依赖问题
    无涯教程-JavaScript - ISREF函数
    自己的类支持基于范围的for循环 (深入探索)
  • 原文地址:https://blog.csdn.net/weixin_64051859/article/details/126920915