Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Wireguard Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-wireguard-knowledge-patch-nevaberry-plugins)
---
name: wireguard-knowledge-patch
description: WireGuard
version: "1.0.20260223"
license: MIT
metadata:
author: Nevaberry
---
# WireGuard knowledge patch
Load this skill when configuring WireGuard peers or interfaces, applying
configuration changes, or diagnosing command output and platform behavior.
Use the topic references for the full guidance and configuration examples.
| Reference | Topics |
| --- | --- |
| [Linux startup and routing](references/linux-startup-and-routing.md) | Startup ordering, automatic MTU, interface names matching keywords, conditional sysctl writes, DHCP with a kill switch |
| [Peer configuration and synchronization](references/peer-configuration.md) | AllowedIPs, key and keepalive removal, endpoint resolution, CLI output, logging, Windows requirements, C endpoint storage |
| [`wg-quick` configuration and lifecycle](references/wg-quick-configuration.md) | Configuration search paths, interface name syntax, lifecycle hooks, private keys, DNS registration and search domains |
## Compatibility changes to check first
### Windows requirements and privileges
The `wg` command on `master` after `v1.0.20260223` requires Windows 10 or later.
`wg` no longer performs its own elevation on Windows. Run commands that need
administrator privileges from an elevated shell.
Disabled WireGuard adapters are omitted from Windows interface listings.
Enable the adapter before looking for it with `wg show interfaces`.
### Removing peer settings with `wg syncconf`
If a peer remains in the configuration, deleting its `PresharedKey` entry
and running `wg syncconf` now clears the live key in place.
Starting with `v1.0.20260223`, removing `PersistentKeepalive` from a peer's
configuration and reapplying the file with `wg syncconf` disables keepalives
for that peer. The peer stays configured.
```bash
wg syncconf wg0 <(wg-quick strip wg0)
```
### Key visibility in command output
Formatted `wg show` output prints private and preshared keys as `(hidden)`
unless `WG_HIDE_KEYS=never`.
The tab-separated `wg show wg0 dump` includes private and preshared key values;
treat its output as secret.
### DHCP with an `iptables` kill switch
DHCP clients using `PF_PACKET` sockets can still send traffic when the
`wg-quick` example kill switch is active. Those sockets bypass Netfilter and
its `OUTPUT` rules.
## Peer configuration
### Incremental AllowedIPs
On Linux, prefix any CIDR in the peer's `wg set` `allowed-ips` list with `+`
or `-` to make the entire update incremental.
Entries with `+` or no prefix are added if absent; entries with `-` are removed
if present. A list with no prefixes replaces the peer's existing AllowedIPs.
```sh
wg set wg0 peer "$peer_public_key" allowed-ips +192.0.2.0/24,-198.51.100.0/24,203.0.113.0/24
```
Changes after `v1.0.20260223` add incremental `AllowedIPs` updates to the
Windows backend and let `wg` pass the update flags to the FreeBSD kernel.
On FreeBSD, use a kernel that supports those flags.
### Repeated AllowedIPs entries
Within a single `[Peer]` block, repeated `AllowedIPs` entries contribute to
the same list.
```ini
AllowedIPs = 192.0.2.0/24
AllowedIPs = 2001:db8:1::/64
```
### Endpoint hostname resolution
`WG_ENDPOINT_RESOLUTION_RETRIES` sets the retry count for each peer's endpoint
hostname. `wg` retries non-permanent resolution failures with an increasing
delay, defaults to 15 retries, and accepts `infinity` for unlimited retries.
```sh
WG_ENDPOINT_RESOLUTION_RETRIES=3 wg set wg0 peer "$peer_public_key" endpoint vpn.example.net:51820
```
The `reresolve-dns` helper reads the current time from `EPOCHSECONDS`.
Run it with a Bash version that provides that variable.
## `wg-quick` configuration and hooks
### Configuration lookup and interface names
When given an interface name, `wg-quick` checks
`/etc/wireguard/INTERFACE.conf` first, then any distribution-specific search
paths. `wg-quick up wg0` checks `/etc/wireguard/wg0.conf` before any
distribution-provided locations.
Accepted interface names match `[a-zA-Z0-9_=+.-]{1,15}`.
A configuration file named `vpn+lab.conf` is valid for the interface `vpn+lab`.
On Linux, `wg-quick up` supplies the interface name through `ip link add dev`,
allowing names that match `ip link` keywords in configurations.
### Private keys loaded by `PreUp`
During `wg-quick up`, the tool applies the file with `wg addconf` after running
`PreUp`. A private key loaded by the hook stays in place when the file omits
`PrivateKey`.
```ini
[Interface]
PreUp = wg set %i private-key /etc/wireguard/%i.key
```
### Hash characters in lifecycle hooks
The shell interprets `#` in `PreUp`, `PostUp`, `PreDown`, and `PostDown`.
Quoted or escaped hashes reach the command as literal characters, and shell
comments still work.
```ini
[Interface]
PostUp = printf '%s\n' 'wg#ready' # Log the interface status
```
### DNS configuration and platform registration
`wg-quick` accepts multiple `DNS` lines in `[Interface]`. IP addresses supply
DNS servers and hostnames supply DNS search domains.
```ini
[Interface]
DNS = 192.0.2.53
DNS = vpn.example.net
```
On Linux, `wg-quick` registers `DNS=` settings under the plain interface name
when the `resolvconf` executable is a symlink. A stale
`/etc/resolvconf/interface-order` file can no longer introduce a legacy
interface prefix after a migration to the systemd resolver.
On OpenBSD, `wg-quick` uses `resolvd(8)` to apply DNS settings for the tunnel.
## Linux startup and routing
### Ordering dependent units
Enabling a `wg-quick@.service` instance links it into `wg-quick.target` and
orders its startup before the target. Use `Wants=` and `After=` in a dependent
unit to pull in the target and wait for the linked instances' start jobs to
finish.
```ini
[Unit]
Wants=wg-quick.target
After=wg-quick.target
```
### Automatic MTU selection
When Linux `wg-quick` selects an MTU automatically, it bases the tunnel MTU
on the smallest MTU it finds. A lower-MTU path can determine the tunnel setting
when paths differ.
### Conditional IPv4 sysctl writes
During IPv4 default-route setup, Linux `wg-quick` writes
`net.ipv4.conf.all.src_valid_mark=1` only if the current value differs.
This step can succeed in a network namespace that blocks sysctl writes when
the setting is already `1` there.
## Command output, logging, and C integration
### ANSI color
Set `WG_COLOR_MODE=always` to force ANSI colors or `WG_COLOR_MODE=never` to
disable them. With `auto`, an unset value, or an unrecognized value, `wg`
uses color only when writing to a terminal.
```sh
WG_COLOR_MODE=never wg show
```
### Debug and verbose logging
On OpenBSD and FreeBSD, run `ifconfig wg0 debug` to enable WireGuard debug
messages for `wg0`, then read them with `dmesg`.
Userspace WireGuard implementations conventionally enable verbose logging
when started with `LOG_LEVEL=verbose` in their environment.
### Endpoint storage in the embeddable C library
The embeddable library exposes a named `wg_endpoint` union, so C callers can
declare endpoint storage independently of a peer structure.