WireGuard Archive on lore.kernel.org
 help / color / Atom feed
* WireGuard on Docker
@ 2018-07-10  8:16 Mohammad Amir Heshmatkhah
  2018-07-21 21:47 ` logcabin
       [not found] ` <CAJqFBzwF-3jvB9yNqcQdcn9qp_i2xPua1fjeVoY7a-j0es=VYw@mail.gmail.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Mohammad Amir Heshmatkhah @ 2018-07-10  8:16 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]

Hi,
I want to run WireGuard on a docker container as server,
I try difrent base Images but  I get this error message every time:

[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported
[#] ip link delete dev wg0
Cannot find device "wg0"

Here is 3 Dokerfiles I tried:

FROM alpine:3.7
RUN apk upgrade --update \
&& echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >>
/etc/apk/repositories \
&& apk add --no-cache bash wireguard-tools

ENTRYPOINT [ "wg-quick", "up", "wg0" ]

————————————-

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y software-properties-common
apt-utils \
&& add-apt-repository ppa:wireguard/wireguard \
&& apt-get update \
&& apt-get install -y iproute linux-headers-$(uname -r) wireguard-dkms
wireguard-tools wireguard

ENTRYPOINT [ "wg-quick", "up", "wg0" ]

————————————-

FROM debian:9
RUN echo "deb http://deb.debian.org/debian/ unstable main" >
/etc/apt/sources.list.d/unstable.list \
&& printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' >
/etc/apt/preferences.d/limit-unstable \
&& apt-get update && apt-get install -y wireguard

ENTRYPOINT [ "wg-quick", "up", "wg0" ]

————————————-

I run this containers with:

sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v  /dev:/dev  -v
/lib/modules:/lib/modules  --cap-add=ALL --privileged <image name here>

where wg0.conf is located in " $(pwd)/config/wg0.conf" on host machine

————————————-

and here is my wg0.conf file:

[Interface]
Address = 172.26.10.1/24
SaveConfig = true
PrivateKey = <server private key here>
ListenPort = 40540

[Peer]
PublicKey = <client public key here>
AllowedIPs = 172.26.10.2/32

————————————-

So, How can I fix this "*Unable to access interface: Protocol not supported*"
error?

[-- Attachment #2: Type: text/html, Size: 8802 bytes --]

<div dir="ltr"><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Hi,</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I want to run WireGuard on a docker container as server,</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I try difrent base Images but  I get this error message every time:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[#] ip link add wg0 type wireguard</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RTNETLINK answers: Operation not supported</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Unable to access interface: Protocol not supported</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[#] ip link delete dev wg0</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Cannot find device &quot;wg0&quot;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Here is 3 Dokerfiles I tried:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">FROM alpine:3.7</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RUN apk upgrade --update \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; echo<span> </span><a href="http://dl-cdn.alpinelinux.org/alpine/edge/testing" target="_blank" style="color:rgb(17,85,204)">http://dl-cdn.alpinelinux.org/alpine/edge/testing</a><span> </span>&gt;&gt; /etc/apk/repositories \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apk add --no-cache bash wireguard-tools</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ENTRYPOINT [ &quot;wg-quick&quot;, &quot;up&quot;, &quot;wg0&quot; ]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">FROM ubuntu:16.04</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RUN apt-get update &amp;&amp; apt-get install -y software-properties-common apt-utils \ </div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; add-apt-repository ppa:wireguard/wireguard \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apt-get update \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apt-get install -y iproute linux-headers-$(uname -r) wireguard-dkms wireguard-tools wireguard</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ENTRYPOINT [ &quot;wg-quick&quot;, &quot;up&quot;, &quot;wg0&quot; ]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">FROM debian:9</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RUN echo &quot;deb<span> </span><a href="http://deb.debian.org/debian/" target="_blank" style="color:rgb(17,85,204)">http://deb.debian.org/debian/</a><span> </span>unstable main&quot; &gt; /etc/apt/sources.list.d/unstable.list \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; printf &#39;Package: *\nPin: release a=unstable\nPin-Priority: 150\n&#39; &gt; /etc/apt/preferences.d/limit-unstable \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apt-get update &amp;&amp; apt-get install -y wireguard</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ENTRYPOINT [ &quot;wg-quick&quot;, &quot;up&quot;, &quot;wg0&quot; ]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I run this containers with:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v  /dev:/dev  -v  /lib/modules:/lib/modules  --cap-add=ALL --privileged &lt;image name here&gt;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">where wg0.conf is located in &quot; $(pwd)/config/<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">wg0.conf</span>&quot; on host machine</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">and here is my wg0.conf file:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[Interface]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Address =<span> </span><a href="http://172.26.10.1/24" target="_blank" style="color:rgb(17,85,204)">172.26.10.1/24</a></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">SaveConfig = true</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">PrivateKey = &lt;server private key here&gt;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ListenPort = 40540</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[Peer]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">PublicKey = &lt;client public key here&gt;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">AllowedIPs =<span> </span><a href="http://172.26.10.2/32" target="_blank" style="color:rgb(17,85,204)">172.26.10.2/32</a></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">So, How can I fix this &quot;<b>Unable to access interface: Protocol not supported</b>&quot; error?</div><br></div>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: WireGuard on Docker
  2018-07-10  8:16 WireGuard on Docker Mohammad Amir Heshmatkhah
@ 2018-07-21 21:47 ` logcabin
       [not found] ` <CAJqFBzwF-3jvB9yNqcQdcn9qp_i2xPua1fjeVoY7a-j0es=VYw@mail.gmail.com>
  1 sibling, 0 replies; 3+ messages in thread
From: logcabin @ 2018-07-21 21:47 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]

I'm wondering if the kernel module is loaded:

# modinfo wireguard


On Tue, Jul 10, 2018, at 4:16 AM, Mohammad Amir Heshmatkhah wrote:
> Hi,
> I want to run WireGuard on a docker container as server,
> I try difrent base Images but  I get this error message every time:
> 
> [#] ip link add wg0 type wireguard
> RTNETLINK answers: Operation not supported
> Unable to access interface: Protocol not supported
> [#] ip link delete dev wg0
> Cannot find device "wg0"
> 
> Here is 3 Dokerfiles I tried:
> 
> FROM alpine:3.7
> RUN apk upgrade --update \
> && echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >>
> /etc/apk/repositories \> && apk add --no-cache bash wireguard-tools
> 
> ENTRYPOINT [ "wg-quick", "up", "wg0" ]
> 
> ————————————-
> 
> FROM ubuntu:16.04
> RUN apt-get update && apt-get install -y software-properties-common
> apt-utils \> && add-apt-repository ppa:wireguard/wireguard \
> && apt-get update \
> && apt-get install -y iproute linux-headers-$(uname -r) wireguard-dkms
> wireguard-tools wireguard> 
> ENTRYPOINT [ "wg-quick", "up", "wg0" ]
> 
> ————————————-
> 
> FROM debian:9
> RUN echo "deb http://deb.debian.org/debian/ unstable main" >
> /etc/apt/sources.list.d/unstable.list \> && printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' >
> /etc/apt/preferences.d/limit-unstable \> && apt-get update && apt-get install -y wireguard
> 
> ENTRYPOINT [ "wg-quick", "up", "wg0" ]
> 
> ————————————-
> 
> I run this containers with:
> 
> sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v  /dev:/dev
> -v  /lib/modules:/lib/modules  --cap-add=ALL --privileged <image
> name here>> 
> where wg0.conf is located in " $(pwd)/config/wg0.conf" on host machine> 
> ————————————-
> 
> and here is my wg0.conf file:
> 
> [Interface]
> Address = 172.26.10.1/24
> SaveConfig = true
> PrivateKey = <server private key here>
> ListenPort = 40540
> 
> [Peer]
> PublicKey = <client public key here>
> AllowedIPs = 172.26.10.2/32
> 
> ————————————-
> 
> So, How can I fix this "*Unable to access interface: Protocol not
> supported*" error?> _________________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard


[-- Attachment #2: Type: text/html, Size: 9862 bytes --]

<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div style="font-family:Arial;">I'm wondering if the kernel module is loaded:<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;"># modinfo wireguard<br></div>
<div><br></div>
<div><br></div>
<div>On Tue, Jul 10, 2018, at 4:16 AM, Mohammad Amir Heshmatkhah wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">Hi,<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">I want to run WireGuard on a docker container as server,<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">I try difrent base Images but&nbsp; I get this error message every time:<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">[#] ip link add wg0 type wireguard<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">RTNETLINK answers: Operation not supported<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">Unable to access interface: Protocol not supported<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">[#] ip link delete dev wg0<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">Cannot find device "wg0"<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">Here is 3 Dokerfiles I tried:<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">FROM alpine:3.7<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">RUN apk upgrade --update \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; echo<span>&nbsp;</span><a href="http://dl-cdn.alpinelinux.org/alpine/edge/testing" style="color:rgb(17, 85, 204);">http://dl-cdn.alpinelinux.org/alpine/edge/testing</a><span>&nbsp;</span>&gt;&gt; /etc/apk/repositories \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; apk add --no-cache bash wireguard-tools<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">ENTRYPOINT [ "wg-quick", "up", "wg0" ]<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">————————————-<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">FROM ubuntu:16.04<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">RUN apt-get update &amp;&amp; apt-get install -y software-properties-common apt-utils \&nbsp;<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; add-apt-repository ppa:wireguard/wireguard \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; apt-get update \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; apt-get install -y iproute linux-headers-$(uname -r) wireguard-dkms wireguard-tools wireguard<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">ENTRYPOINT [ "wg-quick", "up", "wg0" ]<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">————————————-<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">FROM debian:9<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">RUN echo "deb<span>&nbsp;</span><a href="http://deb.debian.org/debian/" style="color:rgb(17, 85, 204);">http://deb.debian.org/debian/</a><span>&nbsp;</span>unstable main" &gt; /etc/apt/sources.list.d/unstable.list \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' &gt; /etc/apt/preferences.d/limit-unstable \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&amp;&amp; apt-get update &amp;&amp; apt-get install -y wireguard<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">ENTRYPOINT [ "wg-quick", "up", "wg0" ]<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">————————————-<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">I run this containers with:<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v&nbsp; /dev:/dev&nbsp; -v&nbsp; /lib/modules:/lib/modules&nbsp; --cap-add=ALL --privileged &lt;image name here&gt;<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">where wg0.conf is located in " $(pwd)/config/<span class="highlight" style="background-color:rgb(255, 255, 255)"><span class="size" style="font-size:small">wg0.conf</span></span>" on host machine<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">————————————-<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">and here is my wg0.conf file:<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">[Interface]<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">Address =<span>&nbsp;</span><a href="http://172.26.10.1/24" style="color:rgb(17, 85, 204);">172.26.10.1/24</a><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">SaveConfig = true<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">PrivateKey = &lt;server private key here&gt;<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">ListenPort = 40540<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">[Peer]<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">PublicKey = &lt;client public key here&gt;<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">AllowedIPs =<span>&nbsp;</span><a href="http://172.26.10.2/32" style="color:rgb(17, 85, 204);">172.26.10.2/32</a><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">————————————-<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;"><br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">So, How can I fix this "<b>Unable to access interface: Protocol not supported</b>" error?<br></div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>WireGuard mailing list<br></div>
<div><a href="mailto:WireGuard@lists.zx2c4.com">WireGuard@lists.zx2c4.com</a><br></div>
<div><a href="https://lists.zx2c4.com/mailman/listinfo/wireguard">https://lists.zx2c4.com/mailman/listinfo/wireguard</a><br></div>
</blockquote><div style="font-family:Arial;"><br></div>
</body>
</html>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: WireGuard on Docker
       [not found] ` <CAJqFBzwF-3jvB9yNqcQdcn9qp_i2xPua1fjeVoY7a-j0es=VYw@mail.gmail.com>
@ 2018-07-22  6:44   ` Zsolt Hegyi
  0 siblings, 0 replies; 3+ messages in thread
From: Zsolt Hegyi @ 2018-07-22  6:44 UTC (permalink / raw)
  To: Mohammad Amir Heshmatkhah, wireguard

[-- Attachment #1: Type: text/plain, Size: 2781 bytes --]

CC'ing the list as well.

On Sun, 22 Jul 2018, 08:43 Zsolt Hegyi, <hegyi.mokka@gmail.com> wrote:

> Hi Mohammad,
>
> You need to load the WireGuard kernel module on your host OS, not inside
> the containers. All containers "share" and run on the same kernel as the
> host OS does.
>
> Best regards,
> Zsolt
>
>
> On Sat, 21 Jul 2018, 23:34 Mohammad Amir Heshmatkhah, <
> maheshmatkhah.soft@gmail.com> wrote:
>
>> Hi,
>> I want to run WireGuard on a docker container as server,
>> I try difrent base Images but  I get this error message every time:
>>
>> [#] ip link add wg0 type wireguard
>> RTNETLINK answers: Operation not supported
>> Unable to access interface: Protocol not supported
>> [#] ip link delete dev wg0
>> Cannot find device "wg0"
>>
>> Here is 3 Dokerfiles I tried:
>>
>> FROM alpine:3.7
>> RUN apk upgrade --update \
>> && echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >>
>> /etc/apk/repositories \
>> && apk add --no-cache bash wireguard-tools
>>
>> ENTRYPOINT [ "wg-quick", "up", "wg0" ]
>>
>> ————————————-
>>
>> FROM ubuntu:16.04
>> RUN apt-get update && apt-get install -y software-properties-common
>> apt-utils \
>> && add-apt-repository ppa:wireguard/wireguard \
>> && apt-get update \
>> && apt-get install -y iproute linux-headers-$(uname -r) wireguard-dkms
>> wireguard-tools wireguard
>>
>> ENTRYPOINT [ "wg-quick", "up", "wg0" ]
>>
>> ————————————-
>>
>> FROM debian:9
>> RUN echo "deb http://deb.debian.org/debian/ unstable main" >
>> /etc/apt/sources.list.d/unstable.list \
>> && printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' >
>> /etc/apt/preferences.d/limit-unstable \
>> && apt-get update && apt-get install -y wireguard
>>
>> ENTRYPOINT [ "wg-quick", "up", "wg0" ]
>>
>> ————————————-
>>
>> I run this containers with:
>>
>> sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v  /dev:/dev  -v
>> /lib/modules:/lib/modules  --cap-add=ALL --privileged <image name here>
>>
>> where wg0.conf is located in " $(pwd)/config/wg0.conf" on host machine
>>
>> ————————————-
>>
>> and here is my wg0.conf file:
>>
>> [Interface]
>> Address = 172.26.10.1/24
>> SaveConfig = true
>> PrivateKey = <server private key here>
>> ListenPort = 40540
>>
>> [Peer]
>> PublicKey = <client public key here>
>> AllowedIPs = 172.26.10.2/32
>>
>> ————————————-
>>
>> So, How can I fix this "*Unable to access interface: Protocol not
>> supported*" error?
>>
>> _______________________________________________
>> WireGuard mailing list
>> WireGuard@lists.zx2c4.com
>> https://lists.zx2c4.com/mailman/listinfo/wireguard
>>
>

[-- Attachment #2: Type: text/html, Size: 10074 bytes --]

CC&#39;ing the list as well.<br><br><div class="gmail_quote"><div dir="ltr">On Sun, 22 Jul 2018, 08:43 Zsolt Hegyi, &lt;<a href="mailto:hegyi.mokka@gmail.com">hegyi.mokka@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mohammad,<div><br></div><div>You need to load the WireGuard kernel module on your host OS, not inside the containers. All containers &quot;share&quot; and run on the same kernel as the host OS does.</div><div><br></div><div>Best regards,</div><div>Zsolt</div><div><br><br><div class="gmail_quote"><div dir="ltr">On Sat, 21 Jul 2018, 23:34 Mohammad Amir Heshmatkhah, &lt;<a href="mailto:maheshmatkhah.soft@gmail.com" target="_blank">maheshmatkhah.soft@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Hi,</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I want to run WireGuard on a docker container as server,</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I try difrent base Images but  I get this error message every time:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[#] ip link add wg0 type wireguard</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RTNETLINK answers: Operation not supported</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Unable to access interface: Protocol not supported</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[#] ip link delete dev wg0</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Cannot find device &quot;wg0&quot;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Here is 3 Dokerfiles I tried:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">FROM alpine:3.7</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RUN apk upgrade --update \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; echo<span> </span><a href="http://dl-cdn.alpinelinux.org/alpine/edge/testing" style="color:rgb(17,85,204)" target="_blank">http://dl-cdn.alpinelinux.org/alpine/edge/testing</a><span> </span>&gt;&gt; /etc/apk/repositories \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apk add --no-cache bash wireguard-tools</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ENTRYPOINT [ &quot;wg-quick&quot;, &quot;up&quot;, &quot;wg0&quot; ]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">FROM ubuntu:16.04</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RUN apt-get update &amp;&amp; apt-get install -y software-properties-common apt-utils \ </div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; add-apt-repository ppa:wireguard/wireguard \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apt-get update \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apt-get install -y iproute linux-headers-$(uname -r) wireguard-dkms wireguard-tools wireguard</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ENTRYPOINT [ &quot;wg-quick&quot;, &quot;up&quot;, &quot;wg0&quot; ]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">FROM debian:9</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">RUN echo &quot;deb<span> </span><a href="http://deb.debian.org/debian/" style="color:rgb(17,85,204)" target="_blank">http://deb.debian.org/debian/</a><span> </span>unstable main&quot; &gt; /etc/apt/sources.list.d/unstable.list \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; printf &#39;Package: *\nPin: release a=unstable\nPin-Priority: 150\n&#39; &gt; /etc/apt/preferences.d/limit-unstable \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&amp;&amp; apt-get update &amp;&amp; apt-get install -y wireguard</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ENTRYPOINT [ &quot;wg-quick&quot;, &quot;up&quot;, &quot;wg0&quot; ]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I run this containers with:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v  /dev:/dev  -v  /lib/modules:/lib/modules  --cap-add=ALL --privileged &lt;image name here&gt;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">where wg0.conf is located in &quot; $(pwd)/config/<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">wg0.conf</span>&quot; on host machine</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">and here is my wg0.conf file:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[Interface]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Address =<span> </span><a href="http://172.26.10.1/24" style="color:rgb(17,85,204)" target="_blank">172.26.10.1/24</a></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">SaveConfig = true</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">PrivateKey = &lt;server private key here&gt;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">ListenPort = 40540</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">[Peer]</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">PublicKey = &lt;client public key here&gt;</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">AllowedIPs =<span> </span><a href="http://172.26.10.2/32" style="color:rgb(17,85,204)" target="_blank">172.26.10.2/32</a></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">————————————-</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">So, How can I fix this &quot;<b>Unable to access interface: Protocol not supported</b>&quot; error?</div><br></div>
_______________________________________________<br>
WireGuard mailing list<br>
<a href="mailto:WireGuard@lists.zx2c4.com" target="_blank">WireGuard@lists.zx2c4.com</a><br>
<a href="https://lists.zx2c4.com/mailman/listinfo/wireguard" rel="noreferrer" target="_blank">https://lists.zx2c4.com/mailman/listinfo/wireguard</a><br>
</blockquote></div></div></blockquote></div>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10  8:16 WireGuard on Docker Mohammad Amir Heshmatkhah
2018-07-21 21:47 ` logcabin
     [not found] ` <CAJqFBzwF-3jvB9yNqcQdcn9qp_i2xPua1fjeVoY7a-j0es=VYw@mail.gmail.com>
2018-07-22  6:44   ` Zsolt Hegyi

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com zx2c4-wireguard@archiver.kernel.org
	public-inbox-index wireguard


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/ public-inbox