Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to set up an OpenVPN server on my PC. I have followed the steps described here.

My server configuration file looks like this:

local 192.168.1.150
port 1194
dev tun
ifconfig 10.8.0.1 10.8.0.2
secret static.key

My client configurattion file looks like this:

remote A.B.C.D # this is my public IP address, is that correct?
port 1194
dev tun
ifconfig 10.8.0.2 10.8.0.1
secret static.key

When I start my server and client, the client gives the following:

Fri Jan 31 20:04:27 2014 OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Feb 27 2013
Fri Jan 31 20:04:27 2014 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Jan 31 20:04:27 2014 WARNING: file 'static.key' is group or others accessible
Fri Jan 31 20:04:27 2014 Static Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Fri Jan 31 20:04:27 2014 Static Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Jan 31 20:04:27 2014 Static Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Fri Jan 31 20:04:27 2014 Static Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Jan 31 20:04:27 2014 Socket Buffers: R=[229376->131072] S=[229376->131072]
Fri Jan 31 20:04:27 2014 TUN/TAP device tun0 opened
Fri Jan 31 20:04:27 2014 TUN/TAP TX queue length set to 100
Fri Jan 31 20:04:27 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Jan 31 20:04:27 2014 /sbin/ifconfig tun0 10.8.0.2 pointopoint 10.8.0.1 mtu 1500
Fri Jan 31 20:04:27 2014 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:4 ET:0 EL:0 ]
Fri Jan 31 20:04:27 2014 Local Options hash (VER=V4): 'd3880969'
Fri Jan 31 20:04:27 2014 Expected Remote Options hash (VER=V4): 'c41bf3b8'
Fri Jan 31 20:04:27 2014 UDPv4 link local (bound): [undef]
Fri Jan 31 20:04:27 2014 UDPv4 link remote: [AF_INET]A.B.C.D:1194
Fri Jan 31 20:04:37 2014 read UDPv4 [ECONNREFUSED]: Connection refused (code=111)

I added a rule to my ufw to allow all incoming traffic to port 1194.

I also added a rule to my router's firewall, to allow all incoming traffic to port 1194.

I use a static IP address 192.168.1.150.

I tried turning off both firewalls to see if that would make it work, but no results.

Is there any reason why my client can't connect to my server? Notice I connect to my public IP address, is this correct? Or should it be something else?

EDIT:

Log of the server (verb 3):

Fri Jan 31 23:01:54 2014 OpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Feb 27 2013
Fri Jan 31 23:01:54 2014 WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail
Fri Jan 31 23:01:54 2014 WARNING: you are using user/group/chroot/setcon without persist-key -- this may cause restarts to fail
Fri Jan 31 23:01:54 2014 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Jan 31 23:01:54 2014 Static Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Fri Jan 31 23:01:54 2014 Static Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Jan 31 23:01:54 2014 Static Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Fri Jan 31 23:01:54 2014 Static Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Jan 31 23:01:54 2014 Socket Buffers: R=[229376->131072] S=[229376->131072]
Fri Jan 31 23:01:54 2014 TUN/TAP device tun0 opened
Fri Jan 31 23:01:54 2014 TUN/TAP TX queue length set to 100
Fri Jan 31 23:01:54 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Jan 31 23:01:54 2014 /sbin/ifconfig tun0 10.8.0.1 pointopoint 10.8.0.2 mtu 1500
Fri Jan 31 23:01:54 2014 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:4 ET:0 EL:0 ]
Fri Jan 31 23:01:54 2014 Local Options hash (VER=V4): 'c41bf3b8'
Fri Jan 31 23:01:54 2014 Expected Remote Options hash (VER=V4): 'd3880969'
Fri Jan 31 23:01:54 2014 GID set to neftas
Fri Jan 31 23:01:54 2014 UID set to neftas
Fri Jan 31 23:01:54 2014 UDPv4 link local (bound): [AF_INET]192.168.1.150:1194
Fri Jan 31 23:01:54 2014 UDPv4 link remote: [undef]
share|improve this question
add comment

1 Answer

ECONNREFUSED means that the port you are trying to connect to is not open on the IP you are trying to connect to. This implies that either you are connecting to the wrong IP, you did not open the port on your firewalls successfully, the server did not launch successfully, or the server is using a different port. Try this:

1) Use "nmap" on the server with hostname of "localhost" to check if the server is running properly in the port you want.

2) Use it on the client with your server's public IP to check if the destination port is open.

It would also help if you post the server log.

share|improve this answer
    
nmap localhost on server and client side is 53/tcp open domain and 631/tcp open ipp –  Neftas Jan 31 at 22:05
    
On the client side it shows 22/tcp filtered ssh, 23/tcp open telnet, 80/tcp open, http443/tcp filtered https, 8081/tcp filtered blackice-icecap. Does this mean my 1194 port is not open? –  Neftas Jan 31 at 22:10
    
By default nmap does not scan UDP ports. Try re-running with the -sU option. –  Tristan Schmelcher Feb 1 at 16:44
    
I'm going to try that when I have access to my system again in a few days. Thanks for the suggestion! :) –  Neftas Feb 3 at 18:11
    
@Neftas any updates? –  Braiam Feb 14 at 2:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.