/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 -nlinux
删除spa
/sbin/iptunnel del tun0blog
要在Linux上建立GRE隧道,须要ip_gre内核模块,它是GRE经过IPv4隧道的驱动程序。seo
2. 查看是否有加载ip_gre模块ip
3. 建立步骤rem
环境以下:get
host A : 121.207.22.123it
host B: 111.2.33.28class
在host A上面:tls
建立一个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隧道
在任一一端操做下面命令