Docker Compose ile Wireguard VPN Server Yapılandırması

Emre Emanet
1 min readNov 18, 2022

Neden ihtiyaç doğdu?

VPN’e ihtiyacınız var ve hızlıca bir VPN server kurmak gerekiyorsa buradaki makaleyi takip ederek hızlıca bir VPN’e servisine sahip olabilirsiniz. Docker yüklü bir sunucuya aşağıdaki docker-compose.yaml dosyasını ekleyip $ docker-compose up -d komutunu vermeniz yeterli.

Compose File Yapılandırması

  • TZ — timezone
  • SERVERURL — this will be set where your client will connect to
  • SERVERPORT — this will be set in your client config (the listen port is hardcoded to 51820)
  • PEERDNS — this is the dns server that will be set in the client config
  • PEERS — this is used to create configs for your clients
  • INTERNAL_SUBNET — this is optional, but this is the subnet the connected clients will use
version: '3.7'
services:
wireguard:
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Istanbul
- SERVERURL=wireguard.example.com
- SERVERPORT=51820
- PEERS=ruan,mobile
- PEERDNS=8.8.8.8
- INTERNAL_SUBNET=10.64.1.0
- ALLOWEDIPS=0.0.0.0/0
volumes:
- ./config/wireguard:/config
- /lib/modules:/lib/modules
ports:
- 51820:51820/udp
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped

Ardıdan mobil cihazınıza Wireguard uygulamasını indirin.

Telefonunuzdan uygulamayı açıp aşağıdaki log çıktısındaki QR kodu taratarak VPN bağlantısını yapabilirsiniz.

$ docker-compose logs -f wireguard

--

--

No responses yet