0

setup Openvpn

Server ip 192.168.70.22 tun0 - 10.8.0.1

Client1 ip 192.168.1.3 tun0 - 10.8.0.6

Client2 ip 192.168.30.44 tun0 - 10.8.0.10

ping tun0 works

ping server from client1 and client2 works vice versa

also IP address ping server ip from client1 and client2 works

But

ping client1 from client2 and server not working

ping client2 from client1 and server not working

  • Does server have ipv4 forwarding on? Do clients know routes to other clients? – Krzysztof Sawicki Jun 11 '18 at 10:44
  • yes, ipv4 forwarding is enabled. – Vinoth Rc Jun 13 '18 at 5:07
  • And what is the answer for the second question of mine? – Krzysztof Sawicki Jun 13 '18 at 6:03
  • I didn't done the second one – Vinoth Rc Jun 13 '18 at 10:43
1
The result of route -n (**server**)
Kernel IP routing table  
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  
0.0.0.0         192.168.5.1     0.0.0.0         UG    0      0        0 eth0  
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0  
10.15.0.0       0.0.0.0         255.255.0.0     U     0      0        0 eth0  
192.168.1.0     10.8.0.2        255.255.255.0   UG    0      0        0 tun0  
192.168.2.0     10.8.0.2        255.255.255.0   UG    0      0        0 tun0  
192.168.2.0     0.0.0.0         255.255.254.0   U     0      0        0 eth0  
192.168.5.0     0.0.0.0         255.255.254.0   U     0      0        0 eth0   
192.168.5.66    0.0.0.0         255.255.240.0   U     0      0        0 eth0  

The result of route -n (**client1**)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.8.0.1        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 enp0s3
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
128.0.0.0       10.8.0.1        128.0.0.0       UG    0      0        0 tun0
192.168.1.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 enp0s3
192.168.5.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.5.66    192.168.2.1     255.255.255.255 UGH   0      0        0 enp0s3

The result of route -n (**client2**)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.8.0.1        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlp4s0
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
128.0.0.0       10.8.0.1        128.0.0.0       UG    0      0        0 tun0
192.168.1.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlp4s0
192.168.2.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.5.0     10.8.0.1        255.255.255.0   UG    0      0        0 tun0
192.168.5.66    192.168.1.1     255.255.255.255 UGH   0      0        0 wlp4s0
| improve this answer | |
  • And the second client? – Krzysztof Sawicki Jun 16 '18 at 8:17
  • The second client in above answer – Vinoth Rc Jun 19 '18 at 12:32
0

Assuming you have already enabled ipv4 forwarding, you have also:

  1. Inform your clients that VPN server is also a gateway to other VPN clients. You can achieve this by adding this line to your server configuration file:

push "route 10.8.0.0 255.255.255.0"

  1. Check if your firewall on VPN server allows forwarding packets:

sudo iptables -A FORWARD -s 10.8.0.0/24 -d 10.8.0.0/24 -j ACCEPT

If you can't ping clients from VPN server, maybe your clients just do not answer for pings? What os is on your clients?

| improve this answer | |
  • ping 10.8.0.4 PING 10.8.0.4 (10.8.0.4) 56(84) bytes of data. 64 bytes from 10.8.0.4: icmp_seq=1 ttl=64 time=65.3 ms 64 bytes from 10.8.0.4: icmp_seq=2 ttl=64 time=87.8 ms 64 bytes from 10.8.0.4: icmp_seq=3 ttl=64 time=44.2 ms – Vinoth Rc Jun 16 '18 at 6:39
  • Could you please describe your comment? It doesn't tell much if you just paste result of some command. – Krzysztof Sawicki Jun 16 '18 at 6:47
  • 1. Both clients and server are ubuntu 16.04 2. Ping from server using tun0 is working ping client-1 from server (10.8.0.1) user@server:~$ ping 10.8.0.4 PING 10.8.0.4 (10.8.0.4) 56(84) bytes of data. 64 bytes from 10.8.0.4: icmp_seq=1 ttl=64 time=65.3 ms ^C ping client-2 from server (10.8.0.1) user@server:~$ ping 10.8.0.8 PING 10.8.0.8 (10.8.0.8) 56(84) bytes of data. 64 bytes from 10.8.0.8: icmp_seq=1 ttl=64 time=39.8 ms ^C – Vinoth Rc Jun 16 '18 at 6:48
  • 3.but using eth0 not working **ping client-1 from server (192.168.5.66) ** user@server:~$ ping 192.168.1.4 PING 192.168.1.4 (192.168.1.4) 56(84) bytes of data. ^C **ping client-2 from server (192.168.5.66) ** user@server:~$ ping 192.168.2.100 PING 192.168.2.100 (192.168.2.100) 56(84) bytes of data. ^C – Vinoth Rc Jun 16 '18 at 6:49
  • 1
    Paste result of command route -n from both clients into the text of your question (not in comment). – Krzysztof Sawicki Jun 16 '18 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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