H3C GRE ××× 案例

发布时间:2019-08-23 07:59:17编辑:auto阅读(1385)

    转自http://www.safexjt.com/bbs/thread-72-1-1.html

    一。案例拓扑

     

    一.案例要求:R1safexjt公司的边缘路由器,R2是该公司的异地分公司,为了方便两个工作场所资源共享,公司决定让网络管理员架设×××,网管小郭决定使用GRE ×××。在此详细说明一下,R1R2都是H3C的路由设备,我们用lookback口模拟内网接口,ISP路由器上只有直连的两条路由,没有其他路由,我们用它模拟公网路由器。

    三.列表说明

    .列表说明

     

    接口地址

    路边表

    R1

    S0/2/0 200.1.1.1/30

    Tunne 10.1.1.1/30

    Lo0 192.168.1.1/32

    Direct 192.168.1.0/24

    Direct 10.1.1.0/30

    Direct 200.1.1.0/30

    Static 192.168.2. 0/24 tunnel0

    Static 0.0.0.0 0.0.0.0 200.1.1.2

    R2

    S0/2/0 200.1.1.2/30

    S0/2/2 200.1.2.1/30

    Direct 200.1.1.0/30

    Direct 200.1.2.0/30

    R3

    S0/2/0 200.1.2.2/30

    Tunnel 10.1.1.2/30

    Lo0 192.168.1.1/32

    Direct 192.168.2.0/24

    Direct 10.1.1.0/30

    Direct 200.1.2.0/30

    Static 192.168.1. 0/24 tunnel0

    0.0.0.0 0.0.0.0 200.1.2.1

     

     

    一.实验步骤:

    1.       R1的配置

    sysname R1

    [R1]int s0/2/0

    [R1-Serial0/2/0]ip add 200.1.1.1 255.255.255.252

    [R1-Serial0/2/0]undo shut

     [R1-Serial0/2/0]int lo0

    [R1-LoopBack0]ip add 192.168.1.1 255.255.255.255

    [R1-LoopBack0]int tu

    [R1-LoopBack0]int tunnel 0   ;进入tunnel(隧道口)

    [R1-Tunnel0]ip add 10.1.1.1 255.255.255.252

    [R1-Tunnel0]tunnel-protocol gre   ;隧道封装协议为GRE

    [R1-Tunnel0]source  200.1.1.1    ;封装后的包源地址为200.1.1.1

    [R1-Tunnel0]destination 200.1.2.2  ;封装后的目的地址为200.1.2.2R2的外网地址)

    [R1]ip route-static 0.0.0.0 0.0.0.0 200.1.1.2  ;设置静态默认路由,指向ISP

    [R1]ip route-static 192.168.2.0 255.255.255.0 Tunnel 0  ;所有到192.168.2.0的包从tunnel

     

    小结:R1的配置到此完成,R2上没有192.168.1.0192.168.2.0的路由,所有192.168.1.0192.168.2.0的通讯不能直接通过路由。于是我们使用公网IP对这个私网的包进行封装。

    ip route-static 192.168.2.0 255.255.255.0 Tunnel 0 这条路由的作用就是对到192.168.2.0的包进行封装,封装后的源地址为200.1.1.1,目标地址为200.1.2.2,可以在公网上发送。

     

    2.       ISP的配置

    [H3C]sysname ISP

    [ISP-Serial0/2/0]ip add 200.1.1.2 255.255.255.252

    [ISP-Serial0/2/0] ]undo shut

    [ISP-Serial0/2/0]int s0/2/1

    [ISP-Serial0/2/1]ip add 200.1.2.1 255.255.255.252

    [ISP-Serial0/2/1]undo shut

     

    3.       R2的配置

    <H3C>system

    [R3]sysname R2   ;重命路由器为R2

    [R2]int s0/2/0

    [R2-Serial0/2/0]ip add 200.1.2.2 255.255.255.252

    [R2-Serial0/2/0]undo shut

    [R2-Serial0/2/0]int lo0

    [R2-LoopBack0]ip add 192.168.2.1 255.255.255.255

    [R2-LoopBack0]int tunnel 0

    [R2-Tunnel0]ip add 10.1.1.2 255.255.255.252

    [R2-Tunnel0]tunnel-protocol gre           ;从此口出去的包进行GRE封装

    [R2-Tunnel0]source 200.1.2.2

    [R2-Tunnel0]destination 200.1.1.1

    [R2-Tunnel0]quit

    [R2]ip route-static 0.0.0.0 0.0.0.0 200.1.2.1   ;添加一个默认路由,指向ISP

    [R2]ip route 192.168.1.0 255.255.255.0 tunnel 0  ;所有目标地址为192.168.1.0的包从tunnel转发到tunnel

     

    4.       查看R1的路由表

     

     

     

    1.       R1ping 192.168.2.1

     

     

     

    实验到此完成,图画得不好,就将就着看吧

     

关键字