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 基于用户密码方式认证
文章链接地址:https://me.jinchuang.org/archives/573.html
本站文章除注明[转载|引用],均为本站原创内容,转载前请注明出处
博主,我公司电脑上能连接,我使用家里笔记本电脑连接公司openvpn服务的时候,连接失败。我想请教下这个是什么原因了?下面是错误信息:Fri May 27 17:45:35 2022 Control Channel MTU parms [ L:1624 D:1182 EF:68 EB:0 ET:0 EL:3 ]
Fri May 27 17:45:35 2022 Data Channel MTU parms [ L:1624 D:1450 EF:124 EB:406 ET:0 EL:3 ]
Fri May 27 17:45:35 2022 crypto_adjust_frame_parameters: Adjusting frame parameters for crypto by 48 bytes
Fri May 27 17:45:35 2022 calc_options_string_link_mtu: link-mtu 1624 -> 1552
Fri May 27 17:45:35 2022 crypto_adjust_frame_parameters: Adjusting frame parameters for crypto by 48 bytes
Fri May 27 17:45:35 2022 calc_options_string_link_mtu: link-mtu 1624 -> 1552
Fri May 27 17:45:35 2022 Local Options String (VER=V4): 'V4,dev-type tun,link-mtu 1552,tun-mtu 1500,proto TCPv4_CLIENT,comp-lzo,keydir 1,cipher AES-256-GCM,auth [null-digest],keysize 256,tls-auth,key-method 2,tls-client'
Fri May 27 17:45:35 2022 Expected Remote Options String (VER=V4): 'V4,dev-type tun,link-mtu 1552,tun-mtu 1500,proto TCPv4_SERVER,comp-lzo,keydir 0,cipher AES-256-GCM,auth [null-digest],keysize 256,tls-auth,key-method 2,tls-server'
Fri May 27 17:45:35 2022 TCP/UDP: Preserving recently used remote address: [AF_INET]192.168.81.153:1194
Fri May 27 17:45:35 2022 Socket Buffers: R=[65536->65536] S=[65536->65536]
Fri May 27 17:45:35 2022 Attempting to establish TCP connection with [AF_INET]192.168.81.153:1194 [nonblock]
Fri May 27 17:45:35 2022 MANAGEMENT: >STATE:1653644735,TCP_CONNECT,,,,,,
Fri May 27 17:47:35 2022 TCP: connect to [AF_INET]192.168.81.153:1194 failed: Unknown error
大佬,想请教下,我在公司搭建openvpn服务,我使用公司的电脑,能连接openvpn服务,我使用家里的电脑连接失败,这个是怎么回事了?
你用家里连接到公司,地址没改吧,我看是192.168.私有地址
我在家的使用openvpn客户端配置修改成公司公网的ip地址,也是一样连接失败,我找不到具体原因,
如果是这种连接不上的错误: connect to [AF_INET]x.x.x.x:1194 failed: Unknown error,检查下端口或防火墙,这种错误就是连不上服务的
端口都检查过了,都是开放的,并且我使用公司笔记本电脑openvpn客户端,可以连接搭建openvpn的服务器。就是家里电脑配置连接不上。
这个openvpn连接除了需要装一个tap虚拟网卡,其他配置都一样应该连接没问题
防火墙开启的,1194/tcp、1194/udp端口都是开放的
你好,这个问题最后是怎么解决的呀
你好,这种情况怎么办呀
Thu Dec 01 14:04:43 2022 MANAGEMENT: >STATE:1669874683,TCP_CONNECT,,,,,,
Thu Dec 01 14:06:44 2022 TCP: connect to [AF_INET]x.x.x.x:9990 failed: Unknown error
这个应该是服务的端口没有放开或者端口号不对
connect to [AF_INET]x.x.x.x:1194 failed: Unknown error,是这个
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.
客户端能连上,但查看日志遇到上述错误,试着修改了一下配置文件,但是还是没有解决。请问要修改哪项参数?非常感谢!
部分配置文件如下:
dev tun
tls-client
remote IP 1194
# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)
#float
# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)
#redirect-gateway def1
# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.
#dhcp-option DNS DNS_IP_ADDRESS
pull
# If you want to connect by Server's IPv6 address, you should use
# "proto udp6" in UDP mode or "proto tcp6-client" in TCP mode
proto udp
script-security 2
reneg-sec 0
cipher AES-256-CBC
auth SHA512
auth-user-pass
我用你的有些参数(加不加这个参数cipher AES-256-CBC),也没出现你之前的错误,估计是客户端的版本问题,你可以参考下我的搭建openvpn的文档,
看提示就是这个参数不推荐用,你配置文件里面的这个参数发出来下看看怎么写的
大佬 第一个警告怎么添加 添加在哪里啊
在你电脑openvpn客户端配置文件里面添加
大佬,是哪个配置文件?
C:\Program Files\OpenVPN\config目录下 .ovpn后缀的配置文件
可以加我qq吗?第二个警告使我校园网不能用open 连上,端口,配置都弄好了,就是出现第二个警告命令
这2个只是警告信息,有这个2个警告信息也是可以连上的vpn的。如果你连不上那应该还有其他原因导致的
第二个警告信息不影响连接的啊,虽然有警告信息,但是是可以连上的
但是我open vp GUI连接不上68端口,不知道为什么呐
68端口?openvpn默认用的1194端口,你这个68端口是什么
大佬,linux下找不到第二个警告命令,求助
你说的linux下找不到第二个警告命令,这个第二个警告信息,只用在win10本地的配置文件中加上auth-nocache,就可以了
大佬 问下一直停留在这一段是什么情况
Mon Jul 20 14:13:38 2020 MANAGEMENT: >STATE:1595225618,TCP_CONNECT,,,,,,
我遇到了你问题三这种情况,但是按照你的方法没有解决
那你这得看看服务端的日志有啥报错了,是不是服务的问题导致的
和你这报错差不多具体如下:
WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1542', remote='link-mtu 1500'
WARNING: 'tun-mtu' is used inconsistently, local='tun-mtu 1500', remote='tun-mtu 1420'
参考:如何解决OpenVPN中不一致使用警告的link-mtu和tun-mtu?这个链接中内容修改下你的配置试试,或者更换下客户端的版本试试
嗯嗯,已经解决。谢谢大佬
我也遇到了这种情况。不过我是配置密钥时使用了密码,重启openvpn服务后,用客户端连接的时候一直连不上。
一开始以为是端口没开放,一顿搜和尝试,都没有解决。尝试了N次后,注意到重启openvpn服务时会弹出下面这个提示:
Password entry required for 'Enter Private Key Password:' (PID 10278).
Please enter password with the systemd-tty-ask-password-agent tool!
根据提示输入“systemd-tty-ask-password-agent”命令,然后输入服务器密钥的密码,启动openvpn服务之后就一切正常了。
所以,出现这种情况,可能是openvpn服务都还没起来。因此重启服务啥的,最好先用nestat -antp | grep openvpn看看openvpn服务起来了没。
以上为个人经历,仅供参考,或许能对某些人能有些帮助。
最后,感谢博主的高质量文章,排版优美,文字简洁。唉,网上某些文章乱七八糟的,看了真的想骂人。
这个vpn配置起来如果没有顺手的文档确实很多问题。只要不是配置上出问题,其他问题一般都可以百度到
你这一直停在这里,是不是没有连接上?
您好 这个是我的配置
以下是我的启动日志,但是没有办法FQ成功,您有时间可以帮忙看一下嘛 谢谢啦:
看连接日志也没啥错,估计是路由转发的问题
好的 我再去排查一下 非常感谢您
Thu Apr 06 02:48:22 2023 MANAGEMENT: CMD 'password [...]'
Thu Apr 06 02:48:22 2023 WARNING: --ping should normally be used with --ping-restart or --ping-exit
Thu Apr 06 02:48:22 2023 NOTE: --fast-io is disabled since we are running on Windows
Thu Apr 06 02:48:22 2023 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Thu Apr 06 02:48:22 2023 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Thu Apr 06 02:48:22 2023 MANAGEMENT: >STATE:1680720502,RESOLVE,,,,,,
Thu Apr 06 02:48:22 2023 TCP/UDP: Preserving recently used remote address: [AF_INET6]2a03:2880:f10c:283:face:b00c:0:25de:1194
Thu Apr 06 02:48:22 2023 Socket Buffers: R=[65536->65536] S=[65536->65536]
Thu Apr 06 02:48:22 2023 UDP link local: (not bound)
Thu Apr 06 02:48:22 2023 UDP link remote: [AF_INET6]2a03:2880:f10c:283:face:b00c:0:25de:1194
Thu Apr 06 02:48:22 2023 MANAGEMENT: >STATE:1680720502,WAIT,,,,,,
大佬,按照上面的修改ping15不显示红色警告,但还是一直连接不上
红色警告是你的配置文件ping参数配置的问题,和连不上没有关系,你连接不上的提示,参考下文章末尾我列出的情况
是的,一直停留在这里。没有连接成功
Sat Mar 25 20:49:14 2023 OpenVPN 2.4.9 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Apr 16 2020
Sat Mar 25 20:49:14 2023 Windows version 6.2 (Windows 8 or greater) 64bit
Sat Mar 25 20:49:14 2023 library versions: OpenSSL 1.1.1f 31 Mar 2020, LZO 2.10
Enter Management Password:
Sat Mar 25 20:49:14 2023 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25347
Sat Mar 25 20:49:14 2023 Need hold release from management interface, waiting...
Sat Mar 25 21:02:52 2023 Signal received from management interface, exiting
大佬,这个是啥情况呀,求助!
日志不完整吧,看不出来是什么情况导致的
我也想问,遇到同样问题了
和层主类似的问题,求问下
Thu Feb 23 08:09:25 2023 NOTE: --fast-io is disabled since we are running on Windows
Thu Feb 23 08:09:25 2023 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Thu Feb 23 08:09:25 2023 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Thu Feb 23 08:09:25 2023 TCP/UDP: Preserving recently used remote address: [AF_INET]x.x.x.x:1443
Thu Feb 23 08:09:25 2023 Socket Buffers: R=[8192->8192] S=[8192->8192]
Thu Feb 23 08:09:25 2023 Attempting to establish TCP connection with [AF_INET]x.x.x.x:1443 [nonblock]
Thu Feb 23 08:09:25 2023 MANAGEMENT: >STATE:1677110965,TCP_CONNECT,,,,,,