Page 1 of 1

Set Route to the VPN-Clients Lokal Network when VPN-Client is connected

Posted: Thu Nov 23, 2023 11:26 am
by g0nz000
I would like to set a route when a VPN client connects to the VPN server.

If the client disconnects again then this route must also be removed again

If the route is not removed again, the gateway will otherwise be listed as unknown in the route and when reconnecting the client will receive a different interface id, which is required for the gateway in /ip routes.

Under /PPP/Profiles I have the option of storing a script for the On-Up and On-Down events. Within the events, you can access the interface with the $interface variable.

Since I have many VPN clients, I must have a list/variable that connects the VPN clients and the subnets for the routes.

VpnRoutes [[VPN-000001;192.168.111.0/24];[VPN-000002;192.168.112.0/24];.......]

Unfortunately, the variable for the $interface sometimes results in <ovpn-VPN-000001> or sometimes even *f00001 and cannot be used.

I hope someone has a good idea or even another possibility for me.

My goal is to operate a CloudHostedRouter to which many VPN clients (gateways) log on and I can reach the local networks behind all gateways if I log on as a VPN client myself.

Greetings Dennis

Re: Set Route to the VPN-Clients Lokal Network when VPN-Client is connected

Posted: Thu Nov 23, 2023 4:05 pm
by tdw
See the routes property description in https://help.mikrotik.com/docs/display/ ... erDatabase

Re: Set Route to the VPN-Clients Lokal Network when VPN-Client is connected

Posted: Mon Nov 27, 2023 10:09 am
by g0nz000
thank you very much this option is of course much more elegant.

Under Secrets you can enter routes that are entered when connecting and also deleted again when logging off. The documentation says: "This parameter will be ignored for OpenVPN". but it also works with openVPN