Candid photograph of a Linux server terminal with a soft olive-green glow against a dark slate background, conveying a calm technical atmosphere.

Step-by-step guides for system administrators — covering command-line basics, web server setup, and preparation material for technical interviews.

Browse Tutorials

Setting up a WireGuard VPN tunnel on Fedora

WireGuard gives Fedora administrators a fast, compact VPN for remote access and site-to-site links. Its Linux kernel support means a deployment mainly needs the WireGuard tools, careful key handling and a reachable UDP endpoint.

This guide uses a Fedora server as the gateway and Fedora, Android or iOS clients as peers. The same foundation supports full tunnels, split routing or permanent branch links.

Endpoint placement matters in Australia. Many NBN services across Sydney, Melbourne, Brisbane and Perth use carrier-grade NAT, which prevents forwarded UDP from reaching home servers. A VPS with a public IPv4 address in an Australian region, such as AWS Sydney or Azure East Australia, avoids this and is available from local hosting providers.

Privacy and legal duties also matter. The Privacy Act 1988 and Australian Privacy Principles may apply when an organisation stores identifiable connection data. The Telecommunications and Other Legislation Amendment (Assistance and Access) Act 2018 may affect providers of covered services, but does not make ordinary private VPN use unlawful.

Why WireGuard fits Fedora deployments

WireGuard has fewer options than older VPN stacks, reducing complexity while retaining strong cryptography and efficient roaming. Its peer model uses public keys rather than accounts, certificates or a central client database.

Fedora packages wg and wg-quick, while the kernel handles the tunnel, keeping administration scriptable with systemd. The distribution-focused scope is described in about Linuxtpoint.

Prepare the server and keys

On Fedora Server, install WireGuard and firewalld. Fedora’s default public zone normally permits SSH; verify this before changing a remote session.

sudo dnf install -y wireguard-tools firewalld
sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-port=51820/udp
sudo firewall-cmd --reload

Generate the server keypair in a root-only directory. Only public keys belong in the opposite endpoint’s configuration.

sudo install -d -m 700 /etc/wireguard
sudo sh -c 'umask 077; wg genkey > /etc/wireguard/server.key'
sudo sh -c 'wg pubkey < /etc/wireguard/server.key > /etc/wireguard/server.pub'

On each client, set umask 077, run wg genkey | tee client.key | wg pubkey | tee client.pub, and copy only client.pub to the server.

Server readiness checks

Confirm a stable public IPv4 address or dynamic DNS. Allow UDP 51820 through cloud and local firewalls. Synchronise time with chronyd to reject stale timestamps, and encrypt private-key backups while protecting configuration files.

With NBN at home, forward UDP 51820 to the Fedora server and use dynamic DNS. Under carrier-grade NAT, forwarding cannot create a public path, so use the VPS.

Compare routing choices

AllowedIPs controls peer routing and valid source addresses. Choose the narrowest route that still meets the user’s needs.

Mode AllowedIPs Strength Trade-off
Full tunnel 0.0.0.0/0 All traffic uses one egress More latency
Split tunnel 10.10.0.0/24 plus selected LANs Normal browsing stays local Unlisted traffic is unprotected
Site-to-site Remote LAN ranges on each peer Permanent branch access Routing and peer upkeep

Australian users commonly switch between NBN at home and 5G while commuting. Split tunnelling preserves local browsing and reduces mobile data use, while a full tunnel provides consistent gateway egress.

If split routing includes an office LAN, CentOS file services can sit behind the tunnel. The simple NFS file share gives a CentOS export example; keep NFS off the public internet and limit its export and firewall rules to the intended VPN and LAN ranges.

Configure the tunnel

Enable IPv4 forwarding and create a dedicated firewalld zone for routed clients and NAT.

echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-wireguard.conf
echo 'net.ipv4.conf.all.accept_redirects=0' | sudo tee -a /etc/sysctl.d/99-wireguard.conf
sudo sysctl --system
sudo firewall-cmd --permanent --new-zone=wireguard
sudo firewall-cmd --permanent --zone=wireguard --add-interface=wg0
sudo firewall-cmd --permanent --zone=wireguard --add-masquerade
sudo firewall-cmd --permanent --zone=wireguard --add-forward
sudo firewall-cmd --permanent --zone=wireguard --set-target=ACCEPT
sudo firewall-cmd --reload

Create /etc/wireguard/wg0.conf with the server key and first peer, then run sudo chmod 600 /etc/wireguard/wg0.conf.

[Interface]
Address = 10.10.0.1/24
ListenPort = 51820
PrivateKey = <server private key>

[Peer]
PublicKey = <client public key>
AllowedIPs = 10.10.0.2/32

On the Fedora client, install the peer configuration at /etc/wireguard/wg0.conf; mobile users can import it through the official app.

[Interface]
PrivateKey = <client private key>
Address = 10.10.0.2/32
DNS = 1.1.1.1

[Peer]
PublicKey = <server public key>
Endpoint = vpn.example.au:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

Disable client IPv6 or add ::/0 only after configuring IPv6 forwarding. Transfer client configurations through an encrypted channel because each file contains a private key.

Operate and verify the connection

Activate the interface, inspect peer state and test the gateway address.

sudo systemctl enable --now wg-quick@wg0
sudo wg show
ping -c 3 10.10.0.1
sudo journalctl -u wg-quick@wg0 -f

A recent handshake and successful ping confirm traffic is moving. For a VPS endpoint, also verify that its cloud security group permits UDP 51820.

For a small team needing a readable status page, a WordPress front end can display peer availability. This custom template hierarchy example shows how templates and hooks can separate status data from presentation; private keys and client addresses should never be published.

Routine maintenance checks

Check sudo wg show wg0 latest-handshakes for stale peers. Review unit failures in journalctl after Fedora or WireGuard updates. Rotate credentials when a device is lost or decommissioned, and recheck peer routes and firewall rules quarterly.

The next checkpoint is a completed first handshake: the client public key is placed in the server peer block, wg-quick@wg0 is started, and sudo wg show should display a recent handshake.