技术头条 - 一个快速在微博传播文章的方式     搜索本站
您现在的位置首页 --> 系统运维 --> OpenVPN 客户端在 Windows 里的配置

OpenVPN 客户端在 Windows 里的配置

浏览:1945次  出处信息

    自己搭了一个 OpenVPN Server,以前一直是在 Mac 里使用客户端,加上 chnroutes,用得很舒服。最近想在 Windows 里用一下,结果显示能连上,但是流量就是不从 VPN 走,很郁闷。

    试了一下,连服务器 IP 10.0.0.1 都 ping 不通。运行 ipconfig 显示 OpenVPN 创建的 interface 信息为:

    Connection-specific DNS Suffix  . :
    IP Address. . . . . . . . . . . . : 10.0.0.6
    Subnet Mask . . . . . . . . . . . : 10.0.0.5
    Default Gateway . . . . . . . . . :

    显然错得很厉害。看客户端日志,看服务器日志,都没找出什么原因来。最终发现是客户端配置文件里有个:

dev tap

    好像网上很多教程都说 Windows 平台就用 tap,其它平台用 tun (或者是我的误解吧)。看 openvpn 官方的 manual:

    TUN/TAP virtual network device ( X can be omitted for a dynamic device.)

    See examples section below for an example on setting up a TUN device.

    You must use either tun devices on both ends of the connection or tap devices on both ends. You cannot mix them, as they represent different underlying protocols.

    tun devices encapsulate IPv4 while tap devices encapsulate ethernet 802.3.

    所以这个配置必须与 Server 的配置保持一致。果然,改成 tun 以后一切正常了。

建议继续学习:

  1. 使用 OpenVPN Access Server 轻松搭建 VPN 服务器    (阅读:4109)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
© 2009 - 2024 by blogread.cn 微博:@IT技术博客大学习

京ICP备15002552号-1