Compilation from Source Code
发布时间:2026-10-09 | 浏览:1
Interworkings Compilation from Source Code Protocol & Cryptography Formal Verification Cross-platform Interface Routing & Network Namespaces Embedding into Applications Build Status Known Limitations Performance Project Todo Presentations
Compilation from Source Code
Protocol & Cryptography
Formal Verification
Cross-platform Interface
Routing & Network Namespaces
Embedding into Applications
Known Limitations
Compiling the Kernel Module from Source
Step 1: Install the toolchain
Step 2: Grab the code
Step 3: Compile and install the module
Step 4: Compile and install the wg(8) tool
Kernel Requirements
Building Directly In Tree
Compiling the Kernel Module from Source
You will need gcc ≥4.7 and your kernel headers in the right location for compilation.
Step 1: Install the toolchain
Ubuntu and Debian
Red Hat Enterprise Linux / CentOS
Step 2: Grab the code
Step 3: Compile and install the module
(You may instead run make debug if you'd like to have additional information on what's happening in your dmesg(1) .)
Step 4: Compile and install the wg(8) tool
*** Move on to the quick start walkthrough . ***
Kernel Requirements
WireGuard requires Linux ≥3.10, with the following configuration options, which are likely already configured in your kernel, especially if you're installing via distribution packages .
CONFIG_NET for basic networking support
CONFIG_INET for basic IP support
CONFIG_NET_UDP_TUNNEL for sending and receiving UDP packets
CONFIG_CRYPTO_ALGAPI for crypto_xor
Some, but not all, of these options directly correspond to menuconfig entries. The ones that do not correspond directly correspond to options that imply them. For enabling the above options, select these items in menuconfig :
When building as an out of tree module, it is probable that one needs CONFIG_UNUSED_SYMBOLS set as well.
Building Directly In Tree
Rather than building as an external module, if you would like to build WireGuard as a module or as built-in, directly from within the kernel tree, you may use the create-patch.sh script which creates a patch for adding WireGuard directly to the tree or the jury-rig.sh script which links the WireGuard source directory into the kernel tree:
Then you will be able to configure these options directly:
CONFIG_WIREGUARD controls whether WireGuard is built as a module, as built-in, or not at all
CONFIG_WIREGUARD_DEBUG turns on verbose debug messages
These are selectable easily via menuconfig , if CONFIG_NET and CONFIG_INET are also selected: