I am able to connect to the VPN server with the client. But I cannot route anything through the server, it is not a problem with my iptables rules, they are all correct.
Also,
ip_forward is
enabled in /etc/sysctl.conf. The tun0 interface is created, I am using a tunnelled connection.
I am only able to route traffic after the connection is timed out as per the
keepalive 10 120 setting on the server and reinitialized! So in summary it all looks like this:
1. Client connects to the server successfully, this is part of the server log:
Jun 19 14:41:34 openvpn ovpn-server[2184]: 192.168.2.110:53906 TLS: Initial packet from [AF_INET]192.168.2.110:53906, sid=64ffa88b 43a1396d
Jun 19 14:41:34 openvpn ovpn-server[2184]: 192.168.2.110:53906 [myclient] Peer Connection Initiated with [AF_INET]192.168.2.110:53906
Jun 19 14:36:56 openvpn ovpn-server[2184]: myclient/192.168.2.110:59003 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Jun 19 14:36:56 openvpn ovpn-server[2184]: myclient/192.168.2.110:59003 MULTI: Learn: 10.8.0.6 -> myclient/192.168.2.110:59003
Jun 19 14:36:56 openvpn ovpn-server[2184]: myclient/192.168.2.110:59003 MULTI: primary virtual IP for myclient/192.168.2.110:59003: 10.8.0.6
Jun 19 14:36:58 openvpn ovpn-server[2184]: myclient/192.168.2.110:59003 PUSH: Received control message: 'PUSH_REQUEST'
Jun 19 14:41:37 openvpn ovpn-server[2184]: myclient/192.168.2.110:53906 SENT CONTROL [myclient]: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.1,topology net30,ping 10,ping-restart 30,ifconfig 10.8.0.6 10.8.0.5' (status=1)
Jun 19 14:41:37 openvpn ovpn-server[2184]: myclient/192.168.2.110:53906 MULTI: bad source address from client [::], packet dropped
2. However, client is unable to send/ping anything.
3. I wait for the tunnel connection to time out, server log:
Jun 19 14:42:41 openvpn ovpn-server[2184]: myclient/192.168.2.110:53906 [myclient] Inactivity timeout (--ping-restart), restarting
Jun 19 14:42:41 openvpn ovpn-server[2184]: myclient/192.168.2.110:53906 SIGUSR1[soft,ping-restart] received, client-instance restarting
4. At this point, the connection is reinitialized automatically, but now a different client IP is shown! It is the IP of my LAN default gateway.. server log:
Jun 19 14:43:10 openvpn ovpn-server[2184]: [b]192.168.2.1[/b]:51435 TLS: Initial packet from [AF_INET][b]192.168.2.1[/b]:51435, sid=7e49d8f7 3bb42503
[b]Jun 19 14:43:10 openvpn ovpn-server[2184]: 192.168.2.1:51435 [myclient] Peer Connection Initiated with [AF_INET]192.168.2.1:51435[/b]
Jun 19 14:43:10 openvpn ovpn-server[2184]: myclient/192.168.2.1:51435 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Jun 19 14:43:10 openvpn ovpn-server[2184]: myclient/192.168.2.1:51435 MULTI: Learn: 10.8.0.6 -> myclient/192.168.2.1:51435
Jun 19 14:43:10 openvpn ovpn-server[2184]: myclient/192.168.2.1:51435 MULTI: primary virtual IP for myclient/192.168.2.1:51435: 10.8.0.6
Jun 19 14:43:13 openvpn ovpn-server[2184]: myclient/192.168.2.1:51435 PUSH: Received control message: 'PUSH_REQUEST'
Jun 19 14:43:13 openvpn ovpn-server[2184]: myclient/192.168.2.1:51435 send_push_reply(): safe_cap=940
Jun 19 14:43:13 openvpn ovpn-server[2184]: myclient/192.168.2.1:51435 SENT CONTROL [myclient]: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.1,topology net30,ping 10,ping-restart 30,ifconfig 10.8.0.6 10.8.0.5' (status=1)
5. And only now I CAN route/ping through the server. Now the VPN tunnel works. Need help with this, this is strange... why am I only able to use the VPN after the connection times out and reinitializes (with the IP of my LAN default gateway)?