<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alexander on Medium]]></title>
        <description><![CDATA[Stories by Alexander on Medium]]></description>
        <link>https://medium.com/@cyraxxxxxxx?source=rss-c7e1dbb884ce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NBYYKDWNRxoOe0cM.jpg</url>
            <title>Stories by Alexander on Medium</title>
            <link>https://medium.com/@cyraxxxxxxx?source=rss-c7e1dbb884ce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 06:10:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cyraxxxxxxx/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Wireguard + swarm docker — basic installation]]></title>
            <link>https://medium.com/@cyraxxxxxxx/wireguard-swarm-docker-basic-installation-917c08ee9f9c?source=rss-c7e1dbb884ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/917c08ee9f9c</guid>
            <dc:creator><![CDATA[Alexander]]></dc:creator>
            <pubDate>Sat, 11 Dec 2021 13:31:02 GMT</pubDate>
            <atom:updated>2021-12-11T13:31:02.936Z</atom:updated>
            <content:encoded><![CDATA[<h3>Wireguard + swarm docker — basic installation</h3><p>One day I wanted to use securitely access to my home server and I decided to try wireguard as my friend told me about this fast and modern vpn. I spent about two days on this exiting activity )</p><p><strong>So what do we have?</strong> My network configuration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyi-nB8LJrtsLmvK7yVFFg.png" /></figure><p><strong>What is the goal?</strong><br>One needs:<br>- from wirgeguard’s client to have access to wirgeguard’s server’s network;<br>- to use docker’s servicies in order to easy manage and deploy our vpn.</p><h3>Let&#39;s dive in!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exWoE_dgyHILbICvrwEUdg.png" /></figure><h3>1. Prepare</h3><p>At first you need to <a href="https://docs.docker.com/get-docker/">install docker</a> if you don’t already have it. Turn docker into swarm mode, for that go to server’s cmd and run:</p><pre>docker swarm init</pre><p>for more information about swarm <a href="https://docs.docker.com/engine/swarm/">read this</a>.</p><h3>2. Make stack yalm file</h3><p>Make folder for configs and swarm’s stack file. In our case it will be “<strong>/home/user/tools/wireguard</strong>”</p><pre>cd /home/user<br>mkdir -p tools/wireguard</pre><p>Make yalm file let’s say “<strong>wireguard.yalm</strong>”</p><pre>cd tools/wireguard<br>vi wireguard.yalm</pre><p>Fill the file by followings:</p><pre>version: &quot;3&quot;<br> services:<br>  wireguard:<br>   image: linuxserver/wireguard<br>   cap_add:<br>    - NET_ADMIN<br>    - SYS_MODULE<br>   environment:<br>    - PUID=1000<br>    - PGID=1000<br>    - TZ=Asia/Novokuznetsk<br>    - SERVERURL=your_server_address.com<br>    - SERVERPORT=51820<br>    - PEERS=5<br>    - PEERDNS=auto<br>    - INTERNAL_SUBNET=10.13.13.0<br>   volumes:<br>    - /home/user/tools/wireguard/config:/config<br>    - /lib/modules:/lib/modules<br>   ports:<br>    - 51820:51820/udp<br>   sysctls:<br>    - net.ipv4.conf.all.src_valid_mark=1</pre><p><strong><em>Description:</em><br>TZ=</strong><em>Asia/Novokuznetsk — </em>timezone of your container;<br><strong>PEERS</strong>=<em>5 — </em>amount of different clients;<em><br></em><strong>INTERNAL_SUBNET</strong>=<em>10.13.13.0 — </em>the ip don’t need to cross our server’s ips;<br><strong>/home/user/tools/wireguard/config </strong>— path in your server where wireguard will store its configs;</p><h3>3. Run a wireguard service</h3><p>To launch the service enter the command:</p><pre>docker stack deploy --with-registry-auth --compose-file wireguard.yalm vpn</pre><p>it takes a while, then our network will be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TtTqPMIWRBfaMZrbI3okHw.png" /></figure><h3>4. Check the correction of auto-set settings</h3><p>Now open “<strong>wg0.conf</strong>” and check PostUp and PostDown settings, for that do:</p><pre>cat /home/user/tools/wireguard/config/wg0.conf</pre><p>and look</p><pre>[Interface]<br>Address = 10.13.13.1<br>ListenPort = 51820<br>PrivateKey = OFEFeiobwOGbIGWBGIowG<br>PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o <strong>eth2</strong> -j MASQUERADE<br>PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o <strong>eth2</strong> -j MASQUERADE</pre><p>let’s check <strong>eth2</strong> is correct, for that, connect to a container</p><p>find out the wireguard docker container name</p><pre>docker ps</pre><p>you get</p><pre>CONTAINER ID   IMAGE                                        COMMAND                  CREATED        STATUS                 PORTS                                                                                                             NAMES</pre><pre>c257a8a1b7df   linuxserver/wireguard:latest                 &quot;/init&quot;                  46 hours ago   Up 46 hours            51820/udp                                                                                                         <strong>vpn_wireguard.1.t3ogzhiqiuzkcc5i4gj8zy5bg</strong></pre><p>“<strong>vpn_wireguard.1.t3ogzhiqiuzkcc5i4gj8zy5bg”</strong> is name of our container</p><pre>docker exec -it <strong>vpn_wireguard.1.t3ogzhiqiuzkcc5i4gj8zy5bg </strong>bash</pre><p>now you entered the container, type the follow command</p><pre>route</pre><p>we’ll get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0gFUxLVKYvKKCSUOlZrHQ.png" /></figure><p>pay attention on <strong>default</strong> Destanation — Iface, there is <strong>eth2</strong>. If the interface of our “<strong>wg0.conf</strong>” is different then change config:</p><pre>vi /home/user/tools/wireguard/config/wg0.conf</pre><p>then restart the wireguard docker service</p><pre>docker service update --force vpn_wireguard</pre><h3>5. Connect clients</h3><p>It’s easy to connect client to the wg server you need just to download a platform client and scan quad-code! That’s it!</p><p>Wg already made settings and png-files quad-code for every client:</p><pre>ls /home/user/tools/wireguard/config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lEBb0hTnjymbKh9EpHoUfA.png" /></figure><p><strong>peer1, peer2, peer3, peer4, peer5</strong> are that folders.</p><h3>5.1. Get quad-code</h3><p>Several ways are available:<br>- download <strong>peer1.png</strong> file from the server through <strong>scp</strong> (<a href="http://www.hypexr.org/linux_scp_help.php">example</a>);<br>- generate and show a quad-code straight in the terminal!</p><p>Consider last case generating.</p><p>Get access to folder:</p><pre>sudo chmod +xr peer2<br>sudo chmod +r peer2/*</pre><p>generate the quad-code:</p><pre>qrencode -t ansiutf8 &lt; peer2/peer2.conf</pre><h3>5.2. Configure an android client</h3><p>Go to Play Market, type wireguard, and press <strong>Install</strong>. In the app press <strong>add </strong>then scan quad-code from the terminal. That’s it!</p><h3>Conclusion</h3><p>We considered how to install dockered wireguard, configure it, and connect client to it. Thank you for your attention! I hope this article was helpfull! )</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=917c08ee9f9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>