<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mateusz (6vz)</title>
    <description>The latest articles on DEV Community by Mateusz (6vz) (@6vz).</description>
    <link>https://dev.to/6vz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F807266%2Fab9e5154-d28f-43ae-b88a-1859262dd93e.png</url>
      <title>DEV Community: Mateusz (6vz)</title>
      <link>https://dev.to/6vz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/6vz"/>
    <language>en</language>
    <item>
      <title>How to set up Wireguard on VPS (using Docker)</title>
      <dc:creator>Mateusz (6vz)</dc:creator>
      <pubDate>Tue, 01 Feb 2022 08:32:42 +0000</pubDate>
      <link>https://dev.to/6vz/how-to-set-up-wireguard-on-vps-using-docker-p7d</link>
      <guid>https://dev.to/6vz/how-to-set-up-wireguard-on-vps-using-docker-p7d</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You can very easily set up a Wireguard server, using docker (for docker-compose accuracy) on your Linux server. This option may also work on Windows, however I am not testing it&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Linux Server (with root access)&lt;/li&gt;
&lt;li&gt;Ability to open ports&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/engine/install"&gt;&lt;code&gt;docker&lt;/code&gt;&lt;/a&gt; &amp;amp; &lt;a href="https://docs.docker.com/compose/install/"&gt;&lt;code&gt;docker-compose&lt;/code&gt;&lt;/a&gt; installed&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Before you start...
&lt;/h2&gt;

&lt;p&gt;Please open ports &lt;code&gt;51820&lt;/code&gt; (UDP), otherwise it won't work&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation process
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Enter these two commands, they will create required directories
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p ~/wireguard/
mkdir -p ~/wireguard/config/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;nano ~/wireguard/docker-compose.yml&lt;/code&gt; and paste below-mentioned content into the &lt;code&gt;docker-compose.yml&lt;/code&gt; file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: '3.8'
services:
  wireguard:
    container_name: wireguard
    image: linuxserver/wireguard
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Warsaw
      - SERVERURL=00.00.00.00
      - SERVERPORT=51820
      - PEERS=10
      - PEERDNS=auto
      - INTERNAL_SUBNET=10.0.0.0
    ports:
      - 51820:51820/udp
    volumes:
      - type: bind
        source: ./config/
        target: /config/
      - type: bind
        source: /lib/modules
        target: /lib/modules
    restart: always
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fill this config:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;TZ&lt;/code&gt; is a Timezone - Get yours from TZ Database in &lt;a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"&gt;Wikipedia&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SERVERURL&lt;/code&gt; is your server IP&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PEERS&lt;/code&gt; are basically configs, if you want 10 configs, just type 10, and peers will generate automaticly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hit &lt;code&gt;CTRL&lt;/code&gt; + &lt;code&gt;X&lt;/code&gt; and then &lt;code&gt;Y&lt;/code&gt; then &lt;code&gt;ENTER&lt;/code&gt; to save the file&lt;/p&gt;

&lt;p&gt;To run Wireguard enter these two commands:&lt;br&gt;
&lt;code&gt;cd ~/wireguard/&lt;/code&gt;&lt;br&gt;
&lt;code&gt;docker-compose up -d&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter &lt;code&gt;docker-compose logs -f wireguard&lt;/code&gt; - There should be QR codes, with connection profiles&lt;/li&gt;
&lt;li&gt;Or go to &lt;code&gt;~/wireguard/config/&lt;/code&gt; to see &lt;code&gt;.conf&lt;/code&gt; files for every peer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enjoy your fresh &amp;amp; private VPN&lt;/p&gt;

</description>
      <category>vpn</category>
      <category>wireguard</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
