LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2012, 02:55 AM   #1
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Rep: Reputation: Disabled
Openvpn failed to connect


I have this configuration in the server.conf file on my Debian server:
Code:
local SERVER_IP
port 4444
proto udp
dev tun0
##
tun-mtu 1500
tun-mtu-extra 32
##
ca      /etc/openvpn/easy-rsa/keys/ca.crt    # generated keys
cert    /etc/openvpn/easy-rsa/keys/server.crt
key     /etc/openvpn/easy-rsa/keys/server.key  # keep secret
dh      /etc/openvpn/easy-rsa/keys/dh1024.pem

server 10.44.44.0 255.255.255.0  # internal tun0 connection IP
ifconfig-pool-persist /usr/local/etc/openvpn/ipp.txt
push "route 10.3.3.0 255.255.255.0"
##
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

keepalive 10 120

comp-lzo         # Compression - must be turned on at both end
persist-key
persist-tun

status /var/log/openvpn-status.log

verb 3  # verbose mode
client-to-client
management localhost 7505
verb 3
mute 20
and this ones in the client.conf:
Code:
client
dev tun
port 4444
proto udp

remote SERVER_IP             # VPN server IP : PORT
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
resolv-retry infinite
ca ca.crt
cert shahin.crt
key shahin.key

script-security 2
comp-lzo
user nobody
group nobody
persist-key
persist-tun
comp-lzo
log openvpn.log
verb 3
but when I try to connect with nm-applet (NetworkManager) I'll get an `time out error` and nothing will not happen!

I configured a log file that you can find it's output here: http://pastebin.com/nU91bXq9

Last edited by shahinism; 12-19-2012 at 03:04 AM.
 
Old 12-19-2012, 02:59 AM   #2
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 21
Quote:
Originally Posted by shahinism View Post
I have this configuration in the server.conf file on my Debian server:
Code:
local 88.198.156.177
port 4444
proto udp
dev tun0
##
tun-mtu 1500
tun-mtu-extra 32
##
ca      /etc/openvpn/easy-rsa/keys/ca.crt    # generated keys
cert    /etc/openvpn/easy-rsa/keys/server.crt
key     /etc/openvpn/easy-rsa/keys/server.key  # keep secret
dh      /etc/openvpn/easy-rsa/keys/dh1024.pem

server 10.44.44.0 255.255.255.0  # internal tun0 connection IP
ifconfig-pool-persist /usr/local/etc/openvpn/ipp.txt
push "route 10.3.3.0 255.255.255.0"
##
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

keepalive 10 120

comp-lzo         # Compression - must be turned on at both end
persist-key
persist-tun

status /var/log/openvpn-status.log

verb 3  # verbose mode
client-to-client
management localhost 7505
verb 3
mute 20
and this ones in the client.conf:
Code:
client
dev tun
port 4444
proto udp

remote SERVER_IP             # VPN server IP : PORT
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
resolv-retry infinite
ca ca.crt
cert shahin.crt
key shahin.key

script-security 2
comp-lzo
user nobody
group nobody
persist-key
persist-tun
comp-lzo
log openvpn.log
verb 3
but when I try to connect with nm-applet (NetworkManager) I'll get an `time out error` and nothing will not happen!

I configured a log file that you can find it's output here: http://pastebin.com/nU91bXq9
There is a problem with your certificate, more than likely a date mismatch. On the system that generated the cerificate (the CA), what is the date? Does it match current time?
 
Old 12-19-2012, 03:03 AM   #3
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
There is a problem with your certificate, more than likely a date mismatch. On the system that generated the cerificate (the CA), what is the date? Does it match current time?
on the server it is:
Code:
Wed Dec 19 12:19:33 CST 2012
and on my client it is:
Code:
Wed Dec 19 12:29:34 IRST 2012
do you think is there a problem with it? my server is in Germany and I'm from Iran.

Last edited by shahinism; 12-19-2012 at 03:06 AM.
 
Old 12-19-2012, 03:24 AM   #4
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 21
Quote:
Originally Posted by shahinism View Post
on the server it is:
Code:
Wed Dec 19 12:19:33 CST 2012
and on my client it is:
Code:
Wed Dec 19 12:29:34 IRST 2012
do you think is there a problem with it? my server is in Germany and I'm from Iran.
Run "openssl x509 -noout -text -in <CERTIFICATE>.pem" replacing <CERTIICATE>.pem with your certificate file.

There is definitely something wrong with the time on the certificate vs actual time.
 
Old 12-19-2012, 03:30 AM   #5
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
Run "openssl x509 -noout -text -in <CERTIFICATE>.pem" replacing <CERTIICATE>.pem with your certificate file.

There is definitely something wrong with the time on the certificate vs actual time.
It'll return:
Code:
unable to load certificate
1844:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:650:Expecting: TRUSTED CERTIFICATE
it seems you are right. but what can I do now?
 
Old 12-19-2012, 03:36 AM   #6
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 21
Quote:
Originally Posted by shahinism View Post
It'll return:
Code:
unable to load certificate
1844:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:650:Expecting: TRUSTED CERTIFICATE
it seems you are right. but what can I do now?
How did you generate the certificate?
 
Old 12-19-2012, 03:54 AM   #7
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
How did you generate the certificate?
by build-dh script from Easy-rsa directory.
 
Old 12-20-2012, 02:50 AM   #8
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 21
Quote:
Originally Posted by shahinism View Post
by build-dh script from Easy-rsa directory.
This should have been created using the build-key certificate in that directory (server side cert should be created using build-key-server).
 
Old 12-20-2012, 02:56 AM   #9
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
This should have been created using the build-key certificate in that directory (server side cert should be created using build-key-server).
I used build-key-server to make server.{key,crt}. but for dh1024.pem I used build-dh ;-)
 
Old 12-20-2012, 04:53 AM   #10
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Original Poster
Rep: Reputation: Disabled
It seems my problem was from my configs. I used example configs and now I'm connected. but speed is too low! I turned off comp-lzo, but speed is too down and I don't like it :-(
 
Old 12-20-2012, 08:31 PM   #11
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 21
Quote:
Originally Posted by shahinism View Post
It seems my problem was from my configs. I used example configs and now I'm connected. but speed is too low! I turned off comp-lzo, but speed is too down and I don't like it :-(
Did you compile OpenVPN or install from an RPM? What distro are you using? If you compiled, you'll want to make sure the development libraries are installed for LZO also. It's what supports compression for OpenVPN. If the install wasn't compiled with LZO, you'll need to compile and install the binaries again.
 
Old 12-21-2012, 12:48 AM   #12
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
Did you compile OpenVPN or install from an RPM? What distro are you using? If you compiled, you'll want to make sure the development libraries are installed for LZO also. It's what supports compression for OpenVPN. If the install wasn't compiled with LZO, you'll need to compile and install the binaries again.
I'm using Debian, and I used apt-get to install openvpn. LZO worked fine, but after turning it off, openvpn becomes faster, but not enough ;-)
 
  


Reply



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
Bind9: NDC command failed : rndc: connect failed: connection refused Boudewijn Linux - Networking 19 01-02-2014 07:19 AM
openvpn start failed lunocio Linux - Networking 2 06-05-2012 08:53 PM
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
Openvpn start failed leiw Linux - Networking 1 05-20-2008 12:51 AM
online_update failed - ERROR(Media:connection failed)[Connect failed] rover SUSE / openSUSE 8 02-22-2005 07:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:44 AM.

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