配置GRE隧道使用静态路由

 

以典型组网为背景,介绍如何配置GRE使用静态路由,使得用户端之间的流量通过GRE隧道传输。设备到与其相连的客户端之间需要配置静态路由。

组网需求

如图所示

  • R1、R2、R3实现公网互通,本示例使用静态路由
  • 在PC1和PC2上运行IPv4私网协议,现需要PC1和PC2通过公网实现IPv4私网互通。

实验步骤

一. 配置个人计算机1和2的IP地址、子网掩码和网关。

2.配置路由器IP

设备名称 接口 IP地址
R1 GE0/0/0 192.168.1.254/24
GE0/0/1 200.1.22.1/24
R2 GE0/0/0 200.1.23.1/24
GE0/0/1 182.168.1.254/24
R3 GE0/0/0 200.1.22.2/24
GE0/0/1 200.1.23.2/24

3、配置GRE隧道

R1上

#
interface Tunnel0/0/1
 ip address 1.1.1.1 255.255.255.0
 tunnel-protocol gre
 source 200.1.22.1
 destination 200.1.23.1
#

  R2上

#
interface Tunnel0/0/0
 ip address 2.2.2.2 255.255.255.0
 tunnel-protocol gre
 source 200.1.23.1
 destination 200.1.22.1
#

4、配置默认路由

R1上

[R1]ip route-static 0.0.0.0 0 200.1.22.2
[R1]ip route-static 182.168.1.0 24 Tunnel 0/0/1

R2上

[R2]ip route-static 0.0.0.0 0 200.1.23.2
[R2]ip route-static 192.168.1.0 24 Tunnel 0/0/0

5、确认是否连接到PC1和Ping PC2

 

posted @ 2022-11-16 16:05  leagueandlegends  阅读(656)  评论(0)    收藏  举报