2

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.

1
  • I wonder if the server likes the "smart" quotes in your push line?
    – mwfearnley
    May 26, 2020 at 11:25

2 Answers 2

1

It should be push route [subnet] [subnet mask] [metric]

Example:

If the OpenVPN server's info is:

Server IP: 10.10.10.254
Subnet: 255.255.255.0
Gateway: 10.10.10.1

OpenVPN IP: 10.10.11.1
Subnet: 255.255.255.0

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.

2
  • CIA thanks for your answer. However, do you know how to set it on server when the client connects? That's the main question I've asked.
    – Krystian
    Jul 6, 2015 at 19:45
  • It's in the OpenVPN config. There's a line that specifically say push route that's commented out by default.
    – CIA
    Jul 6, 2015 at 21:56
0

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.

1
  • 1
    An example would be a great addition to this answer. Jun 9, 2017 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .