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.

Adding new gateway on a remote host

If you intend to add a new gateway on a different host than the one you've run the one-line install script on, there are some additional steps that need to be performed:

  • make sure that both hosts can securely communicate within an isolated network segment without exposing the core gRPC port to the public internet as described in our general network requirements

  • edit you docker-compose.yaml and add a DEFGUARD_GRPC_URL environment variable to the core service; this should be a URL that a remote gateway is able to connect to as described here

  • after adding the variable restart the core service

  • securely transfer the /ssl/defguard-ca.pem file to the new host

  • depending on your preference create a copy of the docker-compose.yaml on the new host (with just the gateway service) or use the command from web UI to start a new gateway

  • if using the command remember to add the DEFGUARD_GRPC_CA environment variable

Last updated

Was this helpful?