Your setup may not have changed but a lot of other things have .. including:
Picasso wrote:
so I decided to start from scratch. I Installed a new VPS (Ubuntu 14.04 x64) and reinstalled OpenVPN
Fairly serious changes ..
I did indeed start over, but after reinstalling, my connection did work. My concern is that a few days later (I did not use the server in the meantime) the connection no longer worked. And I got no error messages or warnings whatsoever.
My client config:
client
dev tun
proto udp
remote {Server Name} 1195
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
comp-lzo
verb 4
My server config:
port 1195
proto udp
dev tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh1024.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"
#push "route 192.168.0.0 255.255.255.0"
keepalive 5 30
comp-lzo
persist-key
persist-tun
log-append openvpn.log
verb 4
I do not think the problem is in my config files, because I do get the "Connection successful" message, and my client is assigned an IP address (10.8.0.6 in my case).
For some reason my log entries on the server come in the syslog file (and not openvpn.log), I guess thats an configuration issue.
Jul 28 21:38:57 HOSTNAME ovpn-server[1133]: 178.116.25.209:53497 [client] Peer Connection Initiated with [AF_INET]178.116.25.209:53497
Jul 28 21:38:57 HOSTNAME ovpn-server[1133]: client/178.116.25.209:53497 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Jul 28 21:38:59 HOSTNAME ovpn-server[1133]: client/178.116.25.209:53497 send_push_reply(): safe_cap=940
Jul 28 21:39:01 HOSTNAME CRON[3773]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Jul 28 21:40:01 HOSTNAME CRON[3857]: (root) CMD (/etc/webmin/status/monitor.pl)
Jul 28 21:40:03 HOSTNAME ovpn-server[1133]: client/178.116.25.209:53497 [client] Inactivity timeout (--ping-restart), restarting
Jul 28 21:45:01 HOSTNAME CRON[4029]: (root) CMD (/etc/webmin/status/monitor.pl)
Jul 28 21:46:13 HOSTNAME ovpn-server[1133]: 178.116.25.209:59325 [client] Peer Connection Initiated with [AF_INET]178.116.25.209:59325
Jul 28 21:46:13 HOSTNAME ovpn-server[1133]: client/178.116.25.209:59325 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Jul 28 21:46:15 HOSTNAME ovpn-server[1133]: client/178.116.25.209:59325 send_push_reply(): safe_cap=940
Jul 28 21:47:20 HOSTNAME ovpn-server[1133]: client/178.116.25.209:59325 [client] Inactivity timeout (--ping-restart), restarting
Log files on the client
Sun Jul 28 21:39:44 2014 MANAGEMENT: >STATE:1406478764,WAIT,,,
Sun Jul 28 21:40:14 2014 [UNDEF] Inactivity timeout (--ping-restart), restarting
Sun Jul 28 21:40:14 2014 TCP/UDP: Closing socket
Sun Jul 28 21:40:14 2014 SIGUSR1[soft,ping-restart] received, process restarting
Sun Jul 28 21:40:14 2014 MANAGEMENT: >STATE:1406478794,RECONNECTING,ping-restart,,
Sun Jul 28 21:40:14 2014 Restart pause, 2 second(s)
Sun Jul 28 21:40:16 2014 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Sun Jul 28 21:40:16 2014 Re-using SSL/TLS context
Sun Jul 28 21:40:16 2014 LZO compression initialized
Sun Jul 28 21:40:16 2014 Control Channel MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Sun Jul 28 21:40:16 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
Sun Jul 28 21:40:16 2014 MANAGEMENT: >STATE:1406478796,RESOLVE,,,
Sun Jul 28 21:40:16 2014 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
Sun Jul 28 21:40:16 2014 Local Options String: 'V4,dev-type tun,link-mtu 1542,tun-mtu 1500,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Sun Jul 28 21:40:16 2014 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1542,tun-mtu 1500,proto UDPv4,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Sun Jul 28 21:40:16 2014 Local Options hash (VER=V4): '41690919'
Sun Jul 28 21:40:16 2014 Expected Remote Options hash (VER=V4): '530fdded'
Sun Jul 28 21:40:16 2014 UDPv4 link local: [undef]
Sun Jul 28 21:40:16 2014 UDPv4 link remote: [AF_INET]188.226.186.27:1195
Sun Jul 28 21:40:16 2014 MANAGEMENT: >STATE:1406478796,WAIT,,,
Firewall on the server
# Generated by iptables-save v1.4.21 on Tue Jul 29 11:42:01 2014
*nat
:PREROUTING ACCEPT [1:848]
:INPUT ACCEPT [1:848]
:OUTPUT ACCEPT [4:492]
:POSTROUTING ACCEPT [4:492]
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
COMMIT
# Completed on Tue Jul 29 11:42:01 2014
# Generated by iptables-save v1.4.21 on Tue Jul 29 11:42:01 2014
*mangle
:PREROUTING ACCEPT [33:4236]
:INPUT ACCEPT [33:4236]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [28:3272]
:POSTROUTING ACCEPT [28:3272]
COMMIT
# Completed on Tue Jul 29 11:42:01 2014
# Generated by iptables-save v1.4.21 on Tue Jul 29 11:42:01 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [28:3272]
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 587 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p udp -m udp --dport 1195 -j ACCEPT
-A FORWARD -s 10.8.0.0/24 -o eth0 -j ACCEPT
-A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
COMMIT
# Completed on Tue Jul 29 11:42:01 2014
I have shutdown the firewall on the client while connecting, to confirm that this was not the issue.
Check if the packet forwarding is activated on your server
I'm guessing by that you mean the last lines in the firewall? Or am I missing something?
I've also been looking to the routing tables, because somehow I thought that might be the problem, but I cant seem to find anything wrong with them.
Routing table on server:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 188.226.186.1 0.0.0.0 UG 0 0 0 eth0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
188.226.186.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Routing table on client (while connected to the server):
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.135 25
0.0.0.0 128.0.0.0 10.8.0.5 10.8.0.6 30
10.8.0.1 255.255.255.255 10.8.0.5 10.8.0.6 30
10.8.0.4 255.255.255.252 On-link 10.8.0.6 286
10.8.0.6 255.255.255.255 On-link 10.8.0.6 286
10.8.0.7 255.255.255.255 On-link 10.8.0.6 286
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
128.0.0.0 128.0.0.0 10.8.0.5 10.8.0.6 30
188.226.186.27 255.255.255.255 192.168.0.1 192.168.0.135 25
192.168.0.0 255.255.255.0 On-link 192.168.0.135 281
192.168.0.1 255.255.255.255 192.168.0.1 192.168.0.135 25
192.168.0.135 255.255.255.255 On-link 192.168.0.135 281
192.168.0.255 255.255.255.255 On-link 192.168.0.135 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 10.8.0.6 286
224.0.0.0 240.0.0.0 On-link 192.168.0.135 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 10.8.0.6 286
255.255.255.255 255.255.255.255 On-link 192.168.0.135 281
===========================================================================
Persistent Routes:
None
Thanks for the replies!