defguard
  • Introduction
  • User documentation (help)
    • Configuring VPN
      • Defguard Desktop Client
        • Update instance
      • Other WireGuard® Clients
        • Configuring a device for new VPN Location manually
    • Password change / Reset
    • Enrollment & Onboarding
      • With internal Defguard SSO
      • With external SSO (Google/Microsoft/Custom)
    • Setting up 2FA/MFA
    • Desktop Client
    • CLI Client
  • Admin & features
    • Deploying your instance
      • One-line install script
      • Standalone package based installation
      • Docker images and tags
      • Docker Compose
      • Kubernetes
      • Upgrading
      • Gateway
        • Running gateway on MikroTik routers
      • Securing gRPC communication
      • OpenID RSA key
      • Configuration
      • Pre-production and development releases
      • High Availability and Failover
      • Health check
    • Features & configuration
      • Zero-Trust VPN with 2FA/MFA
        • Create/manage VPN Location
        • Network overview
        • Executing custom gateway commands
        • Multi-Factor Authentication (MFA/2FA)
          • MFA Architecture
        • Remote desktop client configuration
        • DNS and domains
      • Remote user enrollment
        • User onboarding after enrollment
      • SSO (OpenID Connect)
        • Portainer
        • Grafana setup
        • Proxmox
        • Matrix / Synapse
        • Django
        • MinIO
        • Vault
      • SMTP for email notifications
      • YubiKey Provisioning
      • Webhooks
      • Forward auth
      • SSH Authentication
      • Network devices
      • Gateway notifications
      • New version notifications
  • Troubleshooting Guide
    • Sending support information
    • Client Windows installer exit codes
    • Client "All traffic" connection issues
    • WebAuthn security keys
  • Enterprise Features
    • License
    • Enteprise features
      • Automatic (real time) desktop client configuration & sync
      • External OpenID providers
        • Google
        • Microsoft
        • Zitadel
        • Keycloak
        • JumpCloud
        • Okta
        • Custom
      • External OIDC secure enrollment
      • VPN & Client behavior customization
      • REST API
      • Access Control List
        • ACL Aliases
      • LDAP and Active Directory integration
        • Configuration
        • Settings table
        • Two-way LDAP and Active Directory synchronization
  • Tutorials
    • Step by step setting up a VPN server
      • Adding additional VPN locations
  • In depth
    • Roadmap
    • Architecture
      • How do VPN statistics work
      • Security concepts
  • For Developers
    • Contributing
    • Environment setup
    • Translations (core/web)
      • Switching language
      • Adding translations
  • Translations (client)
    • Adding translations
  • Contact us
    • Community & Support
Powered by GitBook
On this page
  • Adding a new Location
  • Adding new gateway in docker

Was this helpful?

Edit on GitHub
  1. Tutorials
  2. Step by step setting up a VPN server

Adding additional VPN locations

PreviousStep by step setting up a VPN serverNextRoadmap

Last updated 29 days ago

Was this helpful?

If you have used our one-line install setup (for example ) 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.

Without specified DNS field desktop client may be unable to use "All traffic" connection for the location.

Remeber that the:

  • VPN IP address needs to be different then in the first location

  • Gateway address should be the same (same public IP)

  • Gateway port must be different - and remember that gateway port must be open on firewall (this is the new VPN location WireGuard port)

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"]

If you will not add the command line, both gateways will use by default the wg0 and both will not work.

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.

described in this tutorial