JustToThePoint English Website Version
JustToThePoint en español
Colaborate with us

Deploying a VPN in Proxmox.

When the world says, ‘Give up,’ hope whispers, ‘Try it one more time’, Lyndon B. Johnson

VPN

VPN. Definition and benefits.

A VPN is an encrypted connection that allows your device to communicate over the internet through a secure server. When connected to a VPN, your internet traffic is routed through a VPN server, effectively masking your device’s IP address and location. By utilizing a VPN, you will gain some benefits:

Preparing the Ubuntu Server Environment

Before configuring Docker and the VPN containers, make sure you have an Ubuntu Server set up (this could be a physical home server, a VM, or an LXC container running Ubuntu), say a container (e.g., 301 Ubuntu-Desktop).

  1. Install Ubuntu Server.
  2. Update and Upgrade Packages.
sudo apt update && sudo apt upgrade -y

Install Docker (the easy way)

Docker allows us to run applications in isolated containers.

sudo apt update  # Update Package List
apt install curl
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Manage Docker as a non-root user
adduser nmaximo7
sudo usermod -aG sudo nmaximo7
su nmaximo7

sudo usermod -aG docker $USER # Add your user to the docker group.
newgrp docker
nmaximo7@ubuntu-desktop:/root$ id
uid=1000(nmaximo7) gid=110(docker) groups=110(docker),27(sudo),100(users),1000(nmaximo7)

Install Portainer

# Create the volume that Portainer Server will use to store its database:
docker volume create portainer_data

# Download and install the Portainer Server container:
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:sts

Now that the installation is complete, you can log into your Portainer Server instance by opening a web browser and going to: [https:] // localhost:9443, e.g., [https:] // 192.168.1.52:9443

# Troubleshooting:
# Your Portainer instance timed out for security purposes. To re-enable your Portainer instance, you will need to restart Portainer.
docker restart portainer

Compose file for the VPN and qbittorrent

version: '3.9'
services:
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 8080:8080 # qbittorrent web interface
      - 6881:6881 # qbittorrent torrent port
      - 6789:6789 # nzbget
      - 9696:9696 # prowlarr
    volumes:
      - /docker/gluetun:/gluetun
    environment:
      - VPN_SERVICE_PROVIDER=airvpn
      - VPN_TYPE=wireguard
      - FIREWALL_VPN_INPUT_PORTS=port
    # - FIREWALL_OUTBOUND_SUBNETS=192.168.0.0/24 # add if prowlarr wont connect to other arr apps, change to your specific subnet
      - WIREGUARD_PRIVATE_KEY=key
      - WIREGUARD_PRESHARED_KEY=key
      - WIREGUARD_ADDRESSES=ip
      - SERVER_COUNTRIES=country
      - SERVER_CITIES=city
      - HEALTH_VPN_DURATION_INITIAL=120s
    healthcheck:
      test: ping -c 1 www.google.com || exit 1
      interval: 60s
      timeout: 20s
      retries: 5
    restart: unless-stopped

# This is a new addition since creating the tutorial video on this stack.
# See the 'qBittorrent Stalls with VPN Timeout' section for more information.
  deunhealth:
    image: qmcgaw/deunhealth
    container_name: deunhealth
    network_mode: "none"
    environment:
      - LOG_LEVEL=info
      - HEALTH_SERVER_ADDRESS=127.0.0.1:9999
      - TZ=America/Los_Angeles
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

# Healthcheck was added to work with deunhealth to restart container
# on unhealthy status. labels allows deunhealth to monitor.
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    restart: unless-stopped
    labels:
      - deunhealth.restart.on.unhealthy= "true"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Los_Angeles
      - WEBUI_PORT=8080
      - TORRENTING_PORT=6881
    volumes:
      - /docker/qbittorrent:/config
      - /data:/data
    network_mode: service:gluetun
    healthcheck:
        test: ping -c 1 www.google.com || exit 1
        interval: 60s
        retries: 3
        start_period: 20s
        timeout: 10s

Biography

  1. 7 Docker Basics for Beginners
  2. Wireguard
  3. TechHutTV’s github, homelab.
  4. TechHutTV’s YouTube, You NEED to setup Gluetun! (Route Your Docker Containers Through a VPN).
Bitcoin donation

JustToThePoint Copyright © 2011 - 2025 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.