Skip to main content

DPI bypass for Linux routers

b4 changes how packets of selected sites look to the provider’s DPI.

Installation guide
curl -fsSL https://raw.githubusercontent.com/DanielLavrushin/b4/main/install.sh | sh

Run it over SSH as root.

The b4 dashboard: service status, connections per minute and the sets that matched them

How it works

Providers that block sites with DPI read the site name from the first packets of a connection, and reset or slow down connections to sites on their list. b4 changes how those first packets look: it splits them, reorders them or sends a fake one ahead.

Without b4

DPI reads the name and resets the connection

With b4

The name arrives in pieces and the site gets the same request

What b4 does

Everything is configured as sets. A set is a list of sites, plus what b4 should do with their traffic.

Discovery

Discovery tries b4's strategies on the router’s own connection and shows which one opens the site. The one that works can be saved as a set. A run takes 1 to 10 minutes.

How Discovery works
The Discovery page during a run: the stages of the search and the sites tested so far

Devices

Installed on the router, b4 handles traffic from every device on the network: phones, TVs, consoles. A set can also apply to specific devices only.

Selecting devices
The Source Devices tab of a set: the devices the set applies to

Watchdog

The watchdog re-checks a set’s sites on a schedule. If they keep failing, it runs Discovery for the set and switches it to the strategy it finds, or back to the old one if the sites still fail. It’s off by default.

Keeping sets working
The Watchdog panel in the settings, with the switch that turns monitoring on

Routing and blocking

Sites blocked by IP can go through a VPN interface on the router, or through Xray, sing-box or any other SOCKS5 proxy. A block set drops ads and trackers for the whole network.

VPN and proxy routing
The Sets panel of the dashboard: each set marked Bypass, Proxy, Block or Route

Web interface

Dashboard, live traffic and logs on port 7000, in English or Russian. Changes to sets apply without a restart.

First steps
The Traffic page: connections of each device and the sets they matched
The Discovery page during a run: the stages of the search and the sites tested so far
The Source Devices tab of a set: the devices the set applies to
The Watchdog panel in the settings, with the switch that turns monitoring on
The Sets panel of the dashboard: each set marked Bypass, Proxy, Block or Route
The Traffic page: connections of each device and the sets they matched

Sites that aren’t in a set work exactly as they did before b4 was installed.

Supported platforms

OpenWrt, ASUS Merlin, Keenetic and other Linux systems use the same install script. On MikroTik and in Docker, b4 runs as a container.

Builds for 17 CPU architectures
  • amd64
  • 386
  • arm64
  • armv5
  • armv6
  • armv7
  • mips
  • mipsle
  • mips_softfloat
  • mipsle_softfloat
  • mips64
  • mips64le
  • loong64
  • ppc64
  • ppc64le
  • riscv64
  • s390x

Needs kernel 3.13 or newer, about 64 MB of free RAM, 30 MB of disk and root. Full requirements

Common questions

Something not working after install? See Troubleshooting.

Is b4 a VPN?

No. Traffic still goes straight to the site. b4 only changes how the first packets of each connection look to the provider’s DPI. If some sites need a VPN, a route set can send them through one that’s already running on the router.

Where does it run?

OpenWrt 18.06+, ASUS Merlin, Keenetic, MikroTik with RouterOS 7.21.1+ (as a container), Linux computers and servers, and Docker on Linux. There are builds for 17 CPU architectures.

What does the router need?

Linux kernel 3.13 or newer with NFQUEUE support, or the TUN engine where NFQUEUE is missing. About 64 MB of free RAM, 30 MB of disk and root access.

Does b4 touch sites that aren’t in a set?

No. Connections that don’t match any set pass through unchanged.

What if a site still doesn’t open?

If Discovery reports address blocked, the provider blocks the site’s IP addresses and changing packets won’t help. Such a site needs a set that sends it through a VPN or a SOCKS5 proxy.

What happens when the provider changes its blocking?

Turn on the watchdog. It re-checks the sites of selected sets on a schedule, and when they stop opening it runs Discovery again and switches the set to a new strategy.

Does it help with Telegram?

Yes. b4 has a built-in MTProto proxy, and a bridge that works with the regular Telegram apps.

Do changes need a restart?

Changes to sets don’t. They apply to the running service as soon as they’re saved.

Can it block ads?

Yes. A block set blocks ads and unwanted sites for the whole network.

How do I remove it?

Run the installer with --remove. It stops b4, removes its firewall and routing rules and the service, and asks before deleting the config.

Is it free?

Yes. It’s open source under GPLv3, and the code is on GitHub.

Getting started

Installation guide
curl -fsSL https://raw.githubusercontent.com/DanielLavrushin/b4/main/install.sh | sh

Run it over SSH as root.

MikroTik and Docker run b4 as a container, and the guide covers both.

1.93.0Released November 21, 2026
  1. Install

    Run the install command over SSH as root. It detects the platform and the CPU architecture.

  2. Find a strategy

    Open the web interface on port 7000, go to Discovery, enter a site that doesn’t open and press Start.

    First steps
  3. Apply it

    Press Apply as a set on the result. The Traffic page then shows the set’s name next to that site’s connections.

    Sets