bolt Valebyte VPS from $4/mo — NVMe, 60s deploy.

Get a VPS arrow_forward

Self-Hosted VPN Service on VPS: Billing & Automation

calendar_month August 24, 2026 schedule 20 min read visibility 24 views
person
Valebyte Team
Self-Hosted VPN Service on VPS: Billing & Automation
summarize

TL;DR

  • To serve up to 50 users, start with 1-2 VPS (2 vCPU, 4GB RAM, NVMe), a control panel, billing, and Telegram bot.
  • A VPN node needs 2 vCPU cores and 2-4 GB RAM to handle 100-150 users under moderate load.
  • Use 20-40 GB NVMe/SSD for critical performance; ensure a 1 Gbps network port and ample bandwidth.
  • Place VPN servers geographically close to your target audience to minimize latency and improve performance.
To launch your own VPN service on a VPS with billing and automated subscription delivery, you'll need a minimum of 1-2 VPS instances, each with 2 vCPU, 4 GB RAM, and an NVMe disk, along with a control panel (such as Marzban), a billing system, and a Telegram bot for automation, enabling you to serve up to 50 active users as part of your VPN service infrastructure. Creating your own VPN service is not only an opportunity to ensure privacy for yourself and your loved ones but also a potentially profitable business, especially with the growing demand for bypassing geo-restrictions and data protection. However, successful launch and scaling of such a project require a carefully planned VPN business infrastructure, including server capacity, convenient management, effective billing for VPN service, and automated access provisioning. In this article, we will detail all the components necessary to build a commercial VPN service, from server selection to legal considerations.

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.
The geographical location of the VPS also matters. Place servers closer to your target audience to minimize latency (ping). Popular locations for minimizing latency often include Europe (Germany, Finland, Netherlands) and other nearby regions. For a deeper understanding of server selection, we recommend reading the article NVMe, RAM, or Network: What Really Matters for Proxy and VPN VPS.

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.

Looking for a reliable server for your projects?

VPS from $10/month and dedicated servers from $9/month with NVMe, DDoS protection, and 24/7 support.

View Offers →
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

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.
rocket_launch Quick pick

Need a dedicated server?

Compare prices from top providers. Configure and order in minutes.

Browse dedicated servers arrow_forward

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.

Calculating VPN Service Costs and Break-Even Point

Understanding the cost and break-even point is critical for any business, including selling VPN access. This will help set correct prices and plan for growth.

Key Cost Categories

Let's divide expenses into fixed costs (independent of user count) and variable costs (dependent on user count). **Fixed Monthly Costs:** * **VPS for Marzban control panel:** $10-20/month (e.g., 2 vCPU, 4 GB RAM). * **Domain name:** $1-2/month (annual domain payment $12-24). * **SSL certificate:** Free Let's Encrypt or paid (from $5/month). * **Billing software licenses (if not custom):** WHMCS/BillManager — $15-30/month. * **Bot and integration development/support costs:** Can range from $0 (if self-developed) to $500+ (freelancer, agency). Initially, it can be considered $0, but allocate time. * **Other tools:** Monitoring, backups (additional cloud storage) — $5-10/month. **Variable Monthly Costs:** * **VPN Nodes (Data Plane VPS):** The main expense. Cost of one node (4 vCPU, 8 GB RAM, 1 Gbps) — $20-40/month. The number of nodes depends on the number of users and their traffic. * **Bandwidth:** While many VPS providers offer unlimited traffic, extreme loads or specific locations may incur additional charges. * **Payment system fees:** * Fiat: 2-5% of the payment amount. * Crypto: 0.5-2% via gateways, or only network fees with self-hosting. * **Anti-abuse solutions/proxies:** If required, can range from $10 to $100+ per month. * **Marketing and advertising:** From $0 to unlimited amounts.

Per-User Cost Calculation Example

Let's consider a hypothetical example for a service serving 100 users. **Assumptions:** * **VPS for panel:** 1 unit @ $15/month * **VPN nodes:** 2 units (each serving 50 users) @ $30/month = $60/month * **Domain/SSL:** $2/month * **Billing (WHMCS):** $20/month * **Payment system fees:** 3% of revenue. * **Average subscription price:** $7/month (e.g., 100 GB traffic for 1 month). * **Marketing:** $50/month (at startup). **Fixed Cost Calculation:** $15 (panel) + $2 (domain/SSL) + $20 (billing) + $50 (marketing) = $87/month. **Variable Cost per User Calculation (excluding fees):** $60 (VPN nodes) / 100 users = $0.6/user per month. Total basic cost per user, excluding fees and marketing: ($87 + $60) / 100 = $1.47/user per month. **Calculation including fees:** If the average subscription is $7, then 3% commission = $0.21/user. Total cost per user: $1.47 + $0.21 = $1.68/user per month. **Break-Even Point:** Total fixed costs: $87/month. Average margin per user: $7 (price) - $0.6 (variable node cost) - $0.21 (commission) = $6.19/user. Number of users for break-even: $87 / $6.19 ≈ 14 users. This means that with current costs and prices, you need to attract 14 active users to break even. All users beyond this number will generate profit. This calculation is simplified but illustrates the principle of analysis. It's important to constantly monitor your expenses and income to adjust your pricing policy and scaling strategy.

Legal and Abuse Risks When Selling VPN Access

Launching a VPN service involves not only technical aspects but also legal risks and the need to combat abuse. Neglecting these issues can lead to blocks, fines, and reputational damage.

Terms of Service and Privacy Policy

Your VPN service will handle user personal data (even if minimal, like Telegram ID or email) and provide a service that can be used for both good and ill. Therefore, clear legal documents are mandatory: * **Terms of Service (ToS):** * Define the rights and obligations of both the service and the user. * Clearly state what is prohibited using your VPN (e.g., spamming, DDoS attacks, copyright infringement). * Specify the consequences of violations (account blocking without refunds). * Describe refund conditions. * Indicate the jurisdiction in which your service is registered. * **Privacy Policy:** * Explains what data your service collects (logs, IP addresses, payment information). * Clearly states the logging policy: "no-logs policy" (we do not store user activity logs) or "minimal logs policy" (we only store anonymized data for statistics). Honesty here is critical for trust. * Describes how this data is used and to whom it may be disclosed (e.g., law enforcement by court order). * Guarantees user rights to access, modify, and delete their data. **Important:** These documents should be easily accessible on your website or in your bot and drafted by a lawyer specializing in IT law to comply with the legislation of your chosen jurisdiction (GDPR, CCPA, etc.).

Combating Abuse and IP Blocks

VPN services often become targets for malicious actors who use them for illegal activities. This leads to abuse complaints and potential blocking of your VPS IP addresses. **Main Risks and How to Combat Them:** 1. **DMCA Complaints (Copyright Infringement):** If users download copyrighted torrents through your node, the hosting provider will receive a complaint. * **Solution:** Blocking torrent traffic at the firewall level (if possible) or promptly responding to complaints, blocking the offending user. Choosing a VPS jurisdiction in countries where DMCA is less actively enforced can also help. 2. **DDoS Attacks:** Malicious actors can use your VPN to organize attacks. * **Solution:** Built-in DDoS protection at the hosting level (many large providers offer basic protection). Monitoring traffic and blocking suspicious IP addresses. 3. **Spamming, Phishing, Fraud:** Your VPN's IP addresses may end up on spam lists. * **Solution:** Strict ToS. Prompt response to complaints, account blocking. Using IP address reputation systems for preventive blocking. 4. **IP Address Blocks:** Countries with strict censorship (e.g., China, Iran) actively block VPN server IP addresses. * **Solution:** * **Using obfuscation protocols:** Reality, VLESS-XTLS-Direct, Trojan-Go. These disguise VPN traffic as regular HTTPS. * **Regular IP address rotation:** Some providers offer additional IPs or the ability to change them. * **Diversity of locations:** Placing nodes in different countries reduces the risk of complete service unavailability. * **Using CDN/WAF:** To mask the control panel and prevent its blocking. * **Traffic proxying:** Using additional proxy servers (e.g., Cloudflare Workers) to bypass blocks. **Recommendations:** * **Choose a reliable hosting provider:** One with an adequate policy regarding VPNs and a quick response to abuse. Valebyte.com offers VPS suitable for such tasks. * **Monitoring:** Set up monitoring of logs and network traffic on your nodes to promptly identify anomalies. * **Automated Blocking:** Integrate an abuse handling system with your Marzban panel for automatic blocking of violators. * **Jurisdiction:** The choice of country for registering your business and hosting your VPS can affect legal protection and susceptibility to external pressure. Some choose countries with more liberal privacy laws.
rocket_launch Quick pick

Need a dedicated server?

Compare prices from top providers. Configure and order in minutes.

Browse dedicated servers arrow_forward

Frequently Asked Questions

How many VPS instances are needed to start a VPN service?

For a minimal VPN service launch serving up to 50 users, a single VPS with 2 vCPU, 4 GB RAM, and an NVMe disk is sufficient. This can host both the Marzban control panel and the VPN node. However, for increased reliability and easier scaling, it's recommended to use two VPS instances: one for the control panel and one or more for the VPN nodes.

Can I accept cryptocurrency for VPN subscriptions?

Yes, accepting cryptocurrency for VPN subscriptions is not only possible but highly recommended. It provides additional anonymity for users, offers lower fees compared to traditional payment systems, and allows you to accept payments from anywhere in the world. For integration, you can use payment gateways like CoinPayments or Cryptomus, or deploy your own BTCpay Server.

How much traffic can a single VPS handle?

A single VPS with 4 vCPU, 8 GB RAM, and a 1 Gbps network port can handle a significant amount of traffic, typically up to 10-20 TB per month, depending on the provider and actual channel load. For 100-150 active users, each consuming an average of 100-200 GB per month, one such node can easily cope, providing a total throughput of up to 100-200 Mbps.

What risks are involved in launching my own VPN?

Launching your own VPN service involves legal and abuse risks. Legal risks include the need to comply with data protection laws (GDPR), as well as risks associated with the service being used for illegal activities. Abuse risks include DMCA complaints, DDoS attacks on your servers, and IP addresses being blacklisted. It's crucial to have clear ToS, a Privacy Policy, and a monitoring system to combat violations.

Conclusion

Launching your own VPN service on a VPS is a complex but entirely feasible project that requires attention to infrastructure, automation, and legal aspects. For a successful start and scaling, it's recommended to use a minimum of two VPS instances (one for the Marzban panel, another for a VPN node), integrate a billing system with cryptocurrency payment options, and develop a Telegram bot for automated subscription delivery. Careful cost calculation and thorough legal documentation will help minimize risks and ensure stable growth for your VPN business.

Ready to choose a server?

VPS and dedicated servers in 72+ countries with instant activation and full root access.

Get Started Now →
support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.