Skip to main content

Core

All changes on this tab require a service restart (except the interface language).

Controls

Buttons at the top of the settings:

  • Restart service - restart b4 (expected downtime: 5-10 seconds)
Reset configuration

When the configuration is reset, these are preserved: domains, GeoSite/GeoIP categories, and test settings. Everything else (network, DPI bypass, protocols, logging) is reset to defaults.

20260418225826

Queue and packet processing

Settings for the packet processing core over netfilter.

20260418225903

ParameterDescriptionRangeDefault
Starting queue numberNFQUEUE number. Change if other programs use the same numbers0-65535537
Packet marknetfilter mark for iptables/nftables rules. b4 uses it to mark processed packets-32768
Worker threadsNumber of parallel workers. More threads = higher throughput on multi-core systems1-164
TCP per-connection packet limitHow many TCP packets per connection to analyze. Sets cannot exceed this value1-10019
UDP per-connection packet limitHow many UDP packets per connection to analyze. Sets cannot exceed this value1-308
Packet limits

These limits are a global ceiling. Each set can define its own limit, but not above the global one. A higher value gives b4 more time to analyze but increases load.

Features

Protocols

ParameterDescriptionDefault
IPv4 supportProcess IPv4 trafficOn
IPv6 supportProcess IPv6 trafficOff

Firewall

20260418230000

ParameterDescriptionDefault
Skip IPTables/NFTables setupb4 will not create firewall rules. Use this if you manage rules manuallyOff
Firewall monitor intervalHow often to check and restore rules (seconds). If external programs delete rules, b4 will restore them10
Firewall engineWhich backend to use for rulesAuto-detect
NAT MasqueradeEnable NAT masquerading. Needed for containers and gateways where b4 forwards trafficOff
Masquerade interfaceInterface to apply masquerading on. Appears when NAT Masquerade is enabledAll
Monitor interval

Setting this to 0 turns off rule monitoring completely. If an external program or script removes b4's rules, they will not be restored.

Firewall engine options:

ValueDescription
Auto-detectb4 picks the available backend (recommended)
nftablesUse nftables
iptablesUse iptables
iptables-legacyUse iptables-legacy (for older systems)

Network interfaces

Pick interfaces to monitor. Interfaces are shown as clickable tags - click to enable/disable.

info

If no interface is selected, b4 listens on every available one.

Logging

20260418230040

ParameterDescriptionDefault
Log levelLog verbosityINFO
Error file pathFile to write errors to/var/log/b4/errors.log
TimezoneTimezone for timestampsSystem (auto)
Immediate flushFlush the buffer after every write. May affect performanceOn
SyslogAlso send logs to the system syslogOff

Log levels:

LevelWhat is shown
ErrorOnly errors
InfoErrors + main events
TraceInfo + packet processing details
DebugEverything, including debug info
Error level

At the Error level, the Logs and Connections sections in the web interface will not show data - they read from the log stream, which is almost empty at this level.

Error file

b4 does not keep a persistent log file - everything goes to stdout/stderr (and is captured by the web interface through a WebSocket). Only critical errors and crashes are written to errors.log.

tip

For diagnosing issues use Trace or Debug. For normal operation Info is enough.

Web server

Settings for the b4 web interface.

20260418230100

ParameterDescriptionDefault
Bind addressIP to listen on. 0.0.0.0 = all interfaces, 127.0.0.1 = localhost only, :: = all IPv60.0.0.0
PortWeb interface port7000
TLS CertificatePath to a .crt or .pem certificate file (empty = HTTP)-
TLS KeyPath to a .key or .pem key file (empty = HTTP)-
LanguageInterface language: English / РусскийEnglish

Authentication

ParameterDescriptionDefault
UsernameLogin for the web interface-
PasswordPassword-
Partial authentication

Authentication only applies when both fields are filled. If only the username or only the password is set, authentication stays off.

HTTP + authentication

If authentication is enabled but TLS is not configured, the username and password travel over unencrypted HTTP. Configure TLS certificates for secure transport. See the Security section.

SOCKS5 proxy

A built-in SOCKS5 proxy. Applications can route traffic through it - it is processed by b4 with the configured sets applied.

20260418230122

ParameterDescriptionDefault
EnableStart the SOCKS5 serverOff
Bind addressIP to listen on. 0.0.0.0 = all, 127.0.0.1 = localhost only0.0.0.0
PortProxy port1080
UsernameLogin for SOCKS5 authentication (empty = no authentication)-
PasswordPassword for SOCKS5 authentication (empty = no authentication)-

Every field except "Enable" becomes available only after the proxy is enabled.

info

Changes to SOCKS5 settings require a service restart.

MTProto proxy

A built-in Telegram MTProto proxy with fake-TLS obfuscation. Telegram traffic is wrapped in a TLS connection, masquerading as regular HTTPS. Detailed setup in the MTProto Proxy section.

20260418230138

ParameterDescriptionDefault
EnableStart the MTProto serverOff
Bind addressIP to listen on0.0.0.0
PortProxy port3128
Fake SNI domainThe domain visible in the TLS handshake. The DPI sees this domain instead of Telegramstorage.googleapis.com
DC RelayExternal relay address (host:port) for reaching Telegram DCs when they are IP-blocked-
SecretSecret for the Telegram client to connect. Paste it into the Telegram proxy settings-

The Generate Secret button creates a secret based on the current Fake SNI domain.

DC Relay

DC Relay is needed when b4 is installed on a router inside a country with blocking, and Telegram server IPs are blocked. A VPS outside the blocking area is used as the relay.

info

Changes to MTProto settings require a service restart.

Global MSS Clamping

Limits TCP Maximum Segment Size on SYN/SYN-ACK packets for port 443 traffic. A smaller MSS leads to natural fragmentation - the DPI cannot reassemble a fragmented ClientHello.

20260418230236

ParameterDescriptionRangeDefault
EnableTurn on global MSS Clamping-Off
MSS sizeMSS size in bytes. Lower = more fragmentation10-146088
Global vs per-device MSS

Global MSS Clamping applies to all port 443 traffic. To limit MSS only for specific devices (for example, a TV running YouTube), configure MSS in the MSS column of the device table below. Per-device MSS works independently of the global setting.

Device filtering

Limits b4 to traffic from specific devices on the network (by MAC address). Useful when bypass is not needed for every device.

20260418230312

ParameterDescriptionDefault
EnableTurn on device filteringOff
Vendor detectionDownload the vendor database to identify manufacturer by MAC (~6 MB)Off
Invert selectionToggle between allow list and deny listOff
Filter modes
  • Allow list (default) - DPI bypass works only for the selected devices
  • Deny list (invert selection) - selected devices are excluded from DPI bypass

Device table

When filtering is enabled, a table of discovered devices appears:

ColumnDescription
SelectCheckbox to include/exclude the device
MACMAC address
IPCurrent IP address
NameDevice alias (editable through the edit icon) or vendor
MSSPer-device MSS Clamping (10-1460, empty = off)

The Refresh button reloads the device list from the ARP table.

Per-device MSS

MSS Clamping can be set per device - for example, lowering the MSS only for a TV running YouTube without affecting other devices.