OpenVPN just keep reconnecting to the server

August 8, 2017 2.8k views
VPN Ubuntu 16.04

Hi, i have followed every step in these instructors How To Set Up an OpenVPN Server on Ubuntu 16.04:

but when i try to connect to my VPN it just keep reconnecting over and over

those are the log shown after i discoonnect :

Wed Aug 09 00:52:10 2017 OpenVPN 2.4.3 x8664-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Jul 14 2017
Wed Aug 09 00:52:10 2017 Windows version 6.2 (Windows 8 or greater) 64bit
Wed Aug 09 00:52:10 2017 library versions: OpenSSL 1.0.2l 25 May 2017, LZO 2.10
Enter Management Password:
Wed Aug 09 00:52:10 2017 MANAGEMENT: TCP Socket listening on [AF
INET]127.0.0.1:25340
Wed Aug 09 00:52:10 2017 Need hold release from management interface, waiting...
Wed Aug 09 00:52:10 2017 MANAGEMENT: Client connected from [AFINET]127.0.0.1:25340
Wed Aug 09 00:52:10 2017 MANAGEMENT: CMD 'state on'
Wed Aug 09 00:52:10 2017 MANAGEMENT: CMD 'log all on'
Wed Aug 09 00:52:10 2017 MANAGEMENT: CMD 'echo all on'
Wed Aug 09 00:52:10 2017 MANAGEMENT: CMD 'hold off'
Wed Aug 09 00:52:10 2017 MANAGEMENT: CMD 'hold release'
Wed Aug 09 00:52:11 2017 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Wed Aug 09 00:52:11 2017 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Wed Aug 09 00:52:11 2017 TCP/UDP: Preserving recently used remote address: [AF
INET]207.154.201.195:80
Wed Aug 09 00:52:11 2017 Socket Buffers: R=[65536->65536] S=[65536->65536]
Wed Aug 09 00:52:11 2017 Attempting to establish TCP connection with [AFINET]207.154.201.195:80 [nonblock]
Wed Aug 09 00:52:11 2017 MANAGEMENT: >STATE:1502229131,TCP
CONNECT,,,,,,
Wed Aug 09 00:52:12 2017 TCP connection established with [AFINET]207.154.201.195:80
Wed Aug 09 00:52:12 2017 TCP
CLIENT link local: (not bound)
Wed Aug 09 00:52:12 2017 TCPCLIENT link remote: [AFINET]207.154.201.195:80
Wed Aug 09 00:52:12 2017 MANAGEMENT: >STATE:1502229132,WAIT,,,,,,
Wed Aug 09 00:52:12 2017 Connection reset, restarting [0]
Wed Aug 09 00:52:12 2017 SIGUSR1[soft,connection-reset] received, process restarting
Wed Aug 09 00:52:12 2017 MANAGEMENT: >STATE:1502229132,RECONNECTING,connection-reset,,,,,
Wed Aug 09 00:52:12 2017 Restart pause, 5 second(s)
Wed Aug 09 00:52:17 2017 TCP/UDP: Preserving recently used remote address: [AFINET]207.154.201.195:80
Wed Aug 09 00:52:17 2017 Socket Buffers: R=[65536->65536] S=[65536->65536]
Wed Aug 09 00:52:17 2017 Attempting to establish TCP connection with [AF
INET]207.154.201.195:80 [nonblock]
Wed Aug 09 00:52:17 2017 MANAGEMENT: >STATE:1502229137,TCPCONNECT,,,,,,
Wed Aug 09 00:52:18 2017 TCP connection established with [AF
INET]207.154.201.195:80
Wed Aug 09 00:52:18 2017 TCPCLIENT link local: (not bound)
Wed Aug 09 00:52:18 2017 TCP
CLIENT link remote: [AFINET]207.154.201.195:80
Wed Aug 09 00:52:18 2017 MANAGEMENT: >STATE:1502229138,WAIT,,,,,,
Wed Aug 09 00:52:18 2017 Connection reset, restarting [0]
Wed Aug 09 00:52:18 2017 SIGUSR1[soft,connection-reset] received, process restarting
Wed Aug 09 00:52:18 2017 MANAGEMENT: >STATE:1502229138,RECONNECTING,connection-reset,,,,,
Wed Aug 09 00:52:18 2017 Restart pause, 5 second(s)
Wed Aug 09 00:52:20 2017 SIGTERM[hard,init
instance] received, process exiting
Wed Aug 09 00:52:20 2017 MANAGEMENT: >STATE:1502229140,EXITING,init_instance,,,,,

1 Answer

Looking at the error log:

Wed Aug 09 00:52:18 2017 TCP connection established with [AFINET]207.154.201.195:80
Wed Aug 09 00:52:18 2017 TCPCLIENT link local: (not bound)
Wed Aug 09 00:52:18 2017 TCPCLIENT link remote: [AFINET]207.154.201.195:80
Wed Aug 09 00:52:18 2017 MANAGEMENT: >STATE:1502229138,WAIT,,,,,,
Wed Aug 09 00:52:18 2017 Connection reset, restarting [0]

It looks like OpenVPN is trying to connect to port 80 but the connection is being actively rejected by the server. Usually this happens if you have a firewall installed and also have port 80 blocked, or if you do not but also do not have any programs listening on port 80.

By default, OpenVPN listens on port 1194 over the UDP protocol. Try configuring your client to connect to that port. To verify which port OpenVPN is listening on and what protocol it is using, run:

sudo netstat -plutn

Look for the line containing openvpn. It should list the protocol and port number, as well as other information.

Have another answer? Share your knowledge.