win32 openvpn-2.1.1 has bug with "nobind"?
Hi there
I'm running openvpn as a client under XP and Win7 (binary from openvpn.net) over UDP with the "nobind" option. "netstat -anb" shows openvpn.exe is attached to local port 1194. I'm running it as a service BTW.
In general it works well, but once in a while, restarting openvpn doesn't work - you get some vague "cannot access" error. Waiting some minutes or rebooting will always fix the problem. Ends up that running "netstat -an" in this situation shows that something is associated with udp port 1194 - svchosts.exe. When this happens, waiting until 1194 disappears from netstat means I'm able to start openvpn successfully.
So there's a couple of issues. As I was using "nobind", shouldn't the OS have allocated the port? i.e. why is it always 1194 - not 20111 or the like? Secondly, as it's "nobind", shouldn't openvpn have allocated the next free port instead of trying to reuse 1194?
Finally, any ideas why openvpn doesn't cleanly exit all the time. I also use openvpn client under Linux and it never shows these symptoms, so I'd guess these are all win32-specific.
Thanks
Signature · 6 lines
Cheers Jason Haar Information Security Manager, Trimble Navigation Ltd. Phone: +64 3 9635 377 Fax: +64 3 9635 417 PGP Fingerprint: 7A2E 0407 C9A6 CAF6 2B9F 8422 C063 5EBB FE1D 66D1
Quoted 8 lines · Jason Haar
In general it works well, but once in a while, restarting openvpn doesn't work - you get some vague "cannot access" error. Waiting some minutes or rebooting will always fix the problem. Ends up that running
"netstat -an" in this situation shows that something is associated with
udp port 1194 - svchosts.exe. When this happens, waiting until 1194 disappears from netstat means I'm able to start openvpn successfully.
Sounds like the 2MSL problem described in this thread:
http://sourceforge.net/mailarchive/forum.php?thread_name=1263527105.29484.1%40mofo&forum_name=openvpn-devel
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
Quoted 5 lines · Karl O. Pinc
Sounds like the 2MSL problem described in this thread:
http://sourceforge.net/mailarchive/forum.php?thread_name=1263527105.29484.1%40mofo&forum_name=openvpn-devel
I see what you mean - not the same issue - but the same cause (and affecting UDP as well as TCP). I don't get it - what does "nobind" actually do then? The manpage states
Do not bind to local address and port. The IP stack will allocate a dynamic port for returning packets
That just seems to be totally not the case. With "nobind" set, openvpn still explicitly binds to 1194. I always read the manpage as meaning "nobind" meant "let the OS decide what port to use". In fact, I just tried "lport 22222" and that didn't work either! It still used 1194.
Signature · 6 lines
Cheers Jason Haar Information Security Manager, Trimble Navigation Ltd. Phone: +64 3 9635 377 Fax: +64 3 9635 417 PGP Fingerprint: 7A2E 0407 C9A6 CAF6 2B9F 8422 C063 5EBB FE1D 66D1
I have been googling around and others reported this back in 2005! Looking at the code (I'm no programmer), there seems to be a hint that the "nobind" option only works for TCP - not UDP?
Is this true? There's no reason for it that I can think of, but it would explain what I'm seeing: in UDP mode, openvpn ignores "nobind". Even on my Linux box, I have "nobind" set and yet it's using 1194 for lport...
Confirmed. I have a server running on 1194 tcp and udp and if I toggle between tcp and udp on the client (ie nobind remains the same), I see lport=1194 for udp and lport=>1023 for tcp
Jason
Signature · 6 lines
Cheers Jason Haar Information Security Manager, Trimble Navigation Ltd. Phone: +64 3 9635 377 Fax: +64 3 9635 417 PGP Fingerprint: 7A2E 0407 C9A6 CAF6 2B9F 8422 C063 5EBB FE1D 66D1
Hi,
Quoted 1 line · Jason Haar
Confirmed. I have a server running on 1194 tcp and udp and
Is this a single server listening on both ports, or is this two independent servers?
(For a customer installation, I need a single server to listen on UDP/1194 and TCP/443, and as far as I understood so far, this was not possible)
If this is indeed not possible yet, is anybody working on this? I might be tempted to tackle it, but would prefer to avoid duplicate work.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Quoted 4 lines · Gert Doering
Is this a single server listening on both ports, or is this two independent servers?
server running openvpn on tcp:1195 and udp:1195
client running openvpn with "nobind".
client connects to server via "remote server.name 1195 tcp", "lsof -ni" on client shows openvpn is associated with "*:2222" - ie "nobind" is working
client connects to server via "remote server.name 1195 udp", "lsof -ni" on client shows openvpn is associated with "*:1194" - ie "nobind" is NOT working
Quoted 4 lines
(For a customer installation, I need a single server to listen on UDP/1194 and TCP/443, and as far as I understood so far, this was not possible)
Yeah - can't be done. However, my problem is a client problem - you sound like having a server problem. "nobind" only works in client mode
If you're using tun interfaces, you'll need to split your pool range between the two instances.
Signature · 6 lines
Cheers Jason Haar Information Security Manager, Trimble Navigation Ltd. Phone: +64 3 9635 377 Fax: +64 3 9635 417 PGP Fingerprint: 7A2E 0407 C9A6 CAF6 2B9F 8422 C063 5EBB FE1D 66D1
Hi,
Quoted 5 lines · Jason Haar
Quoted 2 lines · Gert Doering
Is this a single server listening on both ports, or is this two independent servers?
server running openvpn on tcp:1195 and udp:1195
So it's two independent processes.
Quoted 5 lines
Quoted 2 lines
(For a customer installation, I need a single server to listen on UDP/1194 and TCP/443, and as far as I understood so far, this was not possible)
Yeah - can't be done. However, my problem is a client problem - you sound like having a server problem. "nobind" only works in client mode
Yes, sorry for hijacking your thread. Your remark about the server setup made me curious, so I jumped in.
Can't help you with the client problem, though.
Quoted 2 lines
If you're using tun interfaces, you'll need to split your pool range between the two instances.
Or extend the code to make "listen on multiple ports" possible.
From a cursory glance, it won't be easy, as the code is full of special cases (blocking/non-blocking, udp/tcp, client/server side, all somewhat intermixed) and it will certainly require changes to data structures and to the MULTI code as well. Oh well. Let's see what time brings.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...