WireGuard on Fedora: kernel module, wg-quick, and NetworkManager
WireGuard on Fedora 45 is entirely in-kernel (the module ships with the kernel; lsmod shows wireguard 122880 measured). No DKMS needed — wireguard-tools only provides the CLI.
Install
Section titled “Install”sudo dnf install -y wireguard-toolsMeasured version 1.0.20260223. You get:
/usr/bin/wg # config and status/usr/bin/wg-quick # up/down by config file/usr/lib/systemd/system/[email protected]Generate a key pair
Section titled “Generate a key pair”WG_PRIV=$(wg genkey)WG_PUB=$(echo "$WG_PRIV" | wg pubkey)echo "priv: ${WG_PRIV:0:8}... pub: ${WG_PUB:0:8}..."One pair per node, and the private key file must be mode 600 — wg-quick refuses overly readable keys.
Route one: wg-quick (config file, best for servers)
Section titled “Route one: wg-quick (config file, best for servers)”/etc/wireguard/wg0.conf:
[Interface]Address = 10.66.0.1/24ListenPort = 51820PrivateKey = <this-host-private-key>
[Peer] # one section per remote peerPublicKey = <peer-public-key>AllowedIPs = 10.66.0.2/32sudo systemctl enable --now wg-quick@wg0Measured status after start:
$ sudo wg show wg0interface: wg0 public key: IWFsr3DrtzFQKLYTDoIe65p9Le+XxHzTKFW3at2kpVw= private key: (hidden) listening port: 51527Stop with sudo systemctl stop wg-quick@wg0 (also removes the interface).
Route two: nmcli (desktops/laptops, follows the user session)
Section titled “Route two: nmcli (desktops/laptops, follows the user session)”nmcli supports the wireguard type natively, measured:
sudo nmcli con add type wireguard con-name wg-office ifname wg-office \ ipv4.method manual ipv4.addresses 10.66.0.2/24sudo nmcli con mod wg-office wireguard.private-key /etc/wireguard/office.keysudo nmcli con add type wireguard-peer con-name wg-office-peer1 \ master wg-office wireguard-peer.public-key "<server-public-key>" \ wireguard-peer.allowed-ips "10.66.0.0/24"sudo nmcli con up wg-officeTrade-offs against wg-quick:
| wg-quick | nmcli | |
|---|---|---|
| config file | one .conf you can carry anywhere | spread across NetworkManager |
| start timing | [email protected], up at boot | per profile, can wait for user login |
| desktop integration | none | GNOME/KDE network menu toggle |
| route takeover | automatic (Table=on-link) | manual ipv4.routes |
Servers take wg-quick; laptops take nmcli — the parameters map one to one, migration is just different syntax.
Manual interface for debugging
Section titled “Manual interface for debugging”Quickly prove keys and links without touching config files:
sudo ip link add dev wg0 type wireguardecho "$WG_PRIV" > /tmp/wg.key && sudo wg set wg0 private-key /tmp/wg.keysudo ip addr add 10.66.0.1/24 dev wg0sudo ip link set wg0 upsudo wg show wg0sudo ip link del wg0 # clean up when doneNote that process substitution (private-key <(echo ...)) measured failing with fopen: No such file or directory — wg wants a real file path, so write it to disk first.
Two more things on a server
Section titled “Two more things on a server”Forwarding (for multi-node VPNs):
echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/99-wg-forward.confsudo sysctl --systemOpen the port (pairs with firewalld):
sudo firewall-cmd --add-port=51820/udp --permanentsudo firewall-cmd --reloadCommon traps
Section titled “Common traps”| Symptom | Cause |
|---|---|
fopen: No such file or directory | private-key <(...) not supported; write the key to a file first |
| wg-quick refuses the private key | permissions wider than 600 |
| handshake OK but no traffic | peer AllowedIPs excludes your source, or server lacks ip_forward |
| only some sites fail | MTU with AllowedIPs = 0.0.0.0/0; add MTU = 1420 |
| nmcli says Insufficient privileges | wireguard connections need root to create |
| SELinux denies dnsmasq-style services | unrelated to WireGuard — SELinux restricts to dns_port_t (53/853); label custom ports with semanage port -a |
Related pages
Section titled “Related pages”- firewalld — allow UDP 51820
- Networking and nmcli — connection management basics
- journalctl — read wg-quick output while debugging
- Upstream: WireGuard quickstart