Complete Guide to Setting Up Telegram MTProto Proxy
Telegram MTProto proxies are lightweight, secure relays that bypass network restrictions while maintaining end-to-end encryption. Unlike standard SOCKS or HTTP proxies, MTProto is Telegram’s proprietary transport protocol, optimized for speed and resilience against deep packet inspection. This guide covers setup for both users and server operators, with a focus on Frankfurt, Germany—a key European hub for low-latency connectivity.
Why Use an MTProto Proxy?
MTProto proxies offer three critical advantages:
- Obfuscation – Traffic signatures mimic normal HTTPS, evading censorship.
- No logging – Proxies cannot decrypt messages (only metadata routing).
- Lightweight deployment – A minimal VPS (256 MB RAM) can handle thousands of users.
Frankfurt’s DE-CIX internet exchange provides peering with major European ISPs, reducing ping to ~10–30 ms for regional users.
Setting Up the MTProto Proxy Server (Frankfurt VPS)
Prerequisites
- A Linux VPS in Frankfurt (e.g., Hetzner, Netcup) with a public IPv4 address.
- Root access (Ubuntu 20.04+ or Debian 11+ recommended).
Step 1: Install Dependencies
sudo apt update && sudo apt install git curl build-essential -y
Step 2: Clone the Official MTProto Proxy Script
git clone https://github.com/TelegramMessenger/MTProxy
cd MTProxy
make
Step 3: Generate Configuration
# Generate random secret (32 hex characters)
echo $(hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/urandom) > secret.txt
Step 4: Start the Proxy
sudo ./objs/bin/mtproto-proxy -p 8888 -H 443 -S "$(cat secret.txt)" --http-ports 80 -M 1
-
-p 8888: Local admin port for monitoring. -
-H 443: Fake TLS handshake port (disguises as HTTPS). -
-S: Secret key for authentication. -
--http-ports 80: Additional support for HTTP proxies. -
-M 1: Single worker thread (increase for high traffic).
Step 5: Configure Firewall
sudo ufw allow 443/tcp
sudo ufw allow 80/tcp
Connecting to Your Proxy in Telegram
Mobile (Android/iOS)
- Go to Settings > Data and Storage > Proxy Settings > Add Proxy.
- Select MTProto and enter:
- Server: Your Frankfurt VPS IP
- Port: 443
-
Secret: Paste the hex secret from
secret.txt
Desktop (Windows/macOS/Linux)
- Open Telegram, click Settings > Advanced > Connection Type > Use custom proxy.
- Choose MTProto, input the same IP, port, and secret.
Testing & Optimization
Monitor usage via the admin port:
curl http://localhost:8888/stats
Look for connected_sessions and bandwidth. For Frankfurt servers, expect <20 ms latency from Western Europe.
To run persistently, create a systemd service:
sudo nano /etc/systemd/system/mtproxy.service
Paste:
[Unit]
Description=MTProto Proxy
[Service]
ExecStart=/root/MTProxy/objs/bin/mtproto-proxy -p 8888 -H 443 -S $(cat /root/MTProxy/secret.txt) --http-ports 80 -M 1
Restart=always
[Install]
WantedBy=multi-user.target
Enable with sudo systemctl enable --now mtproxy.
Security Notes
- Rotate secrets monthly via
tr -dc 'A-F0-9' < /dev/urandom | head -c 32. - Use
fail2banto block brute-force attacks on port 443. - Never expose your admin port (8888) publicly.
Get free proxies at t.me/SetProxy.
Top comments (0)