server doesn't bind to IPv6 and IPv4 address when using proto udp6
Posted: Wed Aug 10, 2022 3:05 pm
by JanZorz
Hi,
Should server bind to IPv6 and IPv4 address if I use proto udp6 ?
If I use proto udp then it says that it can't determine which protocol I would like to use and binds to IPv4 address. If I use proto udp6 then it binds just to IPv6.
OpenVPN 2.5.7 amd64-portbld-freebsd13.1 [SSL (OpenSSL)] [LZO] [LZ4] [MH/RECVDA] [AEAD] built on Jul 25 2022
This is running on opnsense firewall. Local directive is automatically generated from WAN interface address... I can add directives to "Advanced" window if needed.
If we make this one work I can take this to opnsense community and make improvement suggestions there so their config tool would spit out correct configuration.
Cheers and thnx, Jan
Re: server doesn't bind to IPv6 and IPv4 address when using proto udp6
Posted: Thu Aug 11, 2022 10:06 am
by JanZorz
Hmm... seems that adding "local ::" to advanced tab (and to the end of config) makes things a bit better:
But now it's listening on all interfaces... how to limit it to just listening on WAN?
Cheers, Jan
Re: server doesn't bind to IPv6 and IPv4 address when using proto udp6
Posted: Thu Aug 11, 2022 11:45 am
by TinCanTech
That is how Openvpn works.
If you do not specify --local then it listens on all interfaces/addresses.
If you do not specify --local and do specify --proto udp6 then it listens on IPv6 and IPv4 UDP.
If you do specify --local then pick your --proto, default is udp4, I believe.
Re: server doesn't bind to IPv6 and IPv4 address when using proto udp6
Yes, if I don't specify "local ::" then it's listening on all interfaces on both protocols. I still did not find a proper combination that it would listen on both protocols but just on one interface.
Is there a way to say something like:
proto udp
local IPv6_addr, IPv4_addr
so it would bind only to two addresses on specified interface? Or even better:
proto udp
local vtnet0
and it would bind to all addresses (IPv6 and IPv4) on that interface?
Cheers, Jan
Re: server doesn't bind to IPv6 and IPv4 address when using proto udp6
Posted: Thu Aug 11, 2022 1:02 pm
by TinCanTech
The short answer is No.
If you do not specify --local then Openvpn binds to all interfaces/addresses.
It is not possible to bind to a specific interface, only address is supported by --local.
If you do specify --local then Openvpn only uses one --proto.
Re: server doesn't bind to IPv6 and IPv4 address when using proto udp6