OpenVPN win10客户端连接几个警告信息解决
· 技术积累 · VPN openvpn

win10客户端使用openvpn软件连接过程中可能会遇到几个红色 警告或错误信息,我也是在使用中有遇到这些问题,网上搜索的方法可以解决掉遇到的问题(不保证所有遇到此问题的都可以通过下面方法解决),特此搜集记录下来

在连接vpn有问题情况下,确认服务和端口是否正常和允许连接,多观察 服务端日志客户端日志 的异常输出信息,大概率是客户端参数问题或者配置不正确,或者是网络方面的问题

1 客户端版本也会造成一些警告提示,因为会有些参数在某个版本中不支持了
2 遇到多百度谷歌搜索相关信息,多动手改调整配置参数
3 确保配置文件的参数名正确,文件路径或格式正确
4 有时候或许是网络问题导致连不上,可以换换其他网络试试

警告1:WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.
或者
No sever certificate verficaton method has been enabled.

# 解决,win客户端修改配置文件注释一个和添加一个(如果没有ns-cert-type server这个参数,那只用添加remote-cert-tls server这个参数)
;ns-cert-type server
remote-cert-tls server

警告2: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this

# 解决,在客户端配置文件添加参数
auth-nocache

警告3:WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1602', remote='link-mtu 1570'
WARNING: 'tun-mtu' is used inconsistently, local='tun-mtu 1532', remote='tun-mtu 1500'

# 解决
去掉配置文件tun-mtu相关的参数

警告4:(此错误会导致连上vpn无法上网): us=967576 WARNING: 'comp-lzo' is present in remote config but missing in local config, remote='comp-lzo'
或 write to TUN/TAP : Unknown error (code=122)

# 解决,在客户端配置文件添加参数
comp-lzo

警告5: ROUTE: route addition failed using CreateIpForwardEntry: ÖÁÉÙÓÐһ¸ֲÎÊ�Õýȷc [status=160 if_index=19]

# 解决,在客户端配置文件添加参数
route-method exe
route-delay 2

警告6:AEAD Decrypt error: bad packet ID (may be a replay): [ #141 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings

# 解决,在客户端配置文件添加参数
mute-replay-warnings

警告7: WARNING: --ping should normally be used with --ping-restart or --ping-exit

# 解决,配置文件中参数修改为下面的
# ping 表示每隔多少秒就ping对端一次
# ping-restart/ping-exit 表示在多少秒后没有收到对端的包就重启或者退出
ping 15
ping-restart 15
或者
ping-exit 15

警告8(和客户端版本有关系): DEPRECATED OPTION: --cipher set to 'AES-256-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). OpenVPN ignores --cipher for cipher negotiations.

# 解决,配置文件中参数修改为下面的
data-ciphers AES-256-CBC
data-ciphers-fallback AES-256-CBC

警告9(和客户端版本有关系): WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.

# 解决,不启用压缩,配置文件中参数修改为下面的
comp-lzo no
allow-compression no

错误1: TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity) TLS Error: TLS handshake failed

# 可能的原因1(来自官网的回答 https://openvpn.net/faq/tls-error-tls-key-negotiation-failed-to-occur-within-60-seconds-check-your-network-connectivity/)
1,服务器网络上的外围防火墙正在过滤传入的 OpenVPN 数据包(默认情况下,OpenVPN 使用 UDP 或 TCP 端口号 1194)。
在 OpenVPN 服务器机器上运行的软件防火墙本身正在过滤端口 1194 上的传入连接。请注意,默认情况下许多操作系统将阻止传入连接,除非另有配置。
2,服务器网络上的 NAT 网关没有 TCP/UDP 1194 端口转发规则到 OpenVPN 服务器机器的内部地址。
3,OpenVPN 客户端配置在其配置文件中没有正确的服务器地址。客户端配置文件中的remote指令  必须指向服务器本身或服务器网络网关的公共 IP 地址。
4,另一个可能的原因是 Windows 防火墙阻止了对 openvpn.exe 二进制文件的访问。您可能需要将其列入白名单(将其添加到“例外”列表),OpenVPN 才能正常工作。

# 可能的原因2
大概率是网络不通的原因,比如请求被拦截了(防火墙,安全组,运营商等),地址被屏蔽了(国外的ip地址)

特别说明:如果客户端连接不上,报错信息没有给出明显的错误,请在服务端的日志中查看日志,会看到是什么原因导致的!
如果同样配置文件已经在其他电脑连接成功,请对比下配置文件内容,有用户密码的核对下和服务端的是否一致
或者两个人用一套证书都连接上了但是有1个人不能上网的,可能是服务器没有开启同一套证书允许多用户使用

客户端连接不上几个提示例子:

提示1:
MANAGEMENT: >STATE:1679479405,TCP_CONNECT,,,,,,(一直卡这很久)
TCP: connect to [AF_INET]x.x.x.x:1194 failed: Unknown error

提示2:
MANAGEMENT: >STATE:1679479100,WAIT,,,,,,
read UDP: Unknown error (code=10054)

提示3:
UDP link remote: [AF_INET]x.x.x.x:1194
MANAGEMENT: >STATE:1679485965,WAIT,,,,,,

以上几种提示是连不上才出现的(客户端连不到服务端) [ ip地址错误 或 使用协议错误 或 服务端被国内屏蔽了 ]

客户端的原因导致:
可能是1、客户端和服务端配置的协议不一致
可能是2、端口 或 地址 不正确

服务端的原因导致:
可能是3、服务端服务未启动
可能是4、防火墙阻止了对应的端口和协议
可能是5、地址被运营商封掉,墙掉了

其他原因导致:
服务端的ip被给封掉了

因为pptp、l2tp、openvpn 都属于常见类型vpn,如果是服务端ip是国外的地址,使用中突然连不上了也很正常!被墙了呗

对于网友在本文章留言中出现的公网ip地址,安全起见,显示的评论ip用x.x.x.x代替

Centos7 搭建OpenVPN 基于证书认证
OpenVPN 基于用户密码方式认证


本文最后更新时间 2024-04-10
文章链接地址:
https://me.jinchuang.org/archives/573.html
本站文章除注明[转载|引用],均为本站原创内容,转载前请注明出处
Server 2008 R2 安装配置 L2TP/IPsec VPN (使用预共享密钥)
OpenVPN 基于用户密码方式认证
Centos7 搭建OpenVPN 基于证书认证
Centos7 搭建PPTP-VPN 服务

Typecho替换默认Gravatar头像地址

OpenVPN 基于用户密码方式认证

留言列表

  1. starry
    Windows 10 Microsoft Edge
    中国辽宁省沈阳市浑南区联通

    大佬 再问一个问题 呜呜呜
    Mon Feb 13 21:52:072023 TCP: connect to[AF_INET]x.x.x.x:1194 failed: Unknown emor
    这个错误是为啥啊?

    1. zsand
      Windows 10 Microsoft Edge
      中国安徽省合肥市联通

      我也遇到的同样的问题,有解决方法了吗~~

    2. Awking
      Windows 10 Google Chrome
      中国安徽省合肥市联通

      这个错误前面的完整日志发下看看

  2. starry
    Windows 10 Microsoft Edge
    中国安徽省合肥市联通

    Warning: cannot open --log file: C:\Program Files\OpenVPN\log\client.log: Input/output error (errno=5)
    大佬 这个是为啥呀?

    1. Awking
      Windows 10 Google Chrome
      中国湖南省联通

      没权限吧,要用管理员权限启动程序

      1. hhhxxx
        Windows 10 Microsoft Edge
        中国安徽省合肥市联通

        在客户端用管理员权限启动程序了,也还是连不上是什么原因呀?求指导!非常感谢!

        1. Awking
          Windows 10 Google Chrome
          中国安徽省合肥市联通

          连不上的报错日志是什么?
          如果配置没问题的话你换其他电脑连接下看是否同样错误?

  3. 亦辰
    Windows 10 Microsoft Edge
    中国安徽省合肥市联通

    openvpn connect连接失败报There was an error attempting to connect to the selected server. Error message:ovpnagent:request error

  4. deng
    Windows 10 Google Chrome
    美国弗吉尼亚州阿什本Amazon

    牛逼啊大佬,可以了,非常感谢,好人一生平安

  5. 1
    1
    Windows 10 Microsoft Edge
    中国辽宁省沈阳市浑南区联通

    Mon Nov 28 02:39:00 2022 read UDP: Unknown error (code=10054)
    Mon Nov 28 02:39:02 2022 read UDP: Unknown error (code=10054)
    Mon Nov 28 02:39:07 2022 read UDP: Unknown error (code=10054)
    这怎么办

    1. Awking
      Windows 10 Google Chrome
      中国移动

      协议错误,确认下服务端配置和客户端配置的协议是否一致

      1. 白
        Windows 10 Microsoft Edge
        中国安徽省合肥市联通

        TCP: connect to [AF_INET]ip failed: Unknown error
        这个怎么确认

        1. Awking
          Windows 10 Google Chrome
          中国湖南省长沙市电信IDC机房

          看提示是连接失败,应该是连接不到服务,确认下服务是否正常,服务端口和防火墙之类有没有放通对应协议和端口

  6. allen
    Windows 10 Google Chrome
    中国广东省深圳市联通

    遇到了警告2问题,请问win10客户端配置文件添加怎么操作呢

    1. Awking
      Windows 10 Google Chrome
      中国天津市联通

      电脑右下角openvpn的图标,右键点开,鼠标放到你配置文件名称上,就会出来修改配置文件的

  7. 泡泡茶壶
    Windows 10 Microsoft Edge
    中国广东省东莞市电信

    警告3和警告4是可以同时出现的,原因是服务器与客户端配置的压缩算法不一致,这会导致你能ping通,能curl或nc访问,但是web页面打不开。解决的方法是在服务器配置
    compress lz4-v2
    push "compress lz4-v2"
    这两行就行了,配置push后客户端就会使用和服务器相同的lz4压缩算法,不需要在客户端额外进行配置,配了可能还报错!

  8. mymtee
    Windows 10 Microsoft Edge
    中国上海市电信

    无法访问vnp,如下是 log,请大佬帮忙看看,如何解决

    2022-06-06 14:39:18 DEPRECATED OPTION: --cipher set to 'AES-256-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-256-CBC' to --data-ciphers or change --cipher 'AES-256-CBC' to --data-ciphers-fallback 'AES-256-CBC' to silence this warning.
    2022-06-06 14:39:18 OpenVPN 2.5.5 Windows-MSVC [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Dec 15 2021
    2022-06-06 14:39:18 Windows version 10.0 (Windows 10 or greater) 64bit
    2022-06-06 14:39:18 library versions: OpenSSL 1.1.1l 24 Aug 2021, LZO 2.10
    2022-06-06 14:39:18 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
    2022-06-06 14:39:18 Need hold release from management interface, waiting...
    2022-06-06 14:39:18 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
    2022-06-06 14:39:18 MANAGEMENT: CMD 'state on'
    2022-06-06 14:39:18 MANAGEMENT: CMD 'log all on'
    2022-06-06 14:39:18 MANAGEMENT: CMD 'echo all on'
    2022-06-06 14:39:18 MANAGEMENT: CMD 'bytecount 5'
    2022-06-06 14:39:18 MANAGEMENT: CMD 'hold off'
    2022-06-06 14:39:18 MANAGEMENT: CMD 'hold release'
    2022-06-06 14:39:19 MANAGEMENT: CMD 'username "Auth" "htetthuaung"'
    2022-06-06 14:39:19 MANAGEMENT: CMD 'password [...]'
    2022-06-06 14:39:19 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    2022-06-06 14:39:19 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    2022-06-06 14:39:19 MANAGEMENT: >STATE:1654497559,RESOLVE,,,,,,
    2022-06-06 14:39:19 TCP/UDP: Preserving recently used remote address: [AF_INET]x.x.x.x:1194
    2022-06-06 14:39:19 Socket Buffers: R=[65536->65536] S=[65536->65536]
    2022-06-06 14:39:19 Attempting to establish TCP connection with [AF_INET]x.x.x.x:1194 [nonblock]
    2022-06-06 14:39:19 MANAGEMENT: >STATE:1654497559,TCP_CONNECT,,,,,,
    2022-06-06 14:39:30 TCP: connect to [AF_INET]x.x.x.x:1194 failed: Unknown error
    2022-06-06 14:39:30 SIGUSR1[connection failed(soft),init_instance] received, process restarting
    2022-06-06 14:39:30 MANAGEMENT: >STATE:1654497570,RECONNECTING,init_instance,,,,,
    2022-06-06 14:39:30 Restart pause, 5 second(s)
    2022-06-06 14:39:35 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    2022-06-06 14:39:35 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
    2022-06-06 14:39:35 MANAGEMENT: >STATE:1654497575,RESOLVE,,,,,,
    2022-06-06 14:39:35 TCP/UDP: Preserving recently used remote address: [AF_INET]x.x.x.x:1194
    2022-06-06 14:39:35 Socket Buffers: R=[65536->65536] S=[65536->65536]
    2022-06-06 14:39:35 Attempting to establish TCP connection with [AF_INET]x.x.x.x:1194 [nonblock]
    2022-06-06 14:39:35 MANAGEMENT: >STATE:1654497575,TCP_CONNECT,,,,,,
    2022-06-06 14:39:45 TCP: connect to [AF_INET]x.x.x.x:1194 failed: Unknown error
    2022-06-06 14:39:45 SIGUSR1[connection failed(soft),init_instance] received, process restarting
    2022-06-06 14:39:45 MANAGEMENT: >STATE:1654497585,RECONNECTING,init_instance,,,,,
    2022-06-06 14:39:45 Restart pause, 5 second(s)
    2022-06-06 14:39:46 SIGTERM[hard,init_instance] received, process exiting
    2022-06-06 14:39:46 MANAGEMENT: >STATE:1654497586,EXITING,init_instance,,,,,

留言已关闭