🌐 dnstm-setup
Interactive DNS Tunnel Setup Wizard — automated server deployment for unrestricted internet access.
Deploys dnstm DNS tunnel servers with Slipstream, DNSTT, NoizDNS, and VayDNS protocols. Designed to help people in restricted regions stay connected to the free internet.
📑 Table of Contents
🆕 What's New in v1.4
⚡ VayDNS Tunnels (Optimized)
Two new tunnel types — VayDNS + SOCKS (v subdomain) and VayDNS + SSH (vz subdomain). VayDNS is an optimized fork of DNSTT by net2share with KCP/smux sessions, auto-recovery, and a leaner wire protocol. Runs in -dnstt-compat mode for backwards compatibility with existing SlipNet clients.
- Up to 8 tunnels (Slipstream + DNSTT + NoizDNS + VayDNS, each with SOCKS and SSH)
- Zero extra configuration — VayDNS binary is downloaded automatically during setup
- Graceful degradation — if the download fails, the script continues with other tunnel types
- Transport option 4 in
--add-tunnel TUI
--monitor — new command for live tunnel stats (CPU, memory, uptime, connections)
--diag — new command for comprehensive tunnel diagnostics
🔌 Xray Backend Integration (Optional)
New optional feature to connect an existing 3x-ui panel (or raw Xray) to a DNS tunnel. Accessible via --add-xray or management menu option 8. This gives users modern proxy protocols tunneled through DNS:
- Auto-detects 3x-ui (native or Docker) — or installs it for you (full panel or headless mode)
- 4 protocols: VLESS, Shadowsocks (chacha20-ietf-poly1305), VMess, Trojan
- Internal-only inbound on
127.0.0.1 — not exposed to the internet, only reachable through the DNSTT tunnel
- Generates client configs — SlipNet URL for the tunnel + client URI for Nekobox/v2rayNG
- Compatible with any V2Ray client that supports proxy chaining (Nekobox, v2rayNG, Shadowrocket, Clash, etc.)
Other Improvements
- 9 DNS records (was 5) — NS records for NoizDNS (
n, z) and VayDNS (v, vz) subdomains
--add-domain now creates NoizDNS and VayDNS tunnels for backup domains too
--add-tunnel now offers 4 transport choices: Slipstream, DNSTT, NoizDNS, VayDNS
--manage (TUI option 9) adds Change DNSTT MTU — update MTU on existing DNSTT tunnels without recreating them
--status displays all tunnel info and SlipNet URLs including VayDNS
--remove-tunnel properly cleans up Xray, NoizDNS, and VayDNS service overrides
- Security hardening — SQL injection prevention, cookie jar cleanup, restrictive file permissions, URL-safe base64 encoding
- Portable code — no
grep -P (Perl regex), no python3 dependency, pure bash URL encoding
🔍 How DNS Tunneling Works
DNS (Domain Name System) is the internet's phone book — every device on the planet needs it to work. DNS tunneling encodes your internet traffic inside DNS queries and responses.
💡 Why DNS? Censors can block VPNs, Tor, and direct connections, but they almost never block DNS because doing so would break the internet for everyone. Even during total internet shutdowns, DNS queries often still work through ISP resolvers.
How it works:
- 📱 Your phone (running SlipNet) encodes internet traffic as DNS queries
- 🔒 These queries look like normal DNS lookups (e.g.,
abc123.t.yourdomain.com)
- 🌍 The queries travel through public DNS resolvers (Google
8.8.8.8, Cloudflare 1.1.1.1, etc.)
- 🖥️ Your server receives the queries, decodes the hidden data, and forwards it to the real internet
- ↩️ Responses travel back the same way, encoded inside DNS responses
Because the traffic looks like ordinary DNS resolution, it passes through filters undetected.
🏗️ Architecture
📱 Phone (SlipNet App)
|
| DNS queries (encoded traffic)
v
🌍 Public DNS Resolver (8.8.8.8 / 1.1.1.1 / 9.9.9.9)
|
| DNS delegation (NS records point to your server)
v
🖥️ Your Server — Port 53
|
v
🔀 DNS Router (multiplexes port 53)
|
+---> t.domain ---> Slipstream ---> microsocks (SOCKS5) ---> 🌐 Internet
| (QUIC + TLS)
|
+---> d.domain ---> DNSTT --------> microsocks (SOCKS5) ---> 🌐 Internet
| (Noise + Curve25519)
|
+---> s.domain ---> Slipstream ---> SSH Tunnel ------------> 🌐 Internet
| (QUIC + TLS) (port forwarding)
|
+---> ds.domain --> DNSTT --------> SSH Tunnel ------------> 🌐 Internet
| (Noise + Curve25519) (port forwarding)
|
+---> n.domain ---> NoizDNS ------> microsocks (SOCKS5) ---> 🌐 Internet
| (DPI-resistant DNSTT fork)
|
+---> z.domain ---> NoizDNS ------> SSH Tunnel ------------> 🌐 Internet
| (DPI-resistant) (port forwarding)
|
+---> v.domain ---> VayDNS -------> microsocks (SOCKS5) ---> 🌐 Internet
| (optimized DNSTT, KCP/smux)
|
+---> vz.domain --> VayDNS -------> SSH Tunnel ------------> 🌐 Internet
| (optimized) (port forwarding)
|
+---> x.domain ---> DNSTT --------> Xray (VLESS/SS/VMess/Trojan) -> 🌐 Internet
(Noise + Curve25519) (optional, via --add-xray)
🔗 How DNS Delegation Works
When someone queries t.yourdomain.com, the global DNS system follows this chain:
- Client asks its resolver: "What is xyz.t.yourdomain.com?"
- Resolver asks Cloudflare (your domain's nameserver): "What is t.yourdomain.com?"
- Cloudflare sees the NS record: "For t.yourdomain.com, ask ns.yourdomain.com"
- Cloudflare sees the A record: "ns.yourdomain.com is at
<your server IP>"
- Resolver sends the query directly to your server on port 53
- Your server's DNS Router receives it and routes to the correct tunnel
This is why you need both an A record (telling the internet where your server is) and NS records (delegating subdomains to your server).
📦 What Gets Installed
| Component |
Description |
Details |
| 🎛️ dnstm |
DNS Tunnel Manager |
CLI tool that manages all tunnel binaries, services, and routing |
| 🔀 DNS Router |
Port 53 multiplexer |
Inspects incoming DNS queries and routes them to the correct tunnel by subdomain |
| ⚡ Slipstream Server |
QUIC-based DNS tunnel |
TLS encryption with self-signed certificates — Speed: ~63 KB/s |
| 🔐 DNSTT Server |
Classic DNS tunnel |
Noise protocol with Curve25519 key pairs — Speed: ~42 KB/s |
| 🛡️ NoizDNS Server |
DPI-resistant DNS tunnel |
Modified DNSTT fork with enhanced query encoding to evade Deep Packet Inspection — Speed: ~42 KB/s |
| ⚡ VayDNS Server |
Optimized DNS tunnel |
DNSTT fork with KCP/smux sessions, auto-recovery, and leaner wire protocol — Speed: ~42 KB/s |
| 🧦 microsocks |
SOCKS5 proxy |
Lightweight proxy shared by all tunnels (port auto-assigned by dnstm) |
| 👤 sshtun-user |
SSH user manager |
(Optional) Creates restricted users that can only do port forwarding |
🚇 Eight Tunnel Types
| Tunnel |
Subdomain |
Transport |
Backend |
Use Case |
| ⚡ slip1 |
t.domain |
Slipstream (QUIC) |
SOCKS |
Fastest — recommended for most users |
| 🔐 dnstt1 |
d.domain |
DNSTT (Noise) |
SOCKS |
Fallback if Slipstream is blocked |
| 🛡️ noiz1 |
n.domain |
NoizDNS (DPI-resistant) |
SOCKS |
Best for heavy censorship / DPI environments |
| ⚡ vay1 |
v.domain |
VayDNS (optimized) |
SOCKS |
Optimized DNSTT with auto-recovery |
| 🔑 slip-ssh |
s.domain |
Slipstream (QUIC) |
SSH |
When you need per-user authentication |
| 🔑 dnstt-ssh |
ds.domain |
DNSTT (Noise) |
SSH |
SSH fallback if Slipstream is blocked |
| 🛡️ noiz-ssh |
z.domain |
NoizDNS (DPI-resistant) |
SSH |
DPI-resistant SSH tunnel |
| ⚡ vay-ssh |
vz.domain |
VayDNS (optimized) |
SSH |
Optimized SSH tunnel with auto-recovery |
🧦 SOCKS backend: Optionally secured with SOCKS5 username/password authentication. Without auth, anyone who knows the domain can connect.
🔑 SSH backend: Requires username + password. Provides per-user access control. The SSH user is restricted — even if credentials leak, no one can access your server.
🛡️ NoizDNS: A DPI-resistant fork of DNSTT by anonvector (same author as SlipNet). Uses alternative DNS query encoding designed to evade Deep Packet Inspection systems in heavily censored networks. In SlipNet, select NoizDNS as the tunnel type for n and z subdomains.
⚡ VayDNS: An optimized fork of DNSTT by net2share with KCP/smux reliable sessions, auto-recovery on connection failure, and a leaner wire protocol. Runs in -dnstt-compat mode so existing SlipNet/DNSTT clients work. In SlipNet, select DNSTT as the tunnel type for v and vz subdomains.
✅ Prerequisites
Before running the script, you need:
1. 🖥️ A VPS (Virtual Private Server)
- Running Ubuntu or Debian (tested on Ubuntu 20.04 / 22.04 / 24.04)
- Root access (SSH as root or sudo)
- Public IPv4 address
- Port 53 (UDP + TCP) open in any external firewall / hosting provider panel
2. 🌐 A Domain
- Any domain works (cheap TLDs like
.live, .xyz are fine)
- The domain must use Cloudflare DNS (free plan) to manage records
- You can buy domains from Namecheap, Cloudflare Registrar, or any registrar
3. 📥 curl
- Usually pre-installed on Ubuntu/Debian
- If missing, the script will offer to install it for you
🚀 Quick Start
SSH into your server as root, then:
curl -fsSL -o dnstm-setup.sh https://raw.githubusercontent.com/SamNet-dev/dnstm-setup/master/dnstm-setup.sh
sudo bash dnstm-setup.sh
💡 Tip: Press h at any prompt for detailed help on that step.
Add a Backup Domain
Already set up? Add another domain to the same server as a fallback:
sudo bash dnstm-setup.sh --add-domain
This creates a new set of tunnels on the same server with a different domain. If one domain gets blocked, the other still works.
📋 Setup Steps Explained
The wizard has 12 steps. Here's what each one does:
Step 1 — ✅ Pre-flight Checks
- Verifies you're running as root
- Checks the OS is Ubuntu/Debian
- Ensures
curl is installed (offers to install if missing)
- Auto-detects your server's public IP via
api.ipify.org
Step 2 — 🌐 Domain Configuration
- Asks for your domain name (e.g.
example.com)
- Strips whitespace,
http://, and trailing slashes automatically
- Validates the domain contains at least one dot
Step 3 — 📝 DNS Records (Cloudflare)