实验二、配置GRE VPN 联系客服

发布时间 : 星期四 文章实验二、配置GRE VPN更新完毕开始阅读a002c3edf8c75fbfc77db227

实验二、配置GRE VPN

2.1实验目的

1.掌握GRE VPN的基本原理; 2.掌握GRE VPN的配置方法;

2.2 设备需求

(1) 2台H3C MSR30-40路由器,1台H3C S3610三层交换机; (2) 2台PC机;

2.3 实验环境

图1-1 GRE VPN实验环境图

2.4 实验任务

在路由器RTA和RTB之间的公网设备SWA(三层交换机)上没有私网路由,要求建立RTA与RTB之间的GRE VPN隧道,使PCA和PCB所在两个分离的私网网段互通。

分别用静态路由和动态路由协议来完成任务。 2.5 实验步骤

(1) 搭建实验环境

- 1 -

按图1-1连接设备。各设备接口的地址如表1所示。

表1各设备接口的地址

设备 路由器RTA 接口 G0/0 G0/1 Tunnel0 G0/0 路由器RTB G0/1 Tunnel0 交换机SWA PCA PCB (2) 配置各设备的地址 配置路由器RTA: [RTA] int g0/0

[RTA-GigabitEthernet0/0] ip add 192.168.1.1 24 [RTA-GigabitEthernet0/0] int g0/1 [RTA-GigabitEthernet0/1] ip add 1.1.1.1 24 [RTA-GigabitEthernet0/1] quit 配置路由器RTB: [RTB]interface g0/0

[RTB-GigabitEthernet0/0]ip add 192.168.2.1 24 [RTB-GigabitEthernet0/0]int g0/1 [RTB-GigabitEthernet0/1]ip add 2.2.2.1 24 [RTB-GigabitEthernet0/1]quit 配置交换机SWA: sys

[H3C] sysname SWA [SWA] vlan 2

[SWA-vlan2] port e1/0/2 [SWA-vlan2] int vlan 2

[SWA-Vlan-interface2] ip address 2.2.2.2 24 // 配置VLAN 2的接口地址 [SWA] int vlan 1

- 2 -

地址 192.168.1.1/24 1.1.1.1/24 192.168.3.1/30 192.168.2.1/24 2.2.2.1/24 192.168.3.2/24 1.1.1.2/24 2.2.2.2/24 192.168.1.2/24 192.168.2.2/24

备注 私网 公网 私网 私网 公网 私网 公网 公网 私网 私网 VLAN 1 VLAN 2 以太口 以太口 [SWA-Vlan-interface1] ip address 1.1.1.2 24 [SWA-Vlan-interface1]quit

[SWA] display current-configuration // 显示交换机当前配置 (3) 配置GRE隧道接口 配置路由器RTA: [RTA] int tunnel 0

[RTA-Tunnel0] ip add 192.168.3.1 30 // 配置隧道tunnel0的IP地址 [RTA-Tunnel0] source 1.1.1.1 // 配置隧道tunnel0源端IP地址 [RTA-Tunnel0] destination 2.2.2.1 // 配置隧道tunnel0目的端IP地址 [RTA-Tunnel0] keepalive // 允许路由器探测隧道的实际状态 [RTA-Tunnel0] quit 配置路由器RTB: [RTB] interface tunnel0

[RTB-Tunnel0] ip address 192.168.3.2 30 [RTB-Tunnel0] source 2.2.2.1 [RTB-Tunnel0] destination 1.1.1.1 [RTB-Tunnel0] keepalive [RTB-Tunnel0] quit

(4) 为私网和公网配置静态路由 配置路由器RTA:

[RTA] ip route-static 192.168.2.0 24 tunnel0

[RTA] display ip routing-table // 查看路由表 [RTA] ip route-static 2.2.2.0 24 1.1.1.2

[RTA] display ip routing-table // 查看路由表 配置路由器RTB:

[RTB] ip route-static 192.168.1.0 24 tunnel0 [RTB] ip route-static 1.1.1.0 24 2.2.2.2 [RTB] display ip routing-table (5) 检查隧道的工作状态 [RTA] display interface tunnel 0 [RTA] ping 192.168.2.2

- 3 -

(6) 为私网配置RIP动态路由 配置路由器RTA:

[RTA] undo ip route-static 192.168.2.0 255.255.255.0 tunnel0 // 清除静态路由 [RTA] rip

[RTA-rip-1] network 192.168.1.0 [RTA-rip-1] network 192.168.3.0 [RTA] display ip routing-table 配置路由器RTB:

[RTB] undo ip route-static 192.168.1.0 255.255.255.0 tunnel0 [RTB] rip

[RTB-rip-1] network 192.168.2.0 [RTB-rip-1] network 192.168.3.0 [RTB] display ip routing-table (7) 检查隧道的连通性 [RTA] ping 192.168.2.2

(8) 为私网配置OSPF动态路由 配置路由器RTA: [RTA] undo rip

Warning : Undo RIP process? [Y/N]: y [RTA] ospf [RTA-ospf-1]area 0

[RTA-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.255.255 [RTA-ospf-1-area-0.0.0.0]quit [RTA-ospf-1] quit

[RTA] display ip routing-table 配置路由器RTB: [RTB] undo rip

Warning : Undo RIP process? [Y/N]: y [RTB] ospf [RTB-ospf-1] area 0

[RTB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.255.255 [RTB-ospf-1-area-0.0.0.0] quit

- 4 -

// 清除静态路由 [RTB-ospf-1] quit

[RTB] display ip routing-table (9) 检查隧道的连通性 [RTA] ping 192.168.2.2 (10) 配置隧道验证 配置路由器RTA: [RTA] interface tunnel0 [RTA-Tunnel0] gre key 1234 [RTA-Tunnel0] quit [RTA]

配置路由器RTB: [RTB] interface tunnel0 [RTB-Tunnel0] gre key 1234 [RTB-Tunnel0] quit [RTB]

(11) 检查隧道的连通性 [RTA] ping 192.168.2.2

2.6 实验体会

- 5 -