How to add route outside vpn

routeubuntu-18.04

I have a VPS running a ubuntu 18.04
I have setup pritunl server.

On this VPS I have as well 2 clients from others VPN.

netstat -rn

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         93.XXX.96.1     0.0.0.0         UG        0 0          0 ens3
10.29.0.0       0.0.0.0         255.255.255.0   U         0 0          0 tun1
93.XXX.96.0     0.0.0.0         255.255.255.0   U         0 0          0 ens3
192.168.58.0    0.0.0.0         255.255.255.0   U         0 0          0 tun2
192.168.60.0    0.0.0.0         255.255.255.0   U         0 0          0 tun3

When I use a vpn client from this vpn server (client 192.168.58.X) I can't ping 10.29.0.XXX

How can I do, when I have a vpn client (from 192.168.58.X) ping others subnet Ip's? like 10.29.0.XXX or 192.168.60.X

Best Answer

You should add the routes on the vpn client side to these additional networks via your vpn server. Because the pritunl is an addon over openvpn, you can use the openvpn mechanics to push the routes to client side. Something like that:

push "route 10.29.0.0 255.255.255.0"
push "route 192.168.58.0 255.255.255.0"
push "route 192.168.60.0 255.255.255.0"

Consult the pritunl documentation about the way to do it.

Also you can add corresponded routes manually on the client side without edit of the server configuration. Use the ip route command on the linux client hosts and route in other OS.

If you use the openvpn on the client hosts, you can edit the openvpn configuration file to add the routes after the vpn tunnel brings up.

route 10.20.0.0 255.255.255.0
route 192.168.58.0 255.255.255.0
route 192.168.60.0 255.255.255.0