Adding additional VPN locations

If you have used our one-line install setup (for example described in this tutorial) one VPN location (one gateway instance) is done automatically.

There is often a need to launch additional locations (e.g. to separate groups of users or clients), to do this you need to add another location (and launch another gateway controlling this location).

Here is a step-by-step way to do so:

Adding a new Location

In Defguard interface in VPN Location please click: Edit location settings (button in the top right corner):

Then Add new location and configure the new VPN location.

After configuring the location, please:

  • copy the gateway token

  • and note that the gateway is disconnected

Adding new gateway in docker

Now go to the server and open the docker-compose.yml file, and scroll to the gateway section, it should look like this:

Now copy the whole gateway section and:

  • name it in a uniqe way, eg. gateway-customer2

  • in the enviroment variable DEFGUARD_TOKEN: add the token you have copied from the new location

  • add the following line below the image - to change the second gateway WireGuard interface:

    command: ["-i", "wg1"]

The configuration should like so:

Now you need to launch the new gateway, just by the following command:

docker compose up -d gateway-customer2

Now if you go back to the location settings you will see instantly that the new gateway has connected for that location:

And that's it, you have a new VPN location ready.

Last updated

Was this helpful?