Home/Blog/Networking & Privacy
Networking & Privacy⚡ Intermediate
9 min read
October 12, 2026

How to Set Up a High-Performance MTProto Proxy on Ubuntu 24.04 LTS

Technical Blueprint & Architecture Summary
Target EnvironmentUbuntu 24.04 / Debian 12
Hardware Reqs1 vCPU • 1GB RAM • NVMe
Verification Status Production Tested
🛡️
Edutechz Infrastructure Team
Cloud Systems Engineering
#Ubuntu 24.04#MTProto#Telegram Proxy#Linux VPS#Networking

Introduction

MTProto is Telegram's dedicated cryptographic protocol engineered to provide secure, low-latency, and resilient client-to-server messaging. When standard TCP connections to Telegram servers experience aggressive throttling or packet shaping on congested networks, deploying a private MTProto Proxy on an unmetered Linux VPS improves routing stability and preserves encrypted connectivity.

In this comprehensive engineering guide, we walk through configuring an official MTProto Proxy with **TLS Transport Encapsulation** (EE secret) on **Ubuntu 24.04 LTS**. This standard wrapping wraps proxy handshakes in TLS 1.3 transport headers compatible with modern enterprise firewalls.


Prerequisites

Before beginning the installation, ensure your cloud environment meets the following specifications:

  • A dedicated **Linux VPS** running **Ubuntu 24.04 LTS** (Edutechz Starter or Pro Cloud VPS recommended).
  • Full `root` or `sudo` administrative privileges.
  • At least 1 GB of RAM and 1 vCPU Core.
  • An open inbound TCP port (e.g., port `443`, `8443`, or `2053`).

  • Step 1: System Update & Dependency Installation

    Always begin by refreshing your package index and installing necessary toolchains:

    bash terminal
    sudo apt update && sudo apt upgrade -y
    sudo apt install -y git curl build-essential libssl-dev zlib1g-dev libatomic1

    Step 2: Clone and Compile the Official MTProxy Daemon

    Telegram maintains an official C-based proxy daemon optimized for epoll multi-threading on Linux kernels:

    bash terminal
    # Clone the repository
    cd /opt
    sudo git clone --single-branch https://github.com/TelegramMessenger/MTProxy.git
    cd MTProxy
    
    # Compile the binary
    sudo make

    Once compilation completes, the binary executable will be located at `/opt/MTProxy/objs/bin/mtproto-proxy`.


    Step 3: Fetch Telegram Core Configuration & Secret

    The proxy requires the latest Telegram cluster routing table and public authentication secret directly from Telegram servers:

    bash terminal
    cd /opt/MTProxy/objs/bin
    
    # Fetch Telegram server secret
    sudo curl -s https://core.telegram.org/getProxySecret -o proxy-secret
    
    # Fetch active Telegram datacenter configuration
    sudo curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf

    Step 4: Generate a Cryptographic EE Secret (TLS Mode)

    To establish standardized TLS-wrapped proxy transport, we generate a 32-character hexadecimal secret and prefix it with `ee` along with the hex-encoded hostname of an SSL reference domain (for example, `www.cloudflare.com`):

    bash terminal
    # Generate 16 bytes of random hex entropy
    HEX_SECRET=$(head -c 16 /dev/urandom | xxd -ps)
    
    # Domain to mimic: www.cloudflare.com -> 7777772e636c6f7564666c6172652e636f6d
    DOMAIN_HEX="7777772e636c6f7564666c6172652e636f6d"
    
    # Full EE Secret for Telegram Clients:
    FULL_SECRET="ee${HEX_SECRET}${DOMAIN_HEX}"
    
    echo "Your Client Secret: $FULL_SECRET"

    Store this string safely. Your Telegram client will use this exact secret string to establish TLS-masked tunnels.


    Step 5: Configure systemd Background Daemon

    To ensure your MTProto proxy automatically boots on system restart and restarts in case of network interruptions, build a systemd unit file:

    Create `/etc/systemd/system/mtproxy.service`:

    ini terminal
    [Unit]
    Description=Telegram MTProto Proxy Service
    After=network.target
    
    [Service]
    Type=simple
    WorkingDirectory=/opt/MTProxy/objs/bin
    ExecStart=/opt/MTProxy/objs/bin/mtproto-proxy -u nobody -p 8888 -H 443 -S YOUR_RAW_SECRET_HERE --aes-pwd proxy-secret proxy-multi.conf -M 1 --domain www.cloudflare.com
    Restart=always
    RestartSec=5
    LimitNOFILE=65535
    
    [Install]
    WantedBy=multi-user.target

    Replace `YOUR_RAW_SECRET_HERE` with the 32-character random hex string (without the `ee` and domain suffix) generated in Step 4.

    Reload and start the daemon:

    bash terminal
    sudo systemctl daemon-reload
    sudo systemctl enable --now mtproxy
    sudo systemctl status mtproxy

    Step 6: Configure UFW Firewall

    Ensure your designated public port (e.g., TCP `443`) is allowed through the Linux firewall:

    bash terminal
    sudo ufw allow 443/tcp
    sudo ufw reload

    Step 7: Connecting Telegram Clients

    Your proxy connection link is formatted as:

    text terminal
    https://t.me/proxy?server=YOUR_VPS_PUBLIC_IP&port=443&secret=YOUR_FULL_EE_SECRET

    Clicking this link on iOS, Android, macOS, or Windows will prompt Telegram to add the proxy with 1 tap. Traffic will now stream encrypted through your high-speed cloud instance with ultra-low ping.

    Deploy On Edutechz NVMe Cloud

    Need clean IP addresses, DDoS mitigation, and 10 Gbps uplinks to run your proxies, containers, or Windows servers? Deploy your instance in 60 seconds.

    Explore Cloud Plans

    Recommended Technical Guides

    Windows RDP

    Step-by-Step Windows RDP Optimization for High-Latency Connections

    8 min read
    Cybersecurity

    Best Practices for Securing Linux Cloud Servers Against Brute-Force Attacks

    10 min read
    DevOps & Cloud

    How to Run Docker Containers Smoothly on Low-RAM VPS (1GB - 2GB RAM)

    9 min read