H3C GRE VPN基本配置实验

H3C GRE VPN基本配置实验

实验拓扑

实验需求

  1. 按照图示配置 IP 地址
  2. 在 R1 和 R3 上配置默认路由使公网区域互通
  3. 在 R1 和 R3 上配置 GRE VPN,使两端私网能够互相访问,Tunnel 口 IP 地址如图
  4. 在 R1 和 R3 上配置动态路由协议来传递两端私网路由

实验步骤

按照图示配置 IP 地址

shelll 复制代码
[R1]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.1.1.1/24       --           --
GE0/1               up       up       192.168.1.254/24   --           --

[R2]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.1.1.2/24       --           --
GE0/1               up       up       100.2.2.2/24       --           --

[R3]display ip interface brief 
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.2.2.3/24       --           --
GE0/1               up       up       192.168.2.254/24   --           --

在 R1 和 R3 上配置默认路由使公网区域互通

shelll 复制代码
[R1]ip route-static 0.0.0.0 0 100.1.1.2

[R3]ip route-static 0.0.0.0 0 100.2.2.2

在 R1 和 R3 上配置 GRE VPN,使两端私网能够互相访问

在R1上创建Tunnel口,模式为GRE,源地址和目的地址为本端公网地址和对端公网地址
shelll 复制代码
[R1]interface Tunnel 0 mode gre 	//创建Tunnel口,模式为GRE
[R1-Tunnel0]ip address 192.168.3.1 255.255.255.0	//配置Tunnel0口IP地址
[R1-Tunnel0]source 100.1.1.1	//源地址为本端公网地址
[R1-Tunnel0]destination 100.2.2.3	//目的地址为对端公网地址

%Aug  1 09:46:31:195 2024 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface Tunnel0 changed to up.
%Aug  1 09:46:31:195 2024 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface Tunnel0 changed to up.
在R3上创建Tunnel口,模式为GRE,源地址和目的地址为本端公网地址和对端公网地址
shelll 复制代码
[R3]interface Tunnel 0 mode gre 	//创建Tunnel口,模式为GRE
[R3-Tunnel0]ip address 192.168.3.3 255.255.255.0	//配置Tunnel0口IP地址
[R3-Tunnel0]source 100.2.2.3	//源地址为本端公网地址
[R3-Tunnel0]destination 100.1.1.1	//目的地址为对端公网地址

%Aug  1 09:54:11:176 2024 R3 IFNET/3/PHY_UPDOWN: Physical state on the interface Tunnel0 changed to up.
%Aug  1 09:54:11:176 2024 R3 IFNET/5/LINK_UPDOWN: Line protocol state on the interface Tunnel0 changed to up.
在 R1 和 R3 上配置OSPF协议来传递两端私网路由

R1 和 R3 通过 RIP 来传递私网路路由,由于私网报文要通过 VPN 隧道口传输,所以需要把 Tunnel 口宣告进 RIP,使 R1 和 R3 通过 Tunnel 口传递路由

在 R1 上配置OSPF,宣告业务网段和 Tunnel 口网段
复制代码
[R1]ospf 1
[R1-ospf-1]area 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
在 R3 上配置OSPF,宣告业务网段和 Tunnel 口网段
复制代码
[R3]ospf 1
[R3-ospf-1]area 0.0.0.0
[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]network 192.168.2.0 0.0.0.255

实验验证

查看R1和R3的OSPF邻居建立情况,R1和R3的OSPF邻居状态为FULL,并使用Tunnel0接口建立

shelll 复制代码
[R1]display ospf peer 

	 OSPF Process 1 with Router ID 192.168.3.1
               Neighbor Brief Information

 Area: 0.0.0.0    
 Router ID       Address         Pri Dead-Time  State             Interface
 192.168.3.3     192.168.3.3     1   38         Full/ -           Tun0

[R3]display ospf peer 

	 OSPF Process 1 with Router ID 192.168.3.3
               Neighbor Brief Information

 Area: 0.0.0.0    
 Router ID       Address         Pri Dead-Time  State             Interface
 192.168.3.1     192.168.3.1     1   39         Full/ -           Tun0

查看R1和R3的IP路由表,双方的私网网段路由下一跳皆为Tunnel0接口

shelll 复制代码
[R1]display ip routing-table
Destinations : 18	Routes : 18
Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/0          Static  60  0           100.1.1.2       GE0/0
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
100.1.1.0/24       Direct  0   0           100.1.1.1       GE0/0
100.1.1.1/32       Direct  0   0           127.0.0.1       InLoop0
100.1.1.255/32     Direct  0   0           100.1.1.1       GE0/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     Direct  0   0           192.168.1.254   GE0/1
192.168.1.254/32   Direct  0   0           127.0.0.1       InLoop0
192.168.1.255/32   Direct  0   0           192.168.1.254   GE0/1
192.168.2.0/24     O\_INTRA 10  1563        192.168.3.3     Tun0
192.168.3.0/24     Direct  0   0           192.168.3.1     Tun0
192.168.3.1/32     Direct  0   0           127.0.0.1       InLoop0
192.168.3.255/32   Direct  0   0           192.168.3.1     Tun0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0


[R3]display ip routing-table 

Destinations : 18	Routes : 18

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/0          Static  60  0           100.2.2.2       GE0/0
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
100.2.2.0/24       Direct  0   0           100.2.2.3       GE0/0
100.2.2.3/32       Direct  0   0           127.0.0.1       InLoop0
100.2.2.255/32     Direct  0   0           100.2.2.3       GE0/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
192.168.1.0/24     O_INTRA 10  1563        192.168.3.1     Tun0
192.168.2.0/24     Direct  0   0           192.168.2.254   GE0/1
192.168.2.254/32   Direct  0   0           127.0.0.1       InLoop0
192.168.2.255/32   Direct  0   0           192.168.2.254   GE0/1
192.168.3.0/24     Direct  0   0           192.168.3.3     Tun0
192.168.3.3/32     Direct  0   0           127.0.0.1       InLoop0
192.168.3.255/32   Direct  0   0           192.168.3.3     Tun0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

效果测试:在 PC1 上 Ping PC2,可以 Ping 通

复制代码
<H3C>ping 192.168.2.1
Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.2.1: icmp_seq=0 ttl=253 time=2.303 ms
56 bytes from 192.168.2.1: icmp_seq=1 ttl=253 time=2.750 ms
56 bytes from 192.168.2.1: icmp_seq=2 ttl=253 time=2.742 ms
56 bytes from 192.168.2.1: icmp_seq=3 ttl=253 time=1.045 ms
56 bytes from 192.168.2.1: icmp_seq=4 ttl=253 time=1.954 ms

--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.045/2.159/2.750/0.631 ms
<H3C>%Aug  1 10:24:14:215 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.045/2.159/2.750/0.631 ms.

实验附件

通过百度网盘分享的文件:H3C GRE VPN基本配置实验.zip

链接:https://pan.baidu.com/s/1ro9FRmPqMO3_XfnlWOhvSg?pwd=8ee7

相关推荐
Chicheng_MA3 天前
IPQ5322 Wi-Fi 7 SoC 路由器方案介绍
网络·路由器·ipq
你疯了抱抱我9 天前
【H3C NX30Pro】光猫桥接并使用OpenWRT配置NAS端口映射;配置IPv6、IPv4公网直连内网服务器;
运维·服务器·网络·智能路由器·路由器
失散1312 天前
分布式专题——33 一台新机器进行Web页面请求的历程
分布式·tcp/ip·http·路由器·交换机
JZZC223 天前
11.路由器的接口及其相关知识(2025年9月25日)
计算机网络·接口·路由器·ensp·物理层
凡间客2 个月前
三层交换机
服务器·路由器·交换机
zzc9212 个月前
Wireshark获取数据传输的码元速率
网络·测试工具·wifi·wireshark·路由器·802.11n·物理层参数
棕生3 个月前
架构师面试(三十九):微服务重构单体应用
路由器·单体应用·系统重构·架构师面试·微服务系统
zzc9213 个月前
USRP捕获手机/路由器数据传输信号波形(中)
网络·5g·wifi·路由器·双工通信·手机信号
zzc9213 个月前
USRP捕获手机/路由器数据传输信号波形(下)
网络·5g·路由器·ofdm·mimo·tenda·双工
卸载引擎3 个月前
【计算机网络】计算机网络中光猫、交换机、路由器、网关、MAC地址是什么?两台电脑是如何联通的?
网关·计算机网络·电脑·路由器·光猫·交换机·mac地址