From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: maheshmatkhah.soft@gmail.com Received: from krantz.zx2c4.com (localhost [127.0.0.1]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id d15a284a for ; Tue, 10 Jul 2018 08:09:45 +0000 (UTC) Received: from mail-ua0-x22d.google.com (mail-ua0-x22d.google.com [IPv6:2607:f8b0:400c:c08::22d]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id c8173ce7 for ; Tue, 10 Jul 2018 08:09:45 +0000 (UTC) Received: by mail-ua0-x22d.google.com with SMTP id x24-v6so13422966ual.10 for ; Tue, 10 Jul 2018 01:17:05 -0700 (PDT) MIME-Version: 1.0 From: Mohammad Amir Heshmatkhah Date: Tue, 10 Jul 2018 12:46:28 +0430 Message-ID: Subject: WireGuard on Docker To: wireguard@lists.zx2c4.com Content-Type: multipart/alternative; boundary="0000000000005216bf0570a0c11f" List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , --0000000000005216bf0570a0c11f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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" ] =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94- 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" ] =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94- 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=3Dunstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable \ && apt-get update && apt-get install -y wireguard ENTRYPOINT [ "wg-quick", "up", "wg0" ] =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94- I run this containers with: sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v /dev:/dev -v /lib/modules:/lib/modules --cap-add=3DALL --privileged where wg0.conf is located in " $(pwd)/config/wg0.conf" on host machine =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94- and here is my wg0.conf file: [Interface] Address =3D 172.26.10.1/24 SaveConfig =3D true PrivateKey =3D ListenPort =3D 40540 [Peer] PublicKey =3D AllowedIPs =3D 172.26.10.2/32 =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94- So, How can I fix this "*Unable to access interface: Protocol not supported= *" error? --0000000000005216bf0570a0c11f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
I want to run Wir= eGuard on a docker container as server,
I try difrent = base Images but=C2=A0 I get this error message every time:

[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation 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=C2=A0http://dl-cdn.= alpinelinux.org/alpine/edge/testing=C2=A0>> /etc/apk= /repositories \
&& apk add --no-cache bash wir= eguard-tools

ENTRYPOINT [ &q= uot;wg-quick", "up", "wg0" ]
=
=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94-

FROM ubuntu:16.04
RU= N apt-get update && apt-get install -y software-properties-common a= pt-utils \=C2=A0
&& add-apt-repository ppa:wir= eguard/wireguard \
&& apt-get update \
&& apt-get install -y iproute linux-headers-$(uname -= r) wireguard-dkms wireguard-tools wireguard

=
ENTRYPOINT [ "wg-quick", "up", "wg= 0" ]

=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94-

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

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

= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94-

I run this containers with:

sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v=C2=A0 /dev:/= dev=C2=A0 -v=C2=A0 /lib/modules:/lib/modules=C2=A0 --cap-add=3DALL --privil= eged <image name here>

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

=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94-

and h= ere is my wg0.conf file:

[In= terface]
Address =3D=C2=A0172.26.= 10.1/24
SaveConfig =3D true
P= rivateKey =3D <server private key here>
ListenPo= rt =3D 40540

[Peer]
PublicKey =3D <client public key here>
AllowedIPs =3D=C2=A0172.26.10.2/32

=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94-

So, How can I fix this "= Unable to access interface: Protocol not supported" error?
--0000000000005216bf0570a0c11f--