<!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 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;">&& echo<span> </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> </span>>> /etc/apk/repositories \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&& 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 && apt-get install -y software-properties-common apt-utils \ <br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&& add-apt-repository ppa:wireguard/wireguard \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&& apt-get update \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&& 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> </span><a href="http://deb.debian.org/debian/" style="color:rgb(17, 85, 204);">http://deb.debian.org/debian/</a><span> </span>unstable main" > /etc/apt/sources.list.d/unstable.list \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&& printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable \<br></div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;">&& apt-get update && 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 /dev:/dev -v /lib/modules:/lib/modules --cap-add=ALL --privileged <image name here><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> </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 = <server private key here><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 = <client public key here><br></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);">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>