×

openwrt下的GRE环境验证

hqy hqy 发表于2019-03-26 11:17:02 浏览483788 评论0

抢沙发发表评论

搭配环境:


目的: 使得PC1和PC2之间可ping通相互访问。


配置过程:

配置gre隧道前提条件: 1.路由器A(192.168.6.33)和路由器B(192.168.6.18)之间可以ping 通(注意:A,B路由器不一定要在同一网段上,一般使用场景是A ,B都是两个公网IP,本实验室只是在局域网下面的模拟)

2.内核支持gre功能,安装gre相关驱动 可通过 lsmod 指令查看

root@AA:/# lsmod|grep gre

gre 3387 1 ip_gre

ip_gre 6720 0

ip_tunnel 10563 1 ip_gre


在路由A上设置命令:

ip tunnel add tun1 mode gre remote 192.168.6.33 local 192.168.6.18

//设置隧道tun1的地址

ip addr add 172.16.33.2 dev tun1 peer 172.16.33.1/24

//启用隧道

ip link set tun1 up

//设置隧道的MTU

ip link set tun1 up mtu 1500

//设置访问192.168.1.X 段的IP都经过 隧道tun1

ip route add 192.168.1.0/24 dev tun1


在路由B上设置命令:

ip tunnel add tun1 mode gre remote 192.168.6.18 local 192.168.6.33

//设置隧道tun1的地址

ip addr add 172.16.33.1 dev tun1 peer 172.16.33.2/24

//启用隧道

ip link set tun1 up

//设置隧道的MTU

ip link set tun1 up mtu 1500

//设置访问192.168.11.X 段的IP都经过 隧道tun1

ip route add 192.168.11.0/24 dev tun1


测试检验:


PC1(192.168.11.63)可以和 PC2(192.168.1.38)之间互相ping 通。


注意:如果测试依然ping 不通或丢包率明显,建议关闭PC的防火墙进行测试。


参考资料:

http://blog.51cto.com/xukaicapcom/1011067

https://blog.csdn.net/sinat_32033507/article/details/52688006

http://h-wrt.com/en/mini-how-to/gretun

https://blog.csdn.net/chuanzhilong/article/details/53635246

--------------------- 

作者:夜晚有3年 

来源:CSDN 

原文:https://blog.csdn.net/ygl931/article/details/83095639 

版权声明:本文为博主原创文章,转载请附上博文链接!


 您阅读本篇文章共花了: 

打赏

本文链接:https://kinber.cn/post/432.html 转载需授权!

分享到:


推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

群贤毕至

访客