配置GRE隧道

一、拓扑图:
二、配置及说明:
 
1、配置三台路由器的IP地址。并且在R1和R3配置默认路由,确保广域网链路能够通信:
R1(config-line)#int s1/1
R1(config-if)#no sh
R1(config-if)#ip add 202.101.172.37 255.255.255.252
R1(config-if)#int lo0
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#ip add 172.16.2.1 255.255.255.0 se
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 202.101.172.38 (配置一条默认路由)
 
R3(config-line)#int s1/0
R3(config-if)#no sh
R3(config-if)#ip add 218.108.248.202 255.255.255.252
R3(config-if)#int lo0
R3(config-if)#ip add 192.168.1.1 255.255.255.0
R3(config-if)#ip add 192.168.2.1 255.255.255.0 se
R3(config-if)#exit
R3(config)#ip route 0.0.0.0 0.0.0.0 218.108.248.201
 
2、配置完之后,在R1 能够ping 通R3的WAN口:
R1(config)#do ping 218.108.248.202
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 218.108.248.202, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/27/64 ms
 
3、由于R2中没有到达私有网络的路由,在R1或R3都不能ping 通各自的回环接口IP:
R1(config)#do ping 192.168.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
U.U.U

Success rate is 0 percent (0/5)
R1(config)#
 
4、满足条件之后,下面分别在R1和R3上通过GRE隧道技术把路由打通:
R1(config)#interface tunnel 0 (启用GRE隧道)
R1(config-if)#ip add 10.1.1.1 255.255.255.0 (为隧道配置IP地址)
R1(config-if)#tunnel source serial1/1(配置隧道的本地源端口)
R1(config-if)#tunnel destination 218.108.248.202 (配置隧道的目标出口,目的IP的可达性,是通过之前配置的本地默认路由保证的)
 
R3(config)#int tunnel 0
R3(config-if)#ip add 10.1.1.2 255.255.255.0
R3(config-if)#tunnel source  218.108.248.202 (也可以指定隧道本地源IP)
R3(config-if)#tunnel destination 202.101.172.37
 
5、R3配置完之后,马上就出来提示信息:
R3(config-if)#
*Mar  1 01:06:52.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
 
6、在R1上查看一下隧道接口信息:
R1#sh interfaces tunnel0
Tunnel0 is up, line protocol is up  (状态为UP)
  Hardware is Tunnel (基于隧道的接口)
  Internet address is 10.1.1.1/24
  MTU 1514 bytes, BW 9 Kbit, DLY 500000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set (在原始的数据包上再封装了一个GRE报头)
  Keepalive not set
  Tunnel source 202.101.172.37 (Serial1/1), destination 218.108.248.202
  Tunnel protocol/transport GRE/IP (隧道协议为GRE)

    Key disabled, sequencing disabled
    Checksumming of packets disabled
  Tunnel TTL 255
  ………………
 
7、查看一下R1的路由表:
R1#sh ip route
…………
 
Gateway of last resort is 202.101.172.38 to network 0.0.0.0
 
     202.101.172.0/30 is subnetted, 1 subnets
C       202.101.172.36 is directly connected, Serial1/1
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Loopback0
C       172.16.2.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Tunnel0 (显示隧道接口为直连路由)

S*   0.0.0.0/0 [1/0] via 202.101.172.38 (之前配置的默认路由)
 
8、在R1上能够ping 通隧道地址:
R1#ping 10.1.1.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/34/68 ms
R1#
 
9、为了使R1和R3的loopback 地址能够通信,我们在R1和R3分别配置静态路由,下一跳指向隧道接口:
R1(config)#ip route 192.168.0.0 255.255.0.0 tunnel 0 (下一跳可以指定隧道接口)
 
R3(config)#ip route 172.16.0.0 255.255.0.0 10.1.1.1  (也可以指定隧道接口对端的IP)
 
 
10、在R1或R3再次ping ,检查是否能ping 通对方私有网络回环接口IP地址:
R1(config)#do ping 192.168.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 8/38/108 ms
R1(config)#do ping 192.168.2.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 8/36/84 ms
R1(config)#
 
11、当然我们还可以查看一下tunnl 0的统计数据:
R1#sh interface tunnel 0 stats
Tunnel0
          Switching path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor         30       3720         30       3720
             Route cache          0          0          0          0
                   Total         30       3720         30       3720
 
   注意:在配置隧道的时候一定要注意隧道的本地源端口和隧道的目的端口的路由可达性。
 
 
 本文转自wxs-163 51CTO博客,原文链接:http://blog.51cto.com/supercisco/293313



<think>好的,用户想知道如何在迪普防火墙上配置GRE隧道。我需要先回顾一下GRE的基本概念配置步骤,然后结合迪普防火墙的具体配置方法。首先,GRE隧道是用于在两个端点之间建立点对点的连接,可以封装多种协议的数据包。配置GRE通常需要定义Tunnel接口、指定源目的地址,以及处理路由安全策略。 接下来,我需要检查用户提供的引用内容。引用[1]提到了开启GRE报文预分片功能,以及将Tunnel口加入安全区域。引用[2]提到配置IP地址、OSPF、创建tunnel划分安全区域。引用[3]涉及IPSec主备链路的配置,可能GRE over IPSec有关。用户的问题集中在GRE隧道,所以可能不需要深入IPSec,但可能需要提到相关的高可用性配置。 接下来,我需要将这些信息整合成适合迪普防火墙的配置步骤。通常,配置GRE的步骤包括:配置接口IP、创建Tunnel接口、设置源目的地址、处理路由协议(如OSPF或静态路由)、划分安全区域,以及配置安全策略允许GRE流量。可能还需要预分片功能的开启,如引用[1]提到的。 需要注意的是,迪普防火墙可能有特定的命令行或Web界面操作方式,但用户提供的引用中没有具体命令,可能需要通用步骤。此外,安全策略是关键,要确保GRE流量(协议47)封装后的数据能被允许通过。 最后,生成相关问题时要围绕GRE配置的扩展内容,比如高可用性、MTU问题、与IPSec的结合,以及诊断命令等。</think>### 迪普防火墙GRE隧道配置方法 以下是配置GRE隧道的通用步骤(需根据迪普防火墙具体型号软件版本调整): 1. **配置基础网络环境** - 为防火墙的物理接口(如内网/外网接口)配置IP地址,例如: ``` interface GigabitEthernet1/0/1 ip address 202.100.1.1 255.255.255.0 ``` - 确保两端防火墙的物理接口可达(通过静态路由或动态路由协议如OSPF)[^2]。 2. **创建Tunnel接口** - 创建逻辑隧道接口并配置参数: ``` interface Tunnel0 # 定义隧道接口编号 tunnel-protocol gre # 指定隧道协议为GRE source 202.100.1.1 # 指定隧道源地址(物理接口IP) destination 203.100.2.1 # 指定隧道目的地址(对端物理接口IPip address 10.1.1.1 255.255.255.252 # 配置隧道接口IP(需与对端同一网) ``` - (可选)启用预分片功能:`tunnel gre smart-fragment enable`[^1] 3. **安全区域划分** - 将隧道接口加入安全区域(如DMZ或自定义区域): ``` security-zone name GRE-TUNNEL add interface Tunnel0 ``` 4. **配置安全策略** - 允许物理接口接收GRE流量(IP协议号47): ``` security-policy rule name PERMIT_GRE source-zone untrust destination-zone local service gre # 或协议号47 action permit ``` - 允许隧道接口间的通信(根据实际需求配置源/目的区域)。 5. **配置路由** - 静态路由示例:`ip route-static 192.168.2.0 255.255.255.0 Tunnel0` - 或通过OSPF发布隧道接口网[^2]。 --- ### 验证命令 ```bash display interface Tunnel0 # 查看隧道接口状态 display security-policy all # 检查策略是否生效 ping -a 10.1.1.1 10.1.1.2 # 测试隧道连通性 ``` --- ### 关键注意事项 1. **MTU问题**:GRE封装会增加报文头部长度(约24字节),需调整接口MTU或开启预分片功能[^1] 2. **高可用性**:可通过GRE over IPSec实现加密传输,或配置主备隧道(参考IPSec主备链路设计[^3]) 3. **NAT穿透**:若隧道经过NAT设备,需配置`tunnel gre key`匹配密钥
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值