3

Preliminary question: where is stored the default server which is used by the command systemctl start openvpn (assume sudo, of course)? It should be in /etc/default/openvpn, like it used to be for SysV, but if I change it systemctl still connects openvpn to the old server.

Now for the main question.

According to Using OpenVpn with systemd and also Correct way of systemd for Openvpn (and other sources) if I have two different servers for my vpn (say, London and Paris) then I need the two config files /etc/openvpn/London.conf and /etc/openvpn/Paris.conf so that I can start the server of my choice with systemctl start openvpn@London or systemctl start openvpn@Paris.

Ok, this works.

Now assume I have two different vpn providers (P1 and P2), both with a server in London and one in Paris. One way to set the config files could be

/etc/openvpn/P1_London.conf

/etc/openvpn/P1_Paris.conf

/etc/openvpn/P2_London.conf

/etc/openvpn/P2_Paris.conf

and then I should start openvpn accordingly.

What I would like to do, instead, is to have the conf files in separate directories, one for each provider:

/etc/openvpn/P1/London.conf

/etc/openvpn/P1/Paris.conf

/etc/openvpn/P2/London.conf

/etc/openvpn/P2/Paris.conf

If I do like that and then I try to start systemctl start openvpn@P1/London or any other variant for other servers, I get an error.

The question is: how can I get what I want?

1
  • As for the preliminary question, I discovered that to have systemctl realize that I made a change in the config file I need to launch the command systemctl daemon-reload. The main question, instaed, is still open to me.
    – brad
    Jun 15, 2017 at 14:23

1 Answer 1

0

I achieve this by creating folders for every server that I want to create under /etc/openvpn/server/.

In those directories, I keep the ccd dir, the ipp.txt file and the secrets.

Only the config for each service goes to /etc/openvpn/server/foo.conf and then references the config items in the subdir. E.g.

ifconfig-pool-persist foo/ipp.txt

The service would then be started with systemctl start openvpn@foo.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.