Importing route list from separate file on macOS

Scripts to manage certificates or generate config files
Post Reply
toddritt
OpenVpn Newbie
Posts: 3
Joined: Thu Sep 09, 2021 7:24 pm

Importing route list from separate file on macOS

Post by toddritt » Thu Sep 09, 2021 7:28 pm

Hello, I have a working OpenVPN client/server setup. We have the need to have a long list of routes added to the client when the VPN is established so we can split tunnel. I have this working perfectly on Windows clients by using the following line in the client config file:

Code: Select all

#include split tunnel route list
config "C:\\Users\\<snipped>\\VPN\\splittunnellist"
The splittunnelist file looks something like (just with many more routes):

Code: Select all

route-nopull
route 10.250.0.0 255.255.255.0 vpn_gateway
route 10.10.10.0 255.255.255.0 vpn_gateway
The problem is, on our macOS clients, I do not know how to get the route list imported. I have confirmed if I manually add the following to the Mac client config that it adds the route, but the point of having a separate file is so that we have one central place to maintain the list of routes we need for all clients:

Code: Select all

route-nopull
route 10.250.0.0 255.255.255.0 vpn_gateway
route 10.10.10.0 255.255.255.0 vpn_gateway

So is it possible to do the same thing we do on Windows using the config directive to import more lines on the macOS clients? Thank you!

300000
OpenVPN Expert
Posts: 613
Joined: Tue May 01, 2012 9:30 pm

Re: Importing route list from separate file on macOS

Post by 300000 » Fri Sep 10, 2021 5:11 pm

yes you can do that , you can push route from server to client so it can be done .

On openvpn server folder create a folder called CDD , now check the certificate name of Mac client and create a file name with that . assume mac certificate name is MacClient so create a file MacClient and open it then add this line into

push " route 10.250.0.0 255.255.255.0 vpn_gateway "
push " route 10.10.10.0 255.255.255.0 vpn_gateway "

you can push as many route as you like and it only apply to mac client when connect to server . make sure name of certificate is very important. server will only push route if correct name on certificate or it will not work. just try it yourself and come back here if you got more trouble.

toddritt
OpenVpn Newbie
Posts: 3
Joined: Thu Sep 09, 2021 7:24 pm

Re: Importing route list from separate file on macOS

Post by toddritt » Mon Sep 13, 2021 12:49 pm

Thank you, however we need our team to all be able to add new routes and not everyone on our team has access to the OpenVPN server. So I am trying to use the client-side method we are using successfully with Windows (by importing an additional config file on a shared directory that everyone can update). I do not how to get that to work on a Mac though...it's either not supported or I'm not entering the file path correctly since it works perfectly on Windows.

Thank you for any assistance you can provide!

300000
OpenVPN Expert
Posts: 613
Joined: Tue May 01, 2012 9:30 pm

Re: Importing route list from separate file on macOS

Post by 300000 » Mon Sep 13, 2021 1:22 pm

It is more simple to do it from client . Whatever route you want to do is add direct into client config as follow.open client config and add into it.

route 10.250.0.0 255.255.255.0 vpn_gateway
route 10.10.10.0 255.255.255.0 vpn_gateway

Just add route line as many as you like and that will work for client.

toddritt
OpenVpn Newbie
Posts: 3
Joined: Thu Sep 09, 2021 7:24 pm

Re: Importing route list from separate file on macOS

Post by toddritt » Mon Sep 13, 2021 4:13 pm

I understand how to do that, but I want to separate out the routes since we have so many and they change frequently. For Windows clients, you can see in my client config that I am able to use a line called "config <path to file containing routes>". I am asking if I can do the same for macOS clients...how to separate out the list of routes for the client config to read? It works on Windows clients, but I don't know how to do the same on Mac.

Thanks

Post Reply