Page 1 of 1

Configure IPv4 and IPv6

Posted: Tue Dec 27, 2022 2:44 pm
by Lithimlin
I'm trying to setup my OpenVPN server to handle both IPv4 and IPv6 connections.
From what I gathered from various sources and the man-page, it should suffice to set the proto option to udp without any number following it, or even not set it at all:

Code: Select all

--proto p
          Use protocol p for communicating with remote host. p can be udp,
          tcp-client, or tcp-server. You can also  limit  OpenVPN  to  use
          only  IPv4  or  only  IPv6 by specifying p as udp4, tcp4-client,
          tcp4-server or udp6, tcp6-client, tcp6-server, respectively.

          The default protocol is udp when --proto is not specified.
However, when I do so, the IPv4 connection works fine, but I cannot connect using IPv6. Instead, I get a TLS error:

Code: Select all

2022-12-27 15:38:37 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
2022-12-27 15:38:37 TLS Error: TLS handshake failed
2022-12-27 15:38:37 SIGUSR1[soft,tls-error] received, process restarting
2022-12-27 15:38:37 Restart pause, 5 second(s)
After this, it connects to the IPv4 address.

Here is my relevant config:

Code: Select all

# local listen ip
# If unspecified, OpenVPN will bind to all interfaces.
;local vpn.my-host.tld

# listen on port 1194 udp
port 1194

# protocol
# can be udp, tcp-client, or tcp-server. You can also  limit  OpenVPN
# to  use only  IPv4  or  only  IPv6 by specifying p as udp4, tcp4-client,
# tcp4-server or udp6, tcp6-client, tcp6-server, respectively.
proto udp

# we use tun interface
dev-type tun
dev vpn_OpenVPN
What's going wrong here?

Re: Configure IPv4 and IPv6

Posted: Fri Dec 30, 2022 3:38 pm
by ordex
if the server is running Linux, you need to specify udp6 (weird eh?), because on Linux IPv6 sockets are dual stack unless otherwise instructed.