GRE隧道传递数据包的过程分为3步:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
1.接收原始IP数据包当作乘客协议,原始IP数据包包头的IP地址为私有IP地址。 
2.将原始IP数据包封装进GRE协议,GRE协议称为封装协议(Encapsulation Protocol),封装的包头IP地址为虚拟直连链路两端的IP地址。
3.将整个GRE数据包当作数据,在外层封装公网IP包头,也就是隧道的起源和终点,从而路由到隧道终点。
实验配置
R1
en
conf t
line con 0
no exec-t
exit
host R1
int f0/0
no sh
ip add 192.168.1.1 255.255.255.0
end
====================R2============================
en
conf t
line con 0
no exec-t
exit
host R2
int f0/0
no sh
ip add 192.168.1.2 255.255.255.0
int f0/1
no sh
ip add 23.23.23.2 255.255.255.0
exit
ip route 0.0.0.0 0.0.0.0 23.23.23.3
interface Tunnel2
no sh
ip address 1.1.1.2 255.255.255.0
tunnel source 23.23.23.2
tunnel destination 34.34.34.4
exit
ip route 192.168.2.0 255.255.255.0 tunnel2
创建GRE隧道的路由器双方将去往对方私有网段的数据包引入GRE隧道中传输
NAT配置
access-list 100 permit ip 192.168.1.0 0.0.0.255 any
ip nat inside source list 100 interface FastEthernet0/0 overload
interface FastEthernet0/0
ip nat outside
interface FastEthernet1/0
ip nat inside
=====================Internet==========================
en
conf t
line con 0
no exec-t
exit
host Internet
int f0/0
no sh
ip add 23.23.23.3 255.255.255.0
int f0/1
no sh
ip add 34.34.34.3 255.255.255.0
======================R4================================
en
conf t
line con 0
no exec-t
exit
host R4
int f0/0
no sh
ip add 34.34.34.4 255.255.255.0
int f0/1
no sh
ip add 192.168.2.4 255.255.255.0
exit
ip route 0.0.0.0 0.0.0.0 34.34.34.3
interface Tunnel4
no sh
ip address 1.1.1.4 255.255.255.0
tunnel source 34.34.34.4
tunnel destination 23.23.23.2
exit
ip route 192.168.1.0 255.255.255.0 Tunnel4
创建GRE隧道的路由器双方将去往对方私有网段的数据包引入GRE隧道中传输
NAT配置
access-list 100 permit ip 192.168.2.0 0.0.0.255 any
ip nat inside source list 100 interface FastEthernet0/0 overload
interface FastEthernet0/0
ip nat outside
interface FastEthernet1/0
ip nat inside
=========================R5==============================
en
conf t
line con 0
no exec-t
exit
host R5
int f0/0
no sh
ip add 192.168.2.5 255.255.255.0
实验调试
查看R2当前的隧道接口状态:

R2#sh ip int tunnel 2
Tunnel2 is up, line protocol is up
  Internet address is 1.1.1.2/24
  Broadcast address is 255.255.255.255
  Address determined by setup command
  MTU is 1476 bytes
  Helper address is not set
  Directed broadcast forwarding is disabled
  Outgoing access list is not set
  Inbound  access list is not set
  Proxy ARP is enabled
  Local Proxy ARP is disabled
  Security level is default
  Split horizon is enabled
  ICMP redirects are always sent
  ICMP unreachables are always sent
  ICMP mask replies are never sent
  IP fast switching is enabled
  IP fast switching on the same interface is disabled
  IP Flow switching is disabled
  IP CEF switching is enabled
  IP CEF Feature Fast switching turbo vector
  IP multicast fast switching is enabled
  IP multicast distributed fast switching is disabled
  IP route-cache flags are Fast, CEF
  Router Discovery is disabled
  IP output packet accounting is disabled
  IP access violation accounting is disabled
  TCP/IP header compression is disabled
  RTP/IP header compression is disabled
  Policy routing is disabled
  Network address translation is disabled
  BGP Policy Mapping is disabled
  WCCP Redirect outbound is disabled
  WCCP Redirect inbound is disabled
  WCCP Redirect exclude is disabled

查看R4隧道状态

R4#sh ip int tunnel 4
Tunnel4 is up, line protocol is up
  Internet address is 1.1.1.4/24
  Broadcast address is 255.255.255.255
  Address determined by setup command
  MTU is 1476 bytes
  Helper address is not set
  Directed broadcast forwarding is disabled
  Outgoing access list is not set
  Inbound  access list is not set
  Proxy ARP is enabled
  Local Proxy ARP is disabled
  Security level is default
  Split horizon is enabled
  ICMP redirects are always sent
  ICMP unreachables are always sent
  ICMP mask replies are never sent
  IP fast switching is enabled
  IP fast switching on the same interface is disabled
  IP Flow switching is disabled
  IP CEF switching is enabled
  IP CEF Feature Fast switching turbo vector
  IP multicast fast switching is enabled
  IP multicast distributed fast switching is disabled
 --More--

测试连通性

R1#ping 192.168.2.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 172/202/220 ms

R5#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 = 132/212/368 ms

转载于:https://blog.51cto.com/loverain/814369

GRE tunnel ×××相关推荐

  1. gre tunnel源码分析之接收流程

    GRE(Generic Routing Encapsulation,通用路由封装)协议是对某些网络层协议(如IP 和IPX)的数据报文进行封装,使这些被封装的数据报文能够在另一个网络层协议(如IP)中 ...

  2. GRE tunnel源码分析之发送流程

    GRE(Generic Routing Encapsulation,通用路由封装)协议是对某些网络层协议(如IP 和IPX)的数据报文进行封装,使这些被封装的数据报文能够在另一个网络层协议(如IP)中 ...

  3. 在Ubuntu上创建并测试GRE tunnel

    使用两台Ubuntu虚拟机进行GRE tunnel测试,则两台虚拟机位于同一网段,但并不影响观察测试结果. 测试环境: 在一台PC上同时运行两个Ubuntu虚拟机: ubuntu-gnome-16.0 ...

  4. JUNOS Olive GRE Tunnel Configuration

    still same topology used as previous posts. Added GRE tunnel in the topology with two new OSPF areas ...

  5. 配置IPsec on GRE Tunnel with IOS Firewall and NAT

    配置IPsec on GRE Tunnel with IOS Firewall and NAT <?xml:namespace prefix = o ns = "urn:schemas ...

  6. OSPF——GRE Tunnel(含配置命令)详解

    目录 一.GRE 技术介绍: 二.GRE Tunnel 简介图解 三.GRE Tunnel 基本配置: (1)隧道的建立: (2)配置通关Tunnel的路由--静态路由​​ (2)配置通关Tunnel ...

  7. GRE Tunnel实现企业网中的***

    虚拟专用网(×××)被定义为通过一个公用网络(通常是因特网)建立一个临时的.安全的连接,是一条穿过混乱的公用网络的安全.稳定的隧道.虚拟专用网是对企业内部网的扩展. 虚拟专用网可以帮助远程用户.公司分 ...

  8. 【Cisco NA】单臂路由+DHCP+DHCP中继+GRE Tunnel

    ①配置单臂路由  ✔ ②在Branch上开启DHCP,同时PC1.PC2能通过DHCP获取到IP地址,并且互相能访问  ✔ ③关闭Branch上DHCP并配上DHCP中继,在server上配置DHCP ...

  9. 另类L2TP Tunnel

    说到L2TP VPN,大家肯定会想到xl2tpd和openswan的组合,这是传统L2TP VPN所需要的组件.安装配置步骤相对比较复杂.通常用作Point to Site模式,即:多个接入点(PC. ...

  10. GRE over IPSEC ×××

    由于IPSEC ×××不能支持组播和广播,因此不能运行动态路由协议,由于我们需要把一条×××链路作为一条专线使用,还必须建立GRE tunnel隧道,以支持动态路由协议. 实验拓扑: 基本配置步骤如下 ...

最新文章

  1. 汇编语言笔记14-端口
  2. Oracle - Log buffer 的相关设置
  3. [云炬创业基础笔记]成长资源培养与控制
  4. CDH6.3.2之YARN生产环境调优(yarn 生产必做优化项)
  5. asp.net webform 使用 html partial,ASP.NET Web Forms
  6. 【Tools】Ubuntu20.04安装VMware Tools详解
  7. linux查文件的前几行,Linux--查询文件的第几行到第几行命令
  8. P2802 回家(dfs+三维数组标记+剪枝)
  9. 导师推荐 | 第 4 期临床基因组家系分析,同时解决科研和临床问题
  10. PyTorch 1.0 中文文档:torch.hub
  11. HDFS数据平衡:节点间平衡与节点内平衡
  12. 强者不能恒强,偏向虎山行
  13. 无线视频服务器家里好用吗,短视频APP为什么选择国内大带宽服务器?国内服务器有什么优势...
  14. bzoj 3671 贪心
  15. Foobar2000之处理无损音乐格式
  16. ios 隐藏app的插件_iPhone如何隐藏App图标?iOS9不越狱隐藏App小技巧
  17. CSP-M2 B - HRZ 学英语
  18. ios开发---URL Schemes 使用详解-app协议
  19. python进制转换函数
  20. 非线性方程组求解方法,神经网络的非线性函数

热门文章

  1. socketserver 模块的构成
  2. #219. 【NOI2016】优秀的拆分
  3. android禁止锁屏保持常亮
  4. 使用mvc2里面的area让网站更有条理
  5. 人与自然灵长类动物-湿地猎手(上)
  6. MySQL数据表查询操作
  7. 12-13 库存信息管理系统
  8. Sqlserver2014 迁移数据库
  9. Codeforces Round #426 (Div. 2) C. The Meaningless Game
  10. MapReduce原理转