How to unblock Discord on a PS5

· Berkay Çelik

My biggest problem on the PS5 is the NBA 2K27 nights I play with friends every evening. We’ve min-maxed the thing so hard that even the delay in PlayStation’s own voice chat started to bother us :D So we said, fine, let’s move to Discord. And Discord is blocked in Turkey, of course.

On a PC you run GoodbyeDPI and move on, but you can’t install anything on a PS5 and it has no VPN setting either. All you get is a few fields in the network settings.

We got it working in one evening by putting a Raspberry Pi Zero next to the router. Quite a few things went wrong along the way and I wrote those down too, in the order they happened, including the parts where I was being dumb. The commands and config files are in the post in case you want to build the same thing.

I should say up front that Claude Code did most of the work. It was the one SSH’d into the Pi, running the commands and taking the measurements, while I plugged in cables, went through the PS5’s settings and typed back what I saw on the screen.

Why not on the router

The ISP is Turkcell Superonline and the router is the TP-Link EX530v they gave us. My first idea was to flash OpenWrt on the router and install zapret there, which would have unblocked Discord on every device in the house.

The EX530v is listed on OpenWrt’s site, but it isn’t officially supported and there’s no image to download. Installing it means opening the case and wiring into the serial port on the board, and if one step goes wrong the router may never boot again. Since the router belongs to the ISP, I didn’t try. I had a Raspberry Pi Zero 2 W at home that I’d set up a while ago, so I used that.

Flashing the Pi without a card reader

When I plugged the Pi in it didn’t show up on the network, and the green light on it kept blinking. It turns out the blinking is an error code and you have to count the blinks. On the first count I wasn’t sure if it was seven or eight, at one point the seventh looked longer to me, and in the end I decided they were all short. Seven short blinks means “kernel not found”, so the system on the SD card was broken and I had to rewrite the card.

I have an M4 MacBook Air, which has no SD card slot, and I don’t own a card reader. Luckily a Pi Zero tries to boot over USB when there’s no SD card in it, and Raspberry Pi’s rpiboot tool turns a Pi in that state into a card reader.

The ports on a Pi Zero 2 W and the steps for mounting its SD card on a Mac without a card reader

brew install libusb pkg-config
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot && make
./rpiboot -d mass-storage-gadget

Once the card showed up on the Mac as a disk, this is what I picked in Raspberry Pi Imager.

  • Device: Raspberry Pi Zero 2 W
  • OS: Raspberry Pi OS Lite (64-bit)
  • Hostname: pizero
  • WiFi: the SSID and password of the 2.4 GHz network at home, country TR
  • SSH: on

WiFi and a static IP

I wrote the card and plugged the Pi back in, but after seven minutes it still wasn’t on the network. The Zero 2 W only sees 2.4 GHz, and our router had 2.4 and 5 GHz on the same SSID (I had looked at the admin page and thought 2.4 GHz was switched off). We gave the two bands separate SSIDs, I pulled the Pi’s plug and put it back, and a minute later it connected. We did both at the same time, so I don’t know which one fixed it.

After that I copied the Mac’s SSH key to the Pi and we gave the Pi a static IP.

ssh-copy-id user@192.168.1.9

# On the Pi: "nmcli con show" tells you the connection name
sudo nmcli con mod "CONNECTION_NAME" ipv4.method manual \
  ipv4.addresses 192.168.1.250/24 ipv4.gateway 192.168.1.1 ipv4.dns 1.1.1.1

We had picked 192.168.1.250 assuming the router’s DHCP wouldn’t hand out addresses that high. When we checked later, it was handing out everything from 192.168.1.2 to 254, so we reserved that IP for the Pi in the router’s admin page.

How the block works

Before installing anything we looked at how Superonline blocks Discord, and found two separate layers.

Superonline blocking Discord in two layers, DNS and DPI

The first is DNS. When you ask the router’s DNS for discord.com, it returns an unrelated IP instead of Discord’s.

dig +short discord.com @192.168.1.1   # 195.175.254.2
dig +short discord.com @1.1.1.1       # 162.159.x.x, the real IPs

Switching DNS to 1.1.1.1 isn’t enough, because a connection to the real IP times out. A connection to the same IP with cloudflare.com as the SNI gets an answer.

# Same IP, two different SNIs
curl -m 8 --resolve discord.com:443:162.159.137.232 https://discord.com/          # times out
curl -m 8 -k --resolve cloudflare.com:443:162.159.137.232 https://cloudflare.com/  # 301

So there is a device on the path that reads the first packet of the TLS handshake and drops it when the SNI is Discord’s. That is the second layer, DPI.

GoodbyeDPI gets past this second layer, but it only runs on Windows. zapret does the same job on Linux, so that’s what we installed on the Pi.

zapret and the strategy that works

zapret’s binaries are in its GitHub releases. After downloading them we compared the files’ checksums against the published SHA-256 list.

V=v72.13
curl -sSLO https://github.com/bol-van/zapret/releases/download/$V/zapret-$V.tar.gz
curl -sSLO https://github.com/bol-van/zapret/releases/download/$V/sha256sum.txt
tar xzf zapret-$V.tar.gz
grep linux-arm64/ sha256sum.txt | sha256sum -c -
sudo mkdir -p /opt/zapret && sudo cp -a zapret-$V/. /opt/zapret/

The tool inside zapret that does the work is nfqws. It changes outgoing packets in ways the DPI can’t follow, there are many different strategies for that, and which one works depends on your ISP. We tried five and only the last one worked.

Strategy Result
multisplit cut off in 0.2 s
multidisorder cut off in 0.2 s
fake, TTL 3 timed out
fake + multisplit, TTL 3 cut off in 0.2 s
fake, md5sig worked

nfqws sending a fake packet first and slipping the real one through behind it

In the strategy that works, nfqws sends a fake packet ahead of the real handshake packet and adds a TCP MD5 signature option to it. The DPI looks at the fake packet and treats the connection as harmless. Discord’s server isn’t expecting an MD5 option, so it drops that packet, and the handshake then completes normally with the real packet that follows.

That result is for my line. On another ISP (maybe even at another exchange of the same ISP) a different strategy may be the one that works. zapret ships with blockcheck.sh, which runs these trials automatically.

First plan: the Pi as the gateway

A PS5 has no setting for sending only Discord traffic somewhere else, you enter a single gateway. If I made the Pi the gateway, all of the PS5’s traffic would go through the Pi’s 2.4 GHz WiFi and game downloads would drop to that speed, which I didn’t want.

The only packets nfqws needs to change are the ones leaving the PS5, so we tried this: set the Pi up as a router that doesn’t NAT, so outgoing packets pass through the Pi while incoming packets come straight back from the router to the PS5. We expected download speed to be unaffected that way.

In the first plan, outgoing packets go through the Pi and incoming ones come straight from the router

We tested with the Mac in place of the PS5 first.

Straight to the router Through the Pi
Ping 50 ms 52-53 ms
Download 389 Mbps 32 KB, then nothing
Upload 38 Mbps 31-34 Mbps
Discord blocked works

Discord opened and ping and upload stayed about the same, but the download stopped after 32 KB and didn’t continue even though we waited ten seconds.

I’m not sure why. My guess is that when the router sees one direction of a connection coming from one device and the other direction from a different one, it treats the ACKs as invalid and drops them. We didn’t dig into it because a simpler idea had come up by then.

The plan that works: change only DNS

In the second idea the PS5’s gateway stays the router, and we only enter the Pi as its DNS. When the PS5 asks for a Discord domain the Pi answers with its own IP, then takes the connection from the PS5, gets it past the DPI and passes it on to Discord. Traffic that isn’t Discord never reaches the Pi.

The three separate paths in the working plan: DNS, Discord and everything else

Three things run on the Pi: dnsmasq, nginx and nfqws. The first two come from apt.

sudo apt install -y --no-install-recommends nginx-light libnginx-mod-stream dnsmasq

We keep Discord’s domains in one file and all three read the list from it.

# /opt/ps5gw/discord-hosts.txt
discord.com
discordapp.com
discord.gg
discordapp.net
discord.media
discordcdn.com
discord.dev
discord.new
discord.gift
discord.gifts
discord.co
discord.app
discord.store
discord.design
discord.tools
discordstatus.com
discordapp.io
discordsays.com
discordactivities.com
dis.gd

When one of the domains in the list is queried, dnsmasq answers with the Pi’s IP. It forwards every other query to the router’s DNS, same as before.

{
  echo "interface=wlan0"
  echo "bind-dynamic"
  echo "no-resolv"
  echo "server=192.168.1.1"
  while read -r d; do
    echo "address=/$d/192.168.1.250"
    echo "local=/$d/"
  done < /opt/ps5gw/discord-hosts.txt
} | sudo tee /etc/dnsmasq.d/ps5gw.conf

We added the local= lines later. Without them dnsmasq was forwarding the IPv6 queries for those same domains to the router, and Superonline answers those with a fake IP too.

So the PS5 connects to nginx on the Pi thinking it’s talking to Discord. nginx doesn’t decrypt TLS (it couldn’t anyway), it only reads the SNI in the handshake and proxies the connection to that domain’s real IP.

# /etc/nginx/nginx.conf
user www-data;
worker_processes 1;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events { worker_connections 512; }

stream {
    # Real IPs have to come from 1.1.1.1, not from the dnsmasq next door
    resolver 1.1.1.1 1.0.0.1 valid=300s ipv6=off;

    map $ssl_preread_server_name $target {
        hostnames;
        default        127.0.0.1:9;   # not Discord: refuse
        .discord.com   $ssl_preread_server_name:$server_port;
        .discord.gg    $ssl_preread_server_name:$server_port;
        .discord.media $ssl_preread_server_name:$server_port;
        # same again for the other domains in the list
    }

    server {
        listen 443;
        listen 2053;
        listen 2083;
        listen 2087;
        listen 2096;
        listen 8443;
        ssl_preread on;
        proxy_connect_timeout 10s;
        proxy_timeout 30m;
        proxy_pass $target;
    }
}

nginx’s resolver has to be 1.1.1.1, because if it asked the dnsmasq next to it, it would get the Pi’s IP and connect to itself.

Connections leaving the Pi for Discord still pass through the DPI, so this is where nfqws adds the fake packet. An nftables rule decides which packets go to nfqws.

# /opt/ps5gw/rules.nft
table ip ps5gw {
  chain post {
    type filter hook postrouting priority mangle; policy accept;
    oifname "wlan0" meta mark & 0x40000000 == 0 tcp dport { 443, 2053, 2083, 2087, 2096, 8443 } @ih,0,8 0x16 queue num 200 bypass
  }
}

The @ih,0,8 0x16 part selects packets whose TCP payload starts with the byte 0x16, which are TLS handshakes, and the rest of the traffic doesn’t go to nfqws. The bypass at the end keeps traffic flowing if nfqws crashes.

This is the systemd service that starts nfqws and the rule on boot.

# /etc/systemd/system/ps5gw.service
[Unit]
Description=PS5 Discord DPI bypass (zapret nfqws)
After=network-online.target
Wants=network-online.target

[Service]
ExecStartPre=-/usr/sbin/nft delete table ip ps5gw
ExecStartPre=/usr/sbin/nft -f /opt/ps5gw/rules.nft
ExecStart=/opt/zapret/binaries/linux-arm64/nfqws --qnum=200 --hostlist=/opt/ps5gw/discord-hosts.txt --dpi-desync=fake --dpi-desync-fooling=md5sig
ExecStopPost=-/usr/sbin/nft delete table ip ps5gw
Restart=always
RestartSec=2

[Install]
WantedBy=multi-user.target
sudo systemctl enable --now ps5gw nginx dnsmasq

Before moving to the PS5 it’s worth testing from another computer on the same network. If the command below prints 200, the Pi side works.

curl -s -o /dev/null -w "%{http_code}\n" --resolve discord.com:443:192.168.1.250 https://discord.com/

On the PS5, go through Settings, Network, Settings, Set Up Internet Connection to Advanced Settings on the connection you use. Set DNS Settings to Manual and enter 192.168.1.250 as Primary DNS.

Problems that showed up later

When I logged in to Discord on the PS5 my servers showed up, but when I joined a voice channel the screen stayed on “joining”. Discord connects to its voice servers on Cloudflare’s other HTTPS ports instead of 443, and the address the PS5 was trying to reach turned out to be c-fra08-….discord.media:2053. We added 2053, 2083, 2087, 2096 and 8443 to nginx and to the nftables rule, which is why those ports are in the files above.

We also turned off WiFi power save on the Pi because it was adding delay.

printf "[connection]\nwifi.powersave = 2\n" | sudo tee /etc/NetworkManager/conf.d/wifi-powersave-off.conf

Another problem came from the secondary DNS. On the PS5 I had entered the Pi as Primary DNS and 1.1.1.1 as Secondary DNS. When we looked at the logs on the Pi, the PS5 had sent five queries in total and none of them were for Discord. Most likely the PS5 was asking 1.1.1.1 about Discord, getting the real IP, going there directly and hitting the block. Restarting the PS5 fixed it. I left Secondary DNS at 1.1.1.1 so that games keep working if the Pi goes down.

Where it stands now

Right now there’s no delay or dropouts in voice, and ping in game is the same as before. When we checked the Pi during a voice chat, the PS5 had four connections open and about 20 kbit/s was passing through the Pi, so the Pi is almost idle. Game, download and PSN traffic doesn’t reach the Pi (it couldn’t, IP forwarding is off on the Pi), and the audio goes straight from the PS5 to Discord over UDP.

It has downsides too. The Pi has to sit next to the router, and if it goes down, so does Discord. Discord’s message and file speed depends on the Pi’s WiFi. We measured 11 Mbps on a small file, which is enough for chat. The strategy also depends on the ISP: md5sig works on Superonline and may not work on another line.

All the config files and code are on GitHub: BerkayClik/ps5-discord-pi-zero.