CC'ing the list as well.<br><br><div class="gmail_quote"><div dir="ltr">On Sun, 22 Jul 2018, 08:43 Zsolt Hegyi, <<a href="mailto:hegyi.mokka@gmail.com">hegyi.mokka@gmail.com</a>> 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 "share" 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, <<a href="mailto:maheshmatkhah.soft@gmail.com" target="_blank">maheshmatkhah.soft@gmail.com</a>> 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 "wg0"</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">&& 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>>> /etc/apk/repositories \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&& 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 [ "wg-quick", "up", "wg0" ]</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 && apt-get install -y software-properties-common apt-utils \ </div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&& add-apt-repository ppa:wireguard/wireguard \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&& apt-get update \</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</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" ]</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 "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" > /etc/apt/sources.list.d/unstable.list \</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 \</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">&& apt-get update && 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 [ "wg-quick", "up", "wg0" ]</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 <image name here></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 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>" 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 = <server private key here></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 = <client public key here></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 "<b>Unable to access interface: Protocol not supported</b>" 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>