Replicated Servers

Replicate Pritunl servers for load balancing and high availability

This tutorial will describe creating a replicated configuration with two Pritunl servers. The diagram below shows the network topology for this tutorial. Replication involves sharing a single virtual VPN network across multiple hosts, this is done with a combination of VXLans and routing. Replicated servers will need to open VXLan UDP port 4789 between servers to allow client-to-client traffic to function.


MongoDB Server

Both Pritunl servers will need to be able to access the same database server. This is used for inter-server communication. Services such as MongoDB Atlas can be used to easily deploy a reliable replicated MongoDB cluster. When configuring a self hosted MongoDB cluster the instructions in Securing MongoDB should be followed to enable authentication and SSL on the MongoDB cluster.

Initial Setup

After a MongoDB cluster has been deployed all the Pritunl servers must be configured to connect to the same MongoDB cluster. If a Pritunl server has already configured the MongoDB uri it can be reconfigured by running the command pritunl reconfigure followed by restarting the Pritunl service.


Configure Server

First configure a VPN server that will be replicated. The Pritunl hosts should all be on the same local network for replication. Then attach the hosts to the server.


Once the hosts have been attached increase the Replication Count in the advanced server settings. The server configuration should look similar to the example below with multiple hosts listed. When the server is started both hosts will come online and users will randomly connect to one of the hosts.