From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: logcabin@fastmail.net Received: from krantz.zx2c4.com (localhost [127.0.0.1]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 9b5d334a for ; Sat, 21 Jul 2018 21:39:10 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 46342d4f for ; Sat, 21 Jul 2018 21:39:10 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 328A72147B for ; Sat, 21 Jul 2018 17:47:59 -0400 (EDT) Message-Id: <1532209678.585688.1448515984.39AF7871@webmail.messagingengine.com> From: logcabin@fastmail.net To: wireguard@lists.zx2c4.com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_----------=_15322096785856880" Subject: Re: WireGuard on Docker Date: Sat, 21 Jul 2018 17:47:58 -0400 In-Reply-To: References: List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is a multi-part message in MIME format. --_----------=_15322096785856880 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: >=20 > [#] 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" >=20 > Here is 3 Dokerfiles I tried: >=20 > 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 >=20 > ENTRYPOINT [ "wg-quick", "up", "wg0" ] >=20 > =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- >=20 > 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>=20 > ENTRYPOINT [ "wg-quick", "up", "wg0" ] >=20 > =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- >=20 > FROM debian:9 > RUN echo "deb http://deb.debian.org/debian/ unstable main" > > /etc/apt/sources.list.d/unstable.list \> && printf 'Package: *\nPin: rele= ase a=3Dunstable\nPin-Priority: 150\n' > > /etc/apt/preferences.d/limit-unstable \> && apt-get update && apt-get ins= tall -y wireguard >=20 > ENTRYPOINT [ "wg-quick", "up", "wg0" ] >=20 > =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- >=20 > I run this containers with: >=20 > sudo docker run -it -v $(pwd)/config:/etc/wireguard/ -v /dev:/dev > -v /lib/modules:/lib/modules --cap-add=3DALL --privileged name here>>=20 > where wg0.conf is located in " $(pwd)/config/wg0.conf" on host machine>=20 > =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- >=20 > and here is my wg0.conf file: >=20 > [Interface] > Address =3D 172.26.10.1/24 > SaveConfig =3D true > PrivateKey =3D > ListenPort =3D 40540 >=20 > [Peer] > PublicKey =3D > AllowedIPs =3D 172.26.10.2/32 >=20 > =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- >=20 > 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 --_----------=_15322096785856880 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"
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 messa= ge 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 htt= p://dl-cdn.alpinelinux.org/alpine/edge/testing >&g= t; /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-$(unam= e -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/deb= ian/ unstable main" > /etc/apt/sources.list.d/unst= able.list \
&& printf 'Package: *\nPin: release a=3Dunstable\n= Pin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable \
&& apt-get update && apt-get install -y wi= reguard

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&nb= sp; /dev:/dev  -v  /lib/modules:/lib/modules  --cap-add=3DAL= L --privileged <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 here is my wg0.conf file:

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

[Peer]
PublicKey =3D <client public key here>
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: Pro= tocol not supported" error?
_______________________________________________
WireGuard mailing list

--_----------=_15322096785856880--