I have setup OpenVPN client and server between two VPS. I have a client and server setup, server using 10.8.0.1
and 10.8.0.2
IPs in tun interface, and client using 10.8.0.6
and 10.8.0.5
in tun interface. (vps1 is the client and vps2 is the server.) The client can ping server tun IP 10.8.0.1
but not any other IPs. From the server I'm not able to ping to any of the tun IPs or client tun IPs.
server conf:
port 1194proto udpdev tun0ca ca.crtcert server.crtkey server.keytls-serverdh dh2048.pemserver 10.8.0.0 255.255.255.0ifconfig-pool-persist ipp.txtkeepalive 10 120comp-lzouser nobodygroup nobodypersist-keypersist-tunverb 3
client conf:
clientdev tunproto udpremote 198.168.XXX 1194nobindtun-mtu 1500persist-keypersist-tunkeepalive 14 120ca ca.crtcert client.crtkey client.keycomp-lzoverb 3
As per the logs connection is setup successfully,
Jun 9 13:25:28 vps2 openvpn[6484]: MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)Jun 9 13:25:28 vps2 openvpn[6484]: MULTI: Learn: 10.8.0.6 -> vps1.xxx/xxxxx:33012Jun 9 13:25:28 vps2 openvpn[6484]: MULTI: primary virtual IP for vps1.xxx/xxxxx:33012: 10.8.0.6Jun 9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 PUSH: Received control message: 'PUSH_REQUEST'Jun 9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 send_push_reply(): safe_cap=940Jun 9 13:25:30 vps2 openvpn[6484]: vps1.xxx/xxxxx:33012 SENT CONTROL [vps1.xxx]: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5' (status=1)
And tunnels are established at both ends:
Server
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:28 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:420 (420.0 b) TX bytes:1968 (1.9 KiB)
Client
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.8.0.6 P-t-P:10.8.0.5 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
The client also able to ping and ssh to server via the gateway IP
root@vps1:~# ping 10.8.0.1PING 10.8.0.1 (10.8.0.1) 56(84) bytes of data.64 bytes from 10.8.0.1: icmp_seq=1 ttl=64 time=72.6 ms64 bytes from 10.8.0.1: icmp_seq=2 ttl=64 time=72.6 ms64 bytes from 10.8.0.1: icmp_seq=3 ttl=64 time=72.7 ms^C--- 10.8.0.1 ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2002msrtt min/avg/max/mdev = 72.666/72.691/72.726/0.221 msroot@vps1:~# ssh 10.8.0.1root@10.8.0.1's password:
But not able to ping the opnevpn ip's from server and client.
root@vps1:~# ping 10.8.0.2PING 10.8.0.2 (10.8.0.2) 56(84) bytes of data.^C--- 10.8.0.2 ping statistics ---3 packets transmitted, 0 received, 100% packet loss, time 2000msroot@vps1:~# ping 10.8.0.5PING 10.8.0.5 (10.8.0.5) 56(84) bytes of data.