Skip to content
Search Fedora

    Browse this documentation

    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.

    Terminal window
    sudo dnf install -y wireguard-tools

    Measured 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]
    Terminal window
    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/24
    ListenPort = 51820
    PrivateKey = <this-host-private-key>
    [Peer] # one section per remote peer
    PublicKey = <peer-public-key>
    AllowedIPs = 10.66.0.2/32
    Terminal window
    sudo systemctl enable --now wg-quick@wg0

    Measured status after start:

    $ sudo wg show wg0
    interface: wg0
    public key: IWFsr3DrtzFQKLYTDoIe65p9Le+XxHzTKFW3at2kpVw=
    private key: (hidden)
    listening port: 51527

    Stop 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:

    Terminal window
    sudo nmcli con add type wireguard con-name wg-office ifname wg-office \
    ipv4.method manual ipv4.addresses 10.66.0.2/24
    sudo nmcli con mod wg-office wireguard.private-key /etc/wireguard/office.key
    sudo 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-office

    Trade-offs against wg-quick:

    wg-quicknmcli
    config fileone .conf you can carry anywherespread across NetworkManager
    start timing[email protected], up at bootper profile, can wait for user login
    desktop integrationnoneGNOME/KDE network menu toggle
    route takeoverautomatic (Table=on-link)manual ipv4.routes

    Servers take wg-quick; laptops take nmcli — the parameters map one to one, migration is just different syntax.

    Quickly prove keys and links without touching config files:

    Terminal window
    sudo ip link add dev wg0 type wireguard
    echo "$WG_PRIV" > /tmp/wg.key && sudo wg set wg0 private-key /tmp/wg.key
    sudo ip addr add 10.66.0.1/24 dev wg0
    sudo ip link set wg0 up
    sudo wg show wg0
    sudo ip link del wg0 # clean up when done

    Note 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.

    Forwarding (for multi-node VPNs):

    Terminal window
    echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/99-wg-forward.conf
    sudo sysctl --system

    Open the port (pairs with firewalld):

    Terminal window
    sudo firewall-cmd --add-port=51820/udp --permanent
    sudo firewall-cmd --reload
    SymptomCause
    fopen: No such file or directoryprivate-key <(...) not supported; write the key to a file first
    wg-quick refuses the private keypermissions wider than 600
    handshake OK but no trafficpeer AllowedIPs excludes your source, or server lacks ip_forward
    only some sites failMTU with AllowedIPs = 0.0.0.0/0; add MTU = 1420
    nmcli says Insufficient privilegeswireguard connections need root to create
    SELinux denies dnsmasq-style servicesunrelated to WireGuard — SELinux restricts to dns_port_t (53/853); label custom ports with semanage port -a