Linux GRE Tunnel

/sbin/modprobe ip_gre
/sbin/iptunnel add tun0 mode gre remote 114.141.167.167 local 114.55.73.157
/sbin/ifconfig tun0 122.115.74.170
/sbin/route add 202.177.205.249/32 tun0
/sbin/route add 72.46.244.231/32 tun0
route -n

删除

/sbin/iptunnel del tun0

 

要在Linux上创建GRE隧道,需要ip_gre内核模块,它是GRE通过IPv4隧道的驱动程序。

2. 查看是否有加载ip_gre模块

3. 创建步骤

环境如下:

host A :  121.207.22.123

host B: 111.2.33.28

在host A上面:

创建一个GRE类型隧道设备gre0, 并设置对端IP为111.2.33.28。隧道数据包将被从121.207.22.123也就是本地IP地址发起,其TTL字段被设置为255。隧道设备分配的IP地址为10.10.10.1,掩码为255.255.255.0。

在host B上面:

此时,host A 和 host B 建立起GRE隧道了。

4. 检测连通性

5. 撤销GRE隧道

在任一一端操作下面命令

原文地址:https://www.cnblogs.com/syother/p/7149066.html