From 126cc21092382e17a7eb738d56d46559ee3257a9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 23 Sep 2020 17:38:27 +0200 Subject: [PATCH] Use backports for compiling WireGuard from source. This makes it compatible also with older kernels. Signed-off-by: DL6ER --- docs/guides/wireguard/server.md | 59 +++++++++++++++++++++++++-------- mkdocs.yml | 3 ++ 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/docs/guides/wireguard/server.md b/docs/guides/wireguard/server.md index c9739fc..fd9dc5f 100644 --- a/docs/guides/wireguard/server.md +++ b/docs/guides/wireguard/server.md @@ -26,27 +26,60 @@ sudo apt install wireguard wireguard-tools wireguard-dkms If there is no `wireguard` package available for your system, you can follow the instructions below to compile WireGuard from source. -???+ info "Compile WireGuard from source" +??? info "Compile WireGuard from source" - With the following commands, you can install WireGuard from source + With the following commands, you can install WireGuard from source as a backport of the WireGuard kernel module for Linux to 3.10 ≤ kernel ≤ 5.5 as an out-of-tree module. More recent kernels already include WireGuard themselves and you only need to install the `wireguard` tools. + + ### Update your local system ``` bash sudo apt update && sudo apt upgrade -y - sudo apt install raspberrypi-kernel-headers libmnl-dev libelf-dev build-essential git -y - git clone https://git.zx2c4.com/WireGuard - cd WireGuard/src - sudo make - sudo make install ``` - With these commands, you can update your locally compiled WireGuard at any time: + ### Install the toolchain + + === "Raspberry Pi" + + ``` bash + sudo apt install -y raspberrypi-kernel-headers libelf-dev build-essential pkg-config git + ``` + + === "Linux" + + ``` bash + sudo apt install -y linux-headers-$(uname -r) libelf-dev build-essential libmnl-dev git + ``` + + ## Download and compile the `wireguard` module ``` bash - cd WireGuard/ - git pull - cd src - sudo make - sudo make install + git clone https://git.zx2c4.com/wireguard-linux-compat + make -C wireguard-linux-compat/src -j$(nproc) + sudo make -C wireguard-linux-compat/src install + ``` + + You can ignore messages like + + ``` plain + Warning: modules_install: missing 'System.map' file. Skipping depmod. + ``` + + !!! info "Check the module installation was successful" + + Run + + ``` bash + sudo modprobe wireguard + ``` + + If there is no output, `wireguard` was loaded correctly. Note that it may be necessary to re-install the `wireguard` module when you update your system's kernel. + + ## Download and compile the `wireguard` tools (`wg`, etc.) + + ``` bash + git clone https://git.zx2c4.com/wireguard-tools + make -C wireguard-tools/src -j$(nproc) + sudo make -C wireguard-tools/src install ``` The ZX2C4 git repository is the official source for `wireguard-linux`, see [WireGuard#Repositories](https://www.wireguard.com/repositories/) (external link) diff --git a/mkdocs.yml b/mkdocs.yml index b4178ef..cdc8508 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -39,6 +39,9 @@ markdown_extensions: - pymdownx.extra # (https://facelessuser.github.io/pymdown-extensions/extensions/details/) - pymdownx.details + # Tabbed provides a syntax to easily add tabbed Markdown content. + # https://facelessuser.github.io/pymdown-extensions/extensions/tabbed/ + - pymdownx.tabbed # Adds syntax for defining footnotes in Markdown documents (https://python-markdown.github.io/extensions/footnotes/) - footnotes # Adds the ability to define abbreviations