Skip to content
vamola.devv2.4 · online

Gaming & Network Optimization

Last Updated: 2026-11-25·Reading Time: 4 min·Network / Gaming
Two paths from a gaming PC: game traffic goes through WireGuard, everything else takes the normal route.

Send selected game traffic through a Cloudflare WARP WireGuard tunnel, apply a few safe kernel and Wi-Fi settings, and measure whether any of it helps.

Overview

This guide sets up split routing: only the game traffic you choose goes through a WireGuard tunnel to Cloudflare WARP. Everything else keeps using your normal connection.

Measure before you keep it

WARP does not make every connection faster. On some ISPs it gives a shorter or less congested route to a game server, on others it adds a hop and raises your ping. Section 4 shows how to compare both routes with mtr. If the tunnel is not clearly better for your game, turn it off.

nftables marks game traffic, marked packets use the WireGuard tunnel to the game server, everything else stays on the normal route.
Split routing: only the marked game traffic goes through WireGuard.

Prerequisites

Requirements

Root access, and Arch Linux with the wireguard-tools, wgcf and nftables packages. The nftables rules in this guide were syntax-checked with nft -c on kernel 7.3. The tunnel itself needs a free Cloudflare WARP account. It was not tested end to end for this guide, so check every step with the commands in section 4.


1. Create a WARP WireGuard profile

Cloudflare's own warp-cli client is a full-tunnel VPN and cannot export a WireGuard profile. For split routing we use wgcf, an unofficial open-source tool that registers a free WARP account and writes a normal WireGuard config.

Terminal (bash)
sudo pacman -S wgcf wireguard-tools

mkdir -p ~/warp && cd ~/warp
wgcf register       # creates wgcf-account.toml
wgcf generate       # creates wgcf-profile.conf
Do not run the official WARP client at the same time

If you use cloudflare-warp-bin (AUR), keep it disconnected while this tunnel is up. Two WARP tunnels fight over routes.

Now turn that profile into the split-routing config. Copy PrivateKey, the IPv4 Address and the PublicKey from wgcf-profile.conf, and change the rest as shown:

/etc/wireguard/warp.conf
[Interface]
PrivateKey = <PrivateKey from wgcf-profile.conf>
Address = <the IPv4 address from wgcf-profile.conf, e.g. 172.16.0.2/32>
MTU = 1280
# Do not touch the main routing table or DNS: only marked packets use this tunnel
Table = off
PostUp = ip rule add fwmark 0x1234 table 1234; ip route add default dev %i table 1234; sysctl -q net.ipv4.conf.%i.rp_filter=2
PostDown = ip rule del fwmark 0x1234 table 1234; ip route del default dev %i table 1234

[Peer]
PublicKey = <PublicKey from wgcf-profile.conf>
AllowedIPs = 0.0.0.0/0
Endpoint = engage.cloudflareclient.com:2408
PersistentKeepalive = 25
Terminal (bash)
sudo install -d -m 700 /etc/wireguard
sudoedit /etc/wireguard/warp.conf      # paste the config above
sudo chmod 600 /etc/wireguard/warp.conf
sudo wg-quick up warp

Three details matter here. Table = off keeps wg-quick from sending all your traffic through the tunnel. There is no DNS line, so your DNS settings stay as they are. And rp_filter=2 on the tunnel interface stops Arch's strict reverse-path filter from dropping the replies that come back through it.

The config file name sets the interface name (warp.conf gives warp), and the nftables rule in the next section refers to that name.


2. Mark game traffic with nftables

/etc/nftables.d/gaming.nft
table inet gaming {
chain output {
  type route hook output priority mangle; policy accept;

  # Steam / Source engine game traffic (UDP only, so downloads stay on the normal route)
  udp dport 27015-27030 counter meta mark set 0x1234

  # Add your own game here, by server IP range or by port, for example:
  # ip daddr 203.0.113.0/24 counter meta mark set 0x1234
  # udp dport 7777 counter meta mark set 0x1234
}
}

# Packets that leave through the tunnel must carry the tunnel address
table ip warp_nat {
chain postrouting {
  type nat hook postrouting priority srcnat; policy accept;
  oifname "warp" masquerade
}
}

Games send their own traffic from this computer, so the rules sit on the output hook and match the destination port (dport). Arch's default /etc/nftables.conf only removes and re-creates its own inet filter table, so these tables are left alone. Make it load at boot:

Terminal (bash)
sudo mkdir -p /etc/nftables.d      # then save the rules above as gaming.nft in it
echo 'include "/etc/nftables.d/*.nft"' | sudo tee -a /etc/nftables.conf
sudo systemctl enable --now nftables
sudo nft -f /etc/nftables.d/gaming.nft

If the tunnel is down, marked packets simply use the normal route, because the ip rule only exists while warp is up.


3. Safe system tweaks

These only affect TCP and Wi-Fi. They do not lower the ping of UDP game traffic by themselves, but they help downloads and give you a steadier Wi-Fi link.

/etc/sysctl.d/99-network.conf
# BBR congestion control with the fq queue
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

# Recover when a link silently drops large packets
net.ipv4.tcp_mtu_probing = 1

# Larger socket buffers for fast connections
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
Terminal (bash)
echo tcp_bbr | sudo tee /etc/modules-load.d/bbr.conf
sudo modprobe tcp_bbr
sudo sysctl --system
sysctl net.ipv4.tcp_congestion_control

Turn Wi-Fi power saving off, because it adds latency spikes. A cable is still better than any Wi-Fi setting.

/etc/NetworkManager/conf.d/wifi-powersave.conf
[connection]
# 2 = disable power saving
wifi.powersave = 2
Terminal (bash)
sudo systemctl restart NetworkManager

# Check the result (the interface name comes from "iw dev")
iw dev
iw dev wlan0 get power_save

On a laptop, power-profiles-daemon is the safe way to ask for more performance, with powerprofilesctl set performance. Avoid pinning CPU cores or disabling CPU idle states by hand: it heats the machine and drains the battery, and it rarely helps a game.


4. Verify & compare

Terminal (bash)
# Is the tunnel up, and is traffic flowing? ("warp=on" means it reaches Cloudflare WARP)
sudo wg show
curl -s --interface warp https://www.cloudflare.com/cdn-cgi/trace | grep warp

# Are game packets being marked? The counter should rise while you play
sudo nft list table inet gaming

# Compare the two routes to your game server (use its real IP address)
sudo wg-quick down warp
mtr -rwzc 50 <game-server-ip>
sudo wg-quick up warp
mtr -rwzc 50 <game-server-ip>

Look at the average (Avg), the worst (Wrst) and the loss (Loss%) of the last hop. Keep the tunnel only if it is clearly better for your game over several tries and different times of day.


5. Launch options & overlay

For most games these are the useful Steam launch options, one command per game:

text
gamemoderun %command%
mangohud %command%

Install them with sudo pacman -S gamemode mangohud. A small MangoHud overlay:

~/.config/MangoHud/MangoHud.conf
fps
frametime
frame_timing
cpu_stats
gpu_stats
ram
vram
position=top-left
font_size=22
background_alpha=0.6

6. Monitoring & debugging

Terminal (bash)
# Live system view
btop

# WireGuard status and transfer counters
sudo wg show

# Watch the game packets that actually enter the tunnel
sudo tcpdump -i warp -nn udp

# Latency over time
mtr -rwzc 100 1.1.1.1
Last checked

Package names and the nftables syntax were checked on Arch Linux on 2026-11-25. If a command fails for you, the wgcf project page and the Arch Wiki pages for WireGuard and nftables are the first places to look.