Skip to content

Instantly share code, notes, and snippets.

@tonyAndr
Last active June 13, 2026 04:52
Show Gist options
  • Select an option

  • Save tonyAndr/4880614b94ca17f5c64b9324ea512c24 to your computer and use it in GitHub Desktop.

Select an option

Save tonyAndr/4880614b94ca17f5c64b9324ea512c24 to your computer and use it in GitHub Desktop.
Fix Wi-Fi Ping Spikes on Linux (Gaming)

Fix Wi-Fi Ping Spikes on Linux (Realtek/Fedora)

This guide fixes periodic ping spikes (100ms+) on Linux, specifically targeting Realtek cards (like RTL8852BE) that struggle with WiFi 6 (802.11ax) or aggressive power saving.

Prerequisites

Identify your interface name (e.g., wlo1) and driver:

ip link show
lspci -nnk | grep -iA3 net

Replace <YOUR_INTERFACE> below with your actual interface name.


Step 1: Disable NetworkManager Power Saving

Prevents the OS from putting the card to sleep during inactivity.

  1. Create config file:

    sudo tee /etc/NetworkManager/conf.d/wifi-powersave.conf <<EOF
    [connection]
    wifi.powersave=2
    EOF

    (Note: 2 means "Disable Power Save")

  2. Apply immediately:

    sudo iw dev <YOUR_INTERFACE> set power_save off

Step 2: Configure Realtek Driver (The Fix)

Disables hardware-level sleep (ASPM) and forces WiFi 5 (AC) mode, as WiFi 6 implementation on these drivers is often unstable.

  1. Create driver options file:

    sudo tee /etc/modprobe.d/rtw89.conf <<EOF
    options rtw89_core disable_ps_mode=Y disable_11ax=Y
    options rtw89_pci disable_aspm_l1=Y disable_aspm_l1ss=Y
    EOF

    Note: disable_11ax=Y turns off WiFi 6, which cures the micro-stutters.

  2. Reboot your system.


Step 3: Lock BSSID (Optional Stability)

If you have a Mesh system or many routers nearby, this stops the card from scanning for "better" signals in the background.

  1. Find your router's BSSID (MAC Address):

    nmcli -f IN-USE,SSID,BSSID dev wifi

    (Copy the BSSID from the line with the *)

  2. Lock the connection:

    nmcli connection modify "YOUR_WIFI_SSID" 802-11-wireless.bssid "YOUR_BSSID_HERE"

Verification

After rebooting:

  1. Check Power Save is OFF:

    iw dev <YOUR_INTERFACE> get power_save
    # Output should be: Power save: off
  2. Check WiFi 6 is OFF:

    iw dev <YOUR_INTERFACE> link
    # "tx bitrate" should say VHT (WiFi 5), not HE (WiFi 6)
  3. Check Driver Options:

    cat /sys/module/rtw89_core/parameters/disable_11ax
    # Output should be: Y

What We Did

  • wifi.powersave=2: Stops OS from requesting sleep.
  • disable_11ax=Y: Forces card to use WiFi 5 (AC). Realtek's WiFi 6 (AX) stack often buffers packets, causing spikes.
  • disable_aspm_l1/l1ss: Prevents PCIe lane from powering down (fixes "waking up" lag).
  • BSSID Lock: Prevents background roaming scans.
@ssstierghoul

Copy link
Copy Markdown

Just what I was looking for!
Helped me out a ton! Thank you very much for this!

@tonyAndr

tonyAndr commented Dec 1, 2025

Copy link
Copy Markdown
Author

Just what I was looking for! Helped me out a ton! Thank you very much for this!

I'm glad it helped! I still had some issues afterwards, but disabling ax mode helped (updated gist)

@ssstierghoul

Copy link
Copy Markdown

I see the change! I had issues with microstutter, but everything else already helped me like day and night, so I was content with what I had. Right now, I have disabled ax mode too, and hopefully this will help too!
Once again, thank you very much!

@FizIVD

FizIVD commented Dec 4, 2025

Copy link
Copy Markdown

Thanks! Really works! All the LLMs were silent about it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment