What You Need to Launch Your Own VPN Service on a VPS
Launching your own VPN service on a VPS begins with understanding the basic components that form its core. This includes the server infrastructure (nodes), a control panel for creating and issuing keys, and tools for automation and billing. Each of these elements plays a critical role in the stable operation and scalability of the service.VPN Server Node: Choosing the Right VPS
Selecting a VPS for your VPN service is fundamental, as it determines speed, stability, and throughput. To start, for a single VPN node (a server through which user traffic will pass), it is recommended to choose a VPS with the following minimum specifications:- vCPU: 2 cores. This is sufficient for handling VPN traffic for up to 100-150 users under moderate load.
- RAM: 2-4 GB. Main memory is used for the operating system, the VPN server software (Xray, OpenVPN, WireGuard), and caching. 4 GB will ensure more stable operation.
- Disk: 20-40 GB NVMe/SSD. NVMe disks are significantly faster than traditional SSDs, which is critical for VPN performance, especially with a large number of concurrent connections or log writing.
- Network Port: 1 Gbps. This is standard for most modern VPS, but ensure the provider does not limit channel speed. For a large number of users or high load, 10 Gbps may be required.
- Bandwidth: Unlimited or with a large allowance (from 1-2 TB/month per core). A VPN service consumes a lot of traffic.
VPN Control Panels: Marzban and Alternatives
For efficient management of multiple users and their subscriptions, a specialized control panel is essential. Manually creating keys for each user will quickly become unmanageable. Among popular solutions, the following stand out: * **Marzban:** An excellent choice for creating your own VPN service. It is a powerful panel based on Xray, supporting VLESS, Reality, Trojan, VMess, Shadowsocks, and other protocols. Marzban allows you to easily manage users, set traffic and time limits, and operate in multi-server mode, which is critical for scaling. * **Advantages:** Wide range of protocols, user-friendly web interface, active community, API for automation. * **Installation:** Typically done with a single command:bash -c "$(curl -sL https://raw.githubusercontent.com/Marzban/Marzban-install/master/install.sh)" @ install
After installation, the panel will be accessible via your VPS's IP address on port 8000 (e.g., `http://your_ip:8000`).
* **Hiddify:** Another comprehensive solution that also supports many protocols (VLESS, Reality, Trojan, VMess, WireGuard, etc.) and offers built-in obfuscation features. Hiddify is ideal for those looking for a ready-made solution with extensive functionality.
* **3x-UI:** A lighter solution, also based on Xray, with a simple interface. Well-suited for smaller projects but may be less flexible for complex automation compared to Marzban.
The choice of panel depends on your needs for functionality, scalability, and ease of integration with other systems. Marzban, with its powerful API, is one of the best options for building a commercial VPN service.
Building Your VPN Service Infrastructure: From Startup to Scale
An effective VPN service infrastructure should be flexible and scalable. You can start small, but it's important to have a growth plan.Minimum Server Setup for Launching a VPN Service
At startup, to serve up to 50-100 users, you can manage with a single VPS that functions as both the control panel (e.g., Marzban) and a VPN node. This is cost-effective but carries risks: * **Single Point of Failure:** If the VPS goes down, the entire service stops. * **Limited Performance:** The panel and VPN server compete for resources. * **Scaling Challenges:** Adding new nodes requires reconfiguration. For a more reliable start and future scalability, it's recommended to use two VPS instances: 1. **Control Plane VPS:** This hosts the Marzban panel. Resource requirements are lower: 1-2 vCPU, 2-4 GB RAM, 20-40 GB NVMe. This server does not directly handle user traffic but only manages other VPN nodes. 2. **VPN Node (Data Plane):** This is the server that directly processes user traffic. Its specifications were described above (2 vCPU, 4 GB RAM, NVMe, 1 Gbps port). Initially, you can use one such node. This configuration separates tasks, increases stability, and simplifies scaling. As your service grows, you can simply add new VPN nodes, connecting them to the central Marzban panel.For 50 concurrent users, 2 vCPU, 4 GB RAM, and a 40 GB NVMe disk are sufficient.
| Users | vCPU | RAM | Disk | Port | Price (approx.) |
|---|---|---|---|---|---|
| 1-20 | 1 | 2 GB | 20 GB NVMe | 1 Gbps | $5-10/month |
| 20-50 | 2 | 4 GB | 40 GB NVMe | 1 Gbps | $10-20/month |
| 50-150 | 4 | 8 GB | 80 GB NVMe | 1 Gbps | $20-40/month |
| 150-300 | 6 | 16 GB | 160 GB NVMe | 1 Gbps | $40-70/month |
| 300+ | 8+ | 32+ GB | 200+ GB NVMe | 10 Gbps | $70+/month |
dnsVPS for your own VPN
Matching plans from verified providers, prices updated daily.
Compare:VPS in GermanyVPS in FinlandVultr vs DigitalOceanVultr vs Contabo
Affiliate links: we may earn a commission, your price stays the same.
Marzban Multi-Server Mode: Centralized Management
When the number of users grows, and a single VPN node can no longer handle the load, or access from different geographical locations is required, Marzban's multi-server mode comes to the rescue. This is a key feature for scaling your VPN business infrastructure. **How it works:** 1. **Central Marzban Panel:** Installed on a separate control plane VPS. It becomes the brain of your infrastructure. 2. **Remote Nodes:** On each additional VPS, only Xray and the Marzban agent (or Marzban-node) are installed. This agent communicates with the central panel. 3. **Single-Point Management:** From the web interface of the central panel, you can create users, assign limits, and choose which node (or multiple nodes) they will connect through. All settings are automatically synchronized with the remote nodes. **Advantages of Multi-Server Mode:** * **Geographical Distribution:** Place nodes in different countries to provide access from various regions and increase fault tolerance. * **Load Balancing:** Distribute users among nodes to prevent any single server from being overloaded. * **Fault Tolerance:** If one node fails, users can be redirected to others. * **Centralized Management:** All users, subscriptions, settings, and statistics are available in one place. * **Simplified Scaling:** Adding a new node involves deploying a VPS and running a single command to connect it to the central panel. To connect a remote node to the central Marzban, you typically need to execute a command on the remote server, specifying the IP address and token of the central panel. This allows you to quickly expand the coverage and throughput of your VPN service.How to Set Up Billing and Payment Processing for Your VPN Service
For selling VPN access and managing subscriptions, a reliable billing system is essential. It should automate the process of payment, activation, and service renewal.Choosing a Billing System for Your VPN Service
Choosing a billing system is one of the most important steps for a commercial VPN service. The main options include: 1. **Off-the-shelf Billing Panels:** * **WHMCS (WebHost Manager Complete Solution):** The de facto standard in the hosting industry. Offers extensive functionality: client management, products, orders, invoices, support, affiliate program. Has numerous plugins and integrations. For a VPN service, custom module development or using an existing one for integration with the Marzban API will be required. * **BillManager (by ISPsystem):** A popular solution. Has similar functionality to WHMCS but may be more familiar to some developers. Also requires API integration. * **Blesta, HostBill:** Alternative solutions with good functionality. **Advantages:** Ready-made, proven solution, extensive functionality, technical support. **Disadvantages:** License cost (from $15-20/month), complexity of setup and integration without experience. 2. **Custom Solutions:** * Developing your own billing system from scratch or based on frameworks (Laravel, Django). * **Advantages:** Full control over functionality, perfect customization to your needs, no license fees (other than development costs). * **Disadvantages:** High initial development costs, need for ongoing support and development, potential vulnerabilities without proper expertise. When choosing a billing system, it's crucial to consider its ability to integrate with the Marzban panel via API. This will allow for automatic user creation, key issuance, subscription renewal, and limit management after successful payment.Accepting Payments, Including Cryptocurrency
A variety of payment methods is critical for user convenience and expanding the service's geographical reach. 1. **Traditional Methods:** * **Bank Cards:** Visa, MasterCard. Require integration with payment gateways (Stripe, ЮKassa, CloudPayments). Can be challenging for small projects to register due to legal entity and compliance requirements. * **E-wallets:** PayPal, ЮMoney, QIWI. Convenient but have their own fees and limitations. * **Bank Transfers:** For large clients or specific countries. **Characteristics:** High fees (2-5%), risk of account blocking when accepting payments for VPN services (some banks and payment systems dislike VPN services due to potential use in "grey" areas), necessity of legal registration. 2. **Cryptocurrency:** * **Bitcoin (BTC), Ethereum (ETH), USDT (TRC-20/ERC-20), and other altcoins.** * **Advantages:** * **Anonymity/Privacy:** Often a key factor for users. * **Low Fees:** Especially for TRC-20 stablecoins. * **Resistance to Blocks:** Decentralized payments are harder to block. * **Global Reach:** Accessible from anywhere in the world. * **Disadvantages:** * **Volatility:** Exchange rates can change. Using stablecoins (USDT) solves this problem. * **Complexity for New Users:** Not all users are familiar with crypto. **Solutions for Accepting Crypto:** * **Payment Gateways:** CoinPayments, Cryptomus, Plisio. They provide APIs for integration and automatically convert payments. * **Self-hosted Node:** BTCpay Server. Requires more technical knowledge but offers full control and minimal fees. * **P2P Exchanges:** For manual payment acceptance, but this does not scale. You can read more about setting up cryptocurrency payments in the article Anonymous VPS Payments for VPN: Cryptocurrency and Privacy. For effective VPN access sales, it's recommended to offer at least one traditional and one cryptocurrency payment method.Automating VPN Subscription Delivery and Customer Support
Manually processing every order leads to burnout and inefficiency. Automation is key to scaling and ensuring a high level of service.Telegram Bot for Selling VPN Access
A Telegram bot is an ideal tool for automating selling VPN access and interacting with clients. It can function as a mini-store, technical support, and information center. **Main Bot Functions:** 1. **Order Taking:** The user selects a plan, pays for it via an integrated payment gateway (crypto or fiat). 2. **Key Generation:** After successful payment, the bot uses the Marzban API to create a new user with selected parameters (traffic, duration) and retrieves the VPN key (VLESS, Reality, WireGuard, etc.). 3. **Key Delivery:** The bot sends the user the ready VPN key or configuration link, along with connection instructions. 4. **Subscription Management:** Users can check their subscription status, remaining traffic, expiration date, and renew the service through the bot. 5. **Notifications:** The bot can notify users about upcoming subscription expirations or exceeding traffic limits. 6. **Technical Support:** Basic questions and answers (FAQ), ability to contact an operator. **Example Bot Logic:** 1. User clicks "Start" in the bot. 2. The bot offers a menu: "Buy VPN", "My Subscription", "Help". 3. Upon selecting "Buy VPN", the bot displays a list of plans (e.g., 1 month / 100 GB for $5, 3 months / 300 GB for $12). 4. User selects a plan. 5. The bot offers payment methods (e.g., USDT TRC-20, bank card). 6. User selects a method; the bot generates payment details (wallet address, amount) or a link to the payment gateway. 7. After payment confirmation (via the payment gateway API), the bot sends a request to the Marzban API:POST /api/user/add
{
"username": "user_telegram_id",
"data_limit": 107374182400, // 100 GB in bytes
"expire": 1678886400 // Timestamp for 1 month
}
8. Marzban returns the configuration (e.g., VLESS link).
9. The bot sends the link to the user along with instructions.
Developing such a bot requires programming skills (Python with `python-telegram-bot`, `requests` libraries for API) and an understanding of the Marzban API.
Integrating with the Control Panel and Billing System
The key to effective automation is seamless integration of all components: * **Billing ↔ Payment Gateway:** Automatic payment status verification. * **Billing ↔ Marzban API:** * Creating a new user after payment. * Renewing a subscription after successful payment. * Changing limits or plans. * Blocking a user upon expiration or exceeding limits. * **Telegram Bot ↔ Billing/Marzban API:** * Retrieving a list of plans. * Initiating payment. * Requesting user creation/renewal. * Retrieving user subscription information. **Example request to Marzban API for user information:**GET /api/user/{username}
Headers: { "Authorization": "Bearer YOUR_MARZBAN_API_TOKEN" }
Properly configured integration minimizes manual intervention, reduces operational costs, and ensures 24/7 service availability for clients.