I've got a LAN behind OpenVPN client (mikrotik router) which connects to a server, and allows access to the machines inside LAN for every other client that connects to the server. The LAN has its own subnet, other than other clients which connect to this server. I am unable to configure this client to force server to add route, which will properly route traffic for this subnet. Currently I have to manually go to the server and run:
route del -net <client's subnet> netmask 255.255.255.0 gw <old client's ip>
route add -net <client's subnet> netmask 255.255.255.0 gw <new client's ip>
Is there anyway I could change server's settings to make it do that automatically?
Clients' ips are dynamic, and I would prefer to leave it this way. I've tried adding: The open vpn client settings on mikrotik router are quite limited, so there's not much I can do on the client's side, but I hoped there's something I could do on the server side to set the route upon client connection + push this route to other clients connecting. I have actually tried adding
push “route <client's subnet> 255.255.255.0”
on the server, but I still have to manually set the route on other clients. However the most important thing for me, is to set the OpenVPN server [system] route upon client's connection.
It should be
push route [subnet] [subnet mask] [metric]
Example:
If the OpenVPN server's info is:
Then the configuration should be:
push route 10.10.10.0 255.255.255.0 1
This should let your VPN clients add the necessary static routes to access resources behind the VPN. However, you may need to verify your local static routes to make sure local traffic knows how to route to the VPN clients.
The right command is "route NET MASK GW" on the openvpn configuration file. You only use "push" when you want to push routes to the clients.