NatBypass
P2P Mesh VPN & DPI Bypass — direct socket-to-socket mesh connectivity for computers, servers, phones, and routers across all types of NAT/CGNAT without requiring dedicated relay servers.
📚 Official Knowledge Base (Wiki)
Comprehensive documentation and step-by-step guides are available in our NatBypass Wiki:
- 🚀 Quick Start in 5 minutes — connect your first P2P pair of devices without console commands.
- 🛡️ Censorship Bypass (AmneziaWG) — tuning Jc, Jmin, Jmax, S1, S2, H1..H4 parameters against deep packet inspection (DPI / TSPU).
- 🌐 Keenetic Routers (Entware) & OpenWrt — 1-command installation and daemon service setup.
- 📱 Android Guide — connect via QR code, interactive on-screen QR display, and native VpnService.
- 🪟 Windows Guide — native GUI, system tray, Wintun driver, and server background mode.
- 🧪 Updating & Beta Channel — 1-click upgrade instructions for Windows, Linux, routers, and Android.
- 🔧 Diagnostics and Troubleshooting — universal diagnostic scripts and end-to-end ICMP ping verification.
- ⚡ Multi-Tier NAT Traversal — 5-tier CGNAT bypass, ⚡ Coordinator and 🛡️ Relay badge guide.
✨ Key Features
- ⚡ Pure P2P UDP Mesh: Direct datagram communication between peers via STUN UDP Hole Punching without renting VPS servers.
- 🛡️ AmneziaWG Obfuscation: Built-in Deep Packet Inspection (DPI) protection with custom obfuscated headers (H1..H4), junk packets (Jc, Jmin, Jmax), header protection, and content padding randomization (S1, S2).
- 🌐 Internet Exit Node Gateway: Any node (Keenetic, Linux server, Windows PC, or Android) can act as a secure Internet Gateway with full DNS leak protection (
1.1.1.1,8.8.8.8) and physical gateway bypass routing. - 📡 Multi-Channel Signaling: Peer discovery and endpoint exchange via Telegram Bot API, MQTT, Cloudflare DNS TXT, and HTTP Webhooks with NaCl/Box E2E encryption (X25519 + XSalsa20-Poly1305).
- 🚀 Embedded Router Optimizations: Zero CGO pure Go runtime,
sync.Pool64KB packet buffers, GC memory bounding to 48MB RAM, asynchronous diode logging — running reliably on 64–128MB RAM MIPS/ARM routers (Keenetic, OpenWrt). - 🔄 Hot Dynamic Configuration: Instant room/topic switching, obfuscation profile reload, and Virtual IP updates without restarting the daemon.
- 🔍 Automated Diagnostic Suite: Built-in dynamic peer discovery and L3 ICMP testing across all platforms.
- 📱 Android 10–15 All-in-One: Native asynchronous VpnService (
systemExempted), on-screen interactive QR sharing, and Quick Settings Tile. - 🪟 Native Windows GUI: Ultra-lightweight non-CGO interface (15–25MB RAM, no Electron/WebView2 bloat), system tray integration, supporting Windows 10/11 and Server editions.
- 🔐 Isolated Mesh Profiles: Manage multiple isolated mesh rooms ("Home", "Office", "Servers") with seamless on-the-fly switching.
🔍 Universal Diagnostic Tools
NatBypass includes a fully dynamic diagnostic suite that queries the local daemon, discovers all connected mesh nodes, tests end-to-end L3 ICMP ping to each peer with zero packet loss verification, and audits network stack health, STUN endpoints, NAT classification, and routing tables.
🐧 Linux / KeeneticOS / OpenWrt
Run in one command (no extra dependencies required):
wget -qO- https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/scripts/diag.sh | sh(or via curl: curl -fsSL https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/scripts/diag.sh | sh)
If natbypass binary is already installed in your path:
natbypass diag🪟 Windows (PowerShell)
Run the diagnostic script as Administrator:
irm https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/scripts/diag.ps1 | iex(or via CLI: .\NatBypass.exe diag)
🏗️ P2P Network Architecture
┌──────────────────────────────────────────────────────────┐
│ Signaling Channels (E2EE) │
│ [Telegram Bot] ── [MQTT Broker] ── [Cloudflare DNS/Web] │
└────────▲────────────────────────────────────────▲────────┘
│ (encrypted beacons) │
│ │
┌─────────────┴──────────┐ ┌──────────┴─────────────┐
│ Device A │ │ Device B │
│ STUN Discovery │ │ STUN Discovery │
│ Windows App (Wintun) │ │ Keenetic / Linux / Android
│ VIP: 100.64.200.1 │ │ VIP: 100.64.200.2 │
└─────────────┬──────────┘ └──────────┬─────────────┘
│ │
└─────────── Direct UDP Socket ──────────┘
(P2P Mesh / AmneziaWG)⚡ How Multi-Tier NAT Traversal Works
NatBypass features an autonomous 5-tier NAT Traversal architecture designed to connect mobile clients behind symmetric cellular CGNAT (LTE/5G) directly or via mesh relays without requiring dedicated servers:
| Tier | Technology | Description |
|---|---|---|
| Tier 1 | IPv6 Dual-Stack P2P | Dual-stack AAAA STUN discovery and direct socket-to-socket IPv6 data path bypassing IPv4 CGNAT. |
| Tier 2 | DPI Drop Detection | Detects deep packet inspection drop (10 unacked probes) and temporarily escalates to awg31_strict for 10 minutes. |
| Tier 3 | Leader-Coordinated Punch | Millisecond-precision synchronized port opening orchestrated by a Cone NAT mesh coordinator. |
| Tier 4 | ASN-Aware Port Prediction | Selective port delta prediction (+2, +4) using cellular ASN rules; random pools are skipped to save battery. |
| Tier 5 | Peer-as-Relay | Transparent E2EE transit through trusted home router/server nodes within daily quotas (5 GB/day default). |
🎯 WebUI & Android Badges Explained:
- ⚡ Coordinator (
coordinator_capable) — Node with Full-Cone NAT or public IP. Coordinates synchronized bilateral port punches between mobile peers. - 🛡️ Relay (
relaycapable) — Node (Keenetic router, Linux server, or PC) withenablerelay_server: true. Relays encrypted traffic when direct UDP is completely blocked by carrier CGNAT. (Android devices are automatically excluded on cellular data or low battery). - 🌐 Exit Node Gateway (
isexitnode) — Node acting as a secure Internet Gateway. - 🏠 Subnet Route (
advertised_routes) — Node advertising access to its LAN (e.g.,192.168.1.0/24).
👉 Comprehensive documentation: docs/NAT_TRAVERSAL.md.
📦 Supported Platforms
| Platform | Architecture | Release Binary | Description |
|---|---|---|---|
| Windows (WebUI) | amd64 | NatBypass.exe | Windows 10 / 11 (Opens in a standalone native window, no browser required, 15 MB RAM + Wintun) |
| Windows (GUI) | amd64 | NatBypass-GUI.exe | Windows 10 / 11 & Windows Server (2016/2019/2022/2025) (Download and run as Administrator for system tray integration and native window interface) |
| Windows (CLI) | amd64 | natbypass-cli.exe | Windows 10 / 11 / Server (Headless CLI for automation, services, and background tasks) |
| Android | arm64 / arm / x64 | NatBypass.apk | Android 8.0+ (VpnService + QR Scanner + Screen QR) |
| Linux | amd64 | natbypass-linux-amd64 | Ubuntu, Debian, CentOS, Arch |
| Linux ARM64 | arm64 | natbypass-linux-arm64 | Raspberry Pi 3/4/5, Keenetic Ultra/Giga |
| MIPS Routers | mips (Big Endian) | natbypass-router-mips | OpenWrt (TP-Link, GL.iNet, Atheros) |
| MIPSLE Routers | mipsle (Little Endian) | natbypass-keenetic-mipsle | Keenetic Start/City/Air, Xiaomi 3G/4A |
🚀 Quick Start
Windows
- Windows 10 / 11 (WebUI Version):
- Download NatBypass.exe.
- Run as Administrator. Browser management UI will open at
http://localhost:8080.
- Windows 10 / 11 & Windows Server (Native GUI Version):
- Download NatBypass-GUI.exe.
- Run as Administrator. Opens a lightweight native Win32 window (does not require WebView2/browser/Electron, 15–25 MB RAM, ideal for Windows Server).
- Windows Server / Headless (CLI):
- Download natbypass-cli.exe. Run:
.\natbypass-cli.exe -c config.yaml.
Linux / Keenetic / OpenWrt (1-Command Install)
curl -fsSL https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/install.sh | sh(or via wget: wget -qO- https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/install.sh | sh)
Web Management UI will be accessible at: http://<DEVICE_IP>:8080.
🗑️ Uninstallation & Configuration Reset (Linux / Keenetic / OpenWrt)
1. Complete Uninstallation (Purge all files, services & keys):
curl -fsSL https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/uninstall.sh | sh -s -- --purgeTo remove the binaries and service while keeping your configuration and keys:
curl -fsSL https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/uninstall.sh | sh2. Reset Configuration Only (Keep service and binaries):
To generate a brand new DeviceID, fresh WireGuard keys, and restore default profiles:
curl -fsSL https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/uninstall.sh | sh -s -- --reset-config3. Manual Removal / Reset (Offline):
- Keenetic Routers (Entware):
# Complete removal:
/opt/etc/init.d/S99natbypass stop
rm -f /opt/etc/init.d/S99natbypass /opt/bin/natbypass /opt/usr/bin/natbypass
rm -rf /opt/etc/natbypass /opt/var/log/natbypass.log
killall natbypass 2>/dev/null || true
# Reset configuration only:
/opt/etc/init.d/S99natbypass stop
rm -rf /opt/etc/natbypass/*
/opt/etc/init.d/S99natbypass start- Linux Servers (systemd):
# Complete removal:
systemctl stop natbypass && systemctl disable natbypass
rm -f /etc/systemd/system/natbypass.service && systemctl daemon-reload
rm -f /usr/local/bin/natbypass /usr/bin/natbypass
rm -rf /etc/natbypass /var/log/natbypass.log
killall natbypass 2>/dev/null || true
# Reset configuration only:
systemctl stop natbypass
rm -rf /etc/natbypass/*
systemctl start natbypass- OpenWrt Routers:
# Complete removal:
/etc/init.d/natbypass stop && /etc/init.d/natbypass disable
rm -f /etc/init.d/natbypass /usr/bin/natbypass
rm -rf /etc/natbypass
killall natbypass 2>/dev/null || true
# Reset configuration only:
/etc/init.d/natbypass stop
rm -rf /etc/natbypass/*
/etc/init.d/natbypass start🛡️ AmneziaWG (DPI Obfuscation)
NatBypass features AmneziaWG — WireGuard protocol obfuscation designed to bypass Deep Packet Inspection (DPI / TSPU) censorship systems.
⚙️ Available Protocol Presets
| Preset | Description | Target Use Case |
|---|---|---|
Strict |
Header Protection + Random Trailers + Disable Cookies + Content Padding + CPS Packets + Random Timers | Maximum DPI / TSPU Censorship Bypass |
Balanced |
Header Protection + Random Trailers + Cookies + Content Padding + Standard Jitter | Default recommended for all networks |
Anti-TSPU |
Custom parameter tuning (Jc=5, S2=100, randomized H1..H4) | Enhanced compatibility |
Legacy |
Standard WireGuard + junk packets (Jc=4, S1=48, S2=32) | Legacy clients |
🌐 Internet Exit Node Gateway
NatBypass allows routing full internet traffic through any selected mesh node (Keenetic router, Linux server, or Windows PC):
- Automated Routing: The client receives a
0.0.0.0/0default route while preserving peer-to-peer mesh connectivity. Critical/32routes for signaling brokers and STUN endpoints are added via the physical default gateway. - DNS Leak Prevention: All DNS queries are redirected to secure resolvers (
1.1.1.1,8.8.8.8) via the encrypted tunnel, bypassing local ISP eavesdropping and filtering. - 1-Click Control: Enable or disable internet gateway routing via WebUI, Windows GUI, or Android app.
🧪 Upgrading to Beta / Pre-release Builds
Get the latest performance optimizations, bug fixes, and protocol improvements across all clients:
📱 Android
- Open App Settings -> Updates.
- Toggle the 🧪 Тестовые сборки (Beta) switch.
- Click "Скачать и обновить" (Download & Update) to fetch the newest APK directly from GitHub.
🌐 WebUI (Keenetic, OpenWrt, Linux, Windows)
- Open WebUI (
http://<DEVICE_IP>:8080). - Click 🔄 Update in the top navigation bar.
- Enable "Тестовые сборки (Beta / Pre-release)" and click "Check for updates".
- Click "Install update" — the daemon updates and reloads seamlessly without losing peer states.
🐧 Linux / Keenetic / OpenWrt (Terminal)
Upgrade in one line:
curl -fsSL https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/scripts/update.sh | sh -s -- --betaor via the native binary:
natbypass update --beta🪟 Windows GUI & CLI
- In NatBypass GUI, right-click the system tray icon -> "Check for updates...".
- In PowerShell (Run as Administrator):
irm https://raw.githubusercontent.com/jamixm4-crypto/natbypass/main/scripts/update.ps1 | iex -ArgumentList "-Beta"🗺️ Roadmap
- 🧪 Fallback Protocol Evaluation & Benchmarking: Currently testing, evaluating, and determining the most reliable and censorship-resistant reserve/fallback transport protocols to ensure zero downtime even under complete UDP filtering by ISPs.
- 🧩 Adaptive Transport Controller: Seamless auto-switching between Direct P2P UDP, AmneziaWG, and reserve fallback tunnels based on real-time RTT, jitter, and packet loss metrics.
📄 License
This project is licensed under the open-source GNU General Public License v3.0 (GPLv3).
💬 Discussion 0
BBCode & Emoji supportedParticipate in discussions, ask authors questions, and share benchmarks by joining the ProArena engineering community.