LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-05-2016, 04:17 AM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Cool Open VPN (Centos 6.8)


hi guys, followed a documentation in Digital Ocean on how to install VPN but it's not working when connecting from Win 7.

OpenVPN: 2.3.11

Any ideas guys?

Thanks for any help.

Here's the error:
Quote:
Tue Jul 05 17:13:40 2016 OpenVPN 2.3.11 i686-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on May 10 2016
Tue Jul 05 17:13:40 2016 Windows version 6.1 (Windows 7) 32bit
Tue Jul 05 17:13:40 2016 library versions: OpenSSL 1.0.1t 3 May 2016, LZO 2.09
Tue Jul 05 17:13:40 2016 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Tue Jul 05 17:13:40 2016 Need hold release from management interface, waiting...
Tue Jul 05 17:13:40 2016 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Tue Jul 05 17:13:40 2016 MANAGEMENT: CMD 'state on'
Tue Jul 05 17:13:40 2016 MANAGEMENT: CMD 'log all on'
Tue Jul 05 17:13:40 2016 MANAGEMENT: CMD 'hold off'
Tue Jul 05 17:13:40 2016 MANAGEMENT: CMD 'hold release'
Tue Jul 05 17:13:41 2016 Socket Buffers: R=[8192->8192] S=[8192->8192]
Tue Jul 05 17:13:41 2016 UDPv4 link local: [undef]
Tue Jul 05 17:13:41 2016 UDPv4 link remote: [AF_INET]192.168.1.91:1194
Tue Jul 05 17:13:41 2016 MANAGEMENT: >STATE:1467710021,WAIT,,,
Quote:
Tue Jul 05 17:15:44 2016 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Jul 05 17:15:44 2016 TLS Error: TLS handshake failed
Tue Jul 05 17:15:44 2016 SIGUSR1[soft,tls-error] received, process restarting
Tue Jul 05 17:15:44 2016 MANAGEMENT: >STATE:1467710144,RECONNECTING,tls-error,,
Tue Jul 05 17:15:44 2016 Restart pause, 2 second(s)
Tue Jul 05 17:15:46 2016 Socket Buffers: R=[8192->8192] S=[8192->8192]
Tue Jul 05 17:15:46 2016 UDPv4 link local: [undef]
Tue Jul 05 17:15:46 2016 UDPv4 link remote: [AF_INET]192.168.1.91:1194
Tue Jul 05 17:15:46 2016 MANAGEMENT: >STATE:1467710146,WAIT,,,
Tue Jul 05 17:16:46 2016 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Jul 05 17:16:46 2016 TLS Error: TLS handshake failed
Tue Jul 05 17:16:46 2016 SIGUSR1[soft,tls-error] received, process restarting
Tue Jul 05 17:16:46 2016 MANAGEMENT: >STATE:1467710206,RECONNECTING,tls-error,,
Tue Jul 05 17:16:46 2016 Restart pause, 2 second(s)
Tue Jul 05 17:16:48 2016 Socket Buffers: R=[8192->8192] S=[8192->8192]
Tue Jul 05 17:16:48 2016 UDPv4 link local: [undef]
Tue Jul 05 17:16:48 2016 UDPv4 link remote: [AF_INET]192.168.1.91:1194
Tue Jul 05 17:16:48 2016 MANAGEMENT: >STATE:1467710208,WAIT,,,

Last edited by JJJCR; 07-05-2016 at 04:19 AM. Reason: edit
 
Old 07-05-2016, 07:51 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by JJJCR View Post
hi guys, followed a documentation in Digital Ocean on how to install VPN but it's not working when connecting from Win 7.
OpenVPN: 2.3.11 Here's the error:
You posted some lines, but you don't say which are coming from the Windows system, and which is from the Linux system, or tell us if you've opened ports in your firewall, or tell us how you're testing this. Testing it from your internal network (BEHIND your firewall), will typically not work.

That said, if you don't run the OpenVPN client on Windows as ADMINISTRATOR, it won't have permissions to create the TAP/TUN interface needed for OpenVPN to work.
 
Old 07-05-2016, 12:52 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by TB0ne View Post
That said, if you don't run the OpenVPN client on Windows as ADMINISTRATOR, it won't have permissions to create the TAP/TUN interface needed for OpenVPN to work.
Actually, a proper Windows installation will install OpenVPN (client or server ...) as a "system service" that does have the Administrator-level privilege to create the necessary virtual interfaces, and to conduct the necessary interactions with its counterpart. (Or, it will be installed, necessarily "by an Administrator," as a privileged application that is capable of doing this.

The OP needs to post considerably more detail, including simultaneous log-excerpts from both sides, in order for anyone to seriously be able to help to address the underlying problem.

Also: "OpenVPN is not specific to <Windows|Linux|whatever>, and so, most problems that arise are not specific to <Windows|Linux|whatever>, either." The OP should search any online resource or FAQ for any description that is at-all similar to what he is seeing, whether or not the web-page being Googled says "Windows." Many problems have to do with the interaction between the two peers, irrespective of(!) which OS is hosting either one of them.

Last edited by sundialsvcs; 07-05-2016 at 12:54 PM.
 
Old 07-05-2016, 12:58 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sundialsvcs View Post
Actually, a proper Windows installation will install OpenVPN (client or server ...) as a "system service" that does have the Administrator-level privilege to create the necessary virtual interfaces, and to conduct the necessary interactions with its counterpart. (Or, it will be installed, necessarily "by an Administrator," as a privileged application that is capable of doing this.
I hate to disagree...but..

I have seen a few instances lately, where a fresh Windows 10 machine did *NOT* have the TAP/TUN interface available, and you had to run a command (forget which now), to get it to appear. And while it did *SAY* that OpenVPN was supported...it wouldn't actually let you fill in the boxes with the selections of your choice. Seen that happen on both fresh and upgraded W10 machines. Haven't done it on W7, though, but the OP doesn't state which.

I do know that if you install the stand-alone client from the OpenVPN site, that right-clicking and selecting "Run as administrator", will let you get things going in many cases.
Quote:
The OP needs to post considerably more detail, including simultaneous log-excerpts from both sides, in order for anyone to seriously be able to help to address the underlying problem.

Also: "OpenVPN is not specific to <Windows|Linux|whatever>, and so, most problems that arise are not specific to <Windows|Linux|whatever>, either." The OP should search any online resource or FAQ for any description that is at-all similar to what he is seeing, whether or not the web-page being Googled says "Windows." Many problems have to do with the interaction between the two peers, irrespective of(!) which OS is hosting either one of them.
Agree on both counts.
 
Old 07-07-2016, 07:52 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Windows-10 has a slew of security problems ... so they say ... so they say ...
 
Old 07-08-2016, 05:14 AM   #6
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Original Poster
Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
hi guys, thanks for the reply.

I rebuild the openvpn from scratch but still got errors on the client side.

Here's my server.conf

Quote:
# Which local IP address should OpenVPN
# listen on? (optional)
local 192.168.1.28

# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

dev tun

ca ca.crt
cert server.crt
key server.key # This file should be kept secret

dh dh2048.pem

server 10.8.0.0 255.255.255.0

ifconfig-pool-persist ipp.txt

push "redirect-gateway def1 bypass-dhcp"


push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

keepalive 10 120

comp-lzo

user nobody
group nobody


persist-key
persist-tun

status openvpn-status.log

verb 3
Here's the client.ovpn (client is windows 7)
Quote:
client
dev tun
proto udp
remote 192.168.1.28 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
remote-cert-tls server
comp-lzo
verb 3
Error from the client:
Quote:
Fri Jul 08 17:55:53 2016 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Fri Jul 08 17:55:53 2016 MANAGEMENT: CMD 'state on'
Fri Jul 08 17:55:53 2016 MANAGEMENT: CMD 'log all on'
Fri Jul 08 17:55:53 2016 MANAGEMENT: CMD 'hold off'
Fri Jul 08 17:55:53 2016 MANAGEMENT: CMD 'hold release'
Fri Jul 08 17:55:53 2016 Socket Buffers: R=[8192->8192] S=[8192->8192]
Fri Jul 08 17:55:53 2016 UDPv4 link local: [undef]
Fri Jul 08 17:55:53 2016 UDPv4 link remote: [AF_INET]192.168.1.28:1194
Fri Jul 08 17:55:53 2016 MANAGEMENT: >STATE:1467971753,WAIT,,,
Fri Jul 08 17:56:53 2016 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Fri Jul 08 17:56:53 2016 TLS Error: TLS handshake failed
Fri Jul 08 17:56:53 2016 SIGUSR1[soft,tls-error] received, process restarting
Fri Jul 08 17:56:53 2016 MANAGEMENT: >STATE:1467971813,RECONNECTING,tls-error,,
Fri Jul 08 17:56:53 2016 Restart pause, 2 second(s)
Fri Jul 08 17:56:55 2016 Socket Buffers: R=[8192->8192] S=[8192->8192]
Fri Jul 08 17:56:55 2016 UDPv4 link local: [undef]
Fri Jul 08 17:56:55 2016 UDPv4 link remote: [AF_INET]192.168.1.28:1194
Fri Jul 08 17:56:55 2016 MANAGEMENT: >STATE:1467971815,WAIT,,,
server log (from Centos)

Quote:
Jul 8 17:50:45 vpnabcd openvpn[1923]: /sbin/ip addr add dev tun0 local 10.8.0.1 peer 10.8.0.2
Jul 8 17:50:45 vpnabcd openvpn[1923]: /sbin/ip route add 10.8.0.0/24 via 10.8.0.2
Jul 8 17:50:45 vpnabcd openvpn[1923]: GID set to nobody
Jul 8 17:50:45 vpnabcd openvpn[1923]: UID set to nobody
Jul 8 17:50:45 vpnabcd openvpn[1923]: UDPv4 link local (bound): [AF_INET]192.168.1.28:1194
Jul 8 17:50:45 vpnabcd openvpn[1923]: UDPv4 link remote: [undef]
Jul 8 17:50:45 vpnabcd openvpn[1923]: MULTI: multi_init called, r=256 v=256
Jul 8 17:50:45 vpnabcd openvpn[1923]: IFCONFIG POOL: base=10.8.0.4 size=62, ipv6=0
Jul 8 17:50:45 vpnabcd openvpn[1923]: IFCONFIG POOL LIST
Jul 8 17:50:45 vpnabcd openvpn[1923]: Initialization Sequence Completed
Any ideas guys, why it's not working? Anything i'm missing, need your help please. Thank you.

Scenario: Both server and client is on the same internal network for test purposes.
 
Old 07-08-2016, 08:32 AM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by JJJCR View Post
hi guys, thanks for the reply.
I rebuild the openvpn from scratch but still got errors on the client side. Here's my server.conf

Here's the client.ovpn (client is windows 7) Error from the client:
server log (from Centos)

Any ideas guys, why it's not working? Anything i'm missing, need your help please. Thank you. Scenario: Both server and client is on the same internal network for test purposes.
From post #2, the VERY FIRST REPLY
Testing it from your internal network (BEHIND your firewall), will typically not work.

So...you promptly tested this from the internal network, and are SURPRISED it's not working? And again, you don't say whether or not you're running the OpenVPN client on Windows as administrator or not.
 
Old 07-08-2016, 09:02 AM   #8
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 731

Rep: Reputation: 158Reputation: 158
There is no problem whatsoever running openvpn on LAN.

1. Do you actually run Openvpn as the service OR do you use the graphical client? The graphical client MUST BE STARTED AS ADMINISTRATOR if you connect from it.
To make this more clear:
- on Windows Openvpn installs a service which is DISABLED BY DEFAULT.
- using the GUI you DON'T command this service, you connect separately so you MUST run the gui as administrator to make sure you can change interface options on the vpn device. This is required for tap devices, i am not sure about tun, but just to make sure you should run it as administrator.
- i'd recommend testing the connection in the gui then if you need permanent connection, just enable the service which will initiate connections automatically for every .ovpn file found in the openvpn directory (or openvpn/config, i dont remember exactly). This does not need any further user interaction and will not provide any graphical notifications.
2. openvpn version server side? Put verb 4 on the server log and restart it to see more details.

Last edited by gradinaruvasile; 07-08-2016 at 09:06 AM.
 
1 members found this post helpful.
Old 07-08-2016, 09:04 AM   #9
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Original Poster
Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Cool

Quote:
Originally Posted by TB0ne View Post
From post #2, the VERY FIRST REPLY
Testing it from your internal network (BEHIND your firewall), will typically not work.

So...you promptly tested this from the internal network, and are SURPRISED it's not working? And again, you don't say whether or not you're running the OpenVPN client on Windows as administrator or not.
First of all, please accept my apology. I miss that one.

Okay so I think I need to do some port forwarding on this one, wow this is a security risk if ever something got misconfigured.
 
Old 07-08-2016, 09:31 AM   #10
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Original Poster
Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Smile

Quote:
Originally Posted by gradinaruvasile View Post
There is no problem whatsoever running openvpn on LAN.

1. Do you actually run Openvpn as the service OR do you use the graphical client? The graphical client MUST BE STARTED AS ADMINISTRATOR if you connect from it.
To make this more clear:
- on Windows Openvpn installs a service which is DISABLED BY DEFAULT.
- using the GUI you DON'T command this service, you connect separately so you MUST run the gui as administrator to make sure you can change interface options on the vpn device. This is required for tap devices, i am not sure about tun, but just to make sure you should run it as administrator.
- i'd recommend testing the connection in the gui then if you need permanent connection, just enable the service which will initiate connections automatically for every .ovpn file found in the openvpn directory (or openvpn/config, i dont remember exactly). This does not need any further user interaction and will not provide any graphical notifications.
2. openvpn version server side? Put verb 4 on the server log and restart it to see more details.
I will have to check the firewalls, but for Windows I set the firewall to allow OpenVPN program.

On Linux side, I know the port 1194 is listening but I will have to double check whether it's open in the firewall.

I run the OpenVPN in Windows as Administrator but to no avail.

Thanks.

Last edited by JJJCR; 07-08-2016 at 09:32 AM. Reason: edit
 
Old 07-08-2016, 09:33 AM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by JJJCR View Post
First of all, please accept my apology. I miss that one.
Okay so I think I need to do some port forwarding on this one, wow this is a security risk if ever something got misconfigured.
"Port forwarding"?? Why? You open port 1194 for UDP only...NOT TCP. OpenVPN is quite secure....opening ANY port, for ANY service can be a security risk, if it's misconfigured.
 
Old 07-08-2016, 09:51 AM   #12
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Original Poster
Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Smile

Quote:
Originally Posted by TB0ne View Post
"Port forwarding"?? Why? You open port 1194 for UDP only...NOT TCP. OpenVPN is quite secure....opening ANY port, for ANY service can be a security risk, if it's misconfigured.
PC with OpenVPN (acting like a server) is behind a firewall, how the PC on the internet will be able to connect to the server if I will not do a port forwarding?

Yes it's UDP, then I will have to set on the firewall to open UDP traffic for port 1194.
 
Old 07-08-2016, 10:02 AM   #13
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by JJJCR View Post
PC with OpenVPN (acting like a server) is behind a firewall, how the PC on the internet will be able to connect to the server if I will not do a port forwarding?
I (incorrectly) assumed the OpenVPN server was also running on the firewall. If it isn't, then yes, you will have to forward.
Quote:
Yes it's UDP, then I will have to set on the firewall to open UDP traffic for port 1194.
Right.
 
Old 07-08-2016, 10:39 AM   #14
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 731

Rep: Reputation: 158Reputation: 158
I would suggest making this work over LAN first because if it doesnt work there, it will certainly not over the net...
 
1 members found this post helpful.
Old 07-08-2016, 11:54 AM   #15
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by gradinaruvasile View Post
I would suggest making this work over LAN first because if it doesnt work there, it will certainly not over the net...
...except for the fact that IT WILL NOT WORK OVER LAN, because the network configuration will conflict, along with gateways and several other things.

All the machines are using the same subnet. How do you think they would be able to distinguish local from remote hosts? *IF* you were even able to shoehorn this in somehow, by doing a HUGE amount of port-forwarding, it would only work for a few services, but would be a nightmare to support.
 
  


Reply

Tags
openvpn



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to authenticate open vpn user with ldap on centos 6.0 anis123 Linux - Server 1 12-02-2013 01:39 AM
VPN on centos baranmatin Linux - Networking 3 11-25-2010 08:26 PM
vpn in centos sandeepthug Linux - Networking 3 04-22-2009 08:08 AM
VPN and CentOS jrp01 Linux - Networking 1 07-29-2005 01:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration