Community discussions

MikroTik App
 
g0nz000
just joined
Topic Author
Posts: 6
Joined: Thu Nov 23, 2023 11:07 am

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

Thu Nov 23, 2023 11:26 am

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
 
tdw
Forum Guru
Forum Guru
Posts: 1855
Joined: Sat May 05, 2018 11:55 am

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

Thu Nov 23, 2023 4:05 pm

See the routes property description in https://help.mikrotik.com/docs/display/ ... erDatabase
 
g0nz000
just joined
Topic Author
Posts: 6
Joined: Thu Nov 23, 2023 11:07 am

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

Mon Nov 27, 2023 10:09 am

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

Who is online

Users browsing this forum: No registered users and 12 guests