26
2019
03
11:17:02

openwrt下的GRE环境验证



推荐点击下面图片,通过本站淘宝优惠价购买:

image.png

搭配环境:


目的: 使得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://hqyman.cn/post/432.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:





休息一下,本站随机推荐观看栏目:


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: