简体   繁体   中英

Ubuntu 22.04 OpenVpn server error: write to TUN/TAP : Invalid argument (code=22)

I start openvpn server with openvpn --dev tun --ifconfig 172.16.0.1 172.16.0.2 --cipher AES-256-CBC on my Ubuntu 22.04 Linux Box

I generate the certificates and keys with easycert and copy everything on a Windows 10 client.

The connection doesn't work, and in the syslog I find a lot of

write to TUN/TAP : Invalid argument (code=22)
write to TUN/TAP : Invalid argument (code=22)
...

What's wrong? This is my client configuration file:

client
dev tun
proto udp
remote *MYSERVERIP* 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
remote-cert-tls server
cipher AES-256-CBC

The problem is that your server uses comp-lzo adaptive compression default (even if not added to the server.conf file), but client does not have compression enabled at all. So the client is sending uncompressed packets, while the server is expecting a compression header. Pls check a log: /var/log/openvpn/openvpn.log on your server. To solve the problem pls add this line: comp-lzo adaptive or simply comp-lzo to your client.conf file, because adaptive is the default mode for comp-lzo , so you can omit that. You can also add the same option to your server.conf file, then you are sure that your server uses the same kind of compression.

Hello if you have a vpn configuration file like.pcf:

1)convert the file format to.conf: $>pcf2vpnc file.pcf file.conf

2)so you can connect by typing: $>vpnc./file.conf

3)and disconnect: $> vpnc-disconnect

I found this in: https://kifarunix.com/connect-to-cisco-vpn-using-pcf-file-on-ubuntu/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM