In 3x-ui and Marzban panels, you can set a user traffic limit from 1 GB to 100 TB, restrict account validity to 30 days, and limit concurrent connections to 3 devices to stay within your VPS plan and efficiently manage server resources.
Managing a VPN server on your own VPS offers freedom and security, but also comes with the responsibility of efficient resource utilization. This is especially true for hosting providers offering VPN services on their own VPS for multiple users. Control panels like 3x-ui and Marzban become indispensable tools for monitoring and distributing these resources. They allow you to not only create and manage accounts but also set strict limits, preventing traffic overages, account abuse, and ensuring stable operation for everyone.
In this article, we'll delve into how to effectively use 3x-ui and Marzban's features to configure limits for traffic, account expiration, and concurrent connections. We'll cover quota calculation, combating config sharing, automatic disconnections, notification setup, and resource consumption monitoring. This knowledge will help you stay within your VPS plan and maintain a high level of service.
How to set user traffic limits in 3x-ui and Marzban?
Configuring traffic limits is a primary task for anyone providing VPN access on their VPS. This directly impacts server rental costs and service stability. Let's explore how this is implemented in 3x-ui and Marzban.
Configuring 3x-ui Traffic Limits per User
In the 3x-ui panel, the process of setting a traffic limit is quite intuitive and is done when creating or editing a user.
- Create/Edit User: Navigate to the "Inbounds" section and select the desired inbound. Then click "Add User" or "Edit" next to an existing user.
- "Traffic Limit" Field: In the user configuration window that opens, you'll see the "Traffic Limit" field. Here you can specify the desired traffic volume.
- Select Units: Next to the "Traffic Limit" field, there's a dropdown list for selecting units: KB, MB, GB, TB. For most users, it's optimal to set limits in GB or TB, depending on anticipated consumption. For example, for a typical user who watches videos and surfs the web, 100-200 GB per month might be sufficient.
- Action on Expiration: Once the traffic limit is reached, 3x-ui will automatically disable the user. In the "Expire" field, you can also specify the account's validity period, such as 30 days. This provides dual control.
Example of setting a 3x-ui traffic limit for a user to 500 GB:
User Configuration:
Name: user_vasya
Protocol: VLESS
Traffic Limit: 500 GB
Expire: 30 days
Enable: True
It's important to regularly check traffic usage statistics to adjust limits or warn users about impending exhaustion. 3x-ui provides clear graphs and consumption tables for each user.
Configuring Marzban Traffic Quotas
Marzban offers a more flexible approach to quota management, based on the concept of plans and profiles, which is particularly convenient for large-scale deployments.
- Create a Plan: In Marzban, you can first create a "Plan" that includes predefined limits. This is useful if you have several user groups with different needs. Go to the "Plans" section and click "Add Plan".
- Configure Traffic in the Plan: In the Plan, specify the "Data Limit" in gigabytes (GB) or terabytes (TB). For example, a "Standard Plan" with a 200 GB limit.
- Assign User to Plan: When creating or editing a user, you can select one of the created Plans. The user will automatically receive all limits defined in that Plan.
- Individual Settings: In addition to Plans, Marzban allows you to set individual limits for each user, overriding Plan settings. In the user configuration, find the "Data Limit" field and enter the desired value.
Marzban also allows you to set "Reset Data Usage" on a specific schedule (e.g., monthly), which is ideal for monthly subscription plans. This is a key aspect for maintaining up-to-date Marzban quota settings.
Marzban Plan Configuration:
Name: Premium_Plan
Data Limit: 1 TB
Expire Duration: 60 days
User Limit: 5
Status: Active
Marzban, thanks to its architecture, allows for rapid scaling of limit management, applying changes to dozens or hundreds of users simultaneously through its Plan system. This significantly simplifies multi-user VPN management.
Calculating VPS Traffic Quotas: How to Avoid Exceeding Your Limit?
Exceeding your VPS traffic limit can lead to additional costs or throttled speeds. Correctly calculating quotas for each user is critically important. On average, 1 TB of VPS traffic costs between $5 and $15 per month, depending on the provider and location.
Before setting a 3x-ui traffic limit or Marzban quota for a user, you need to understand how much traffic is available on your VPS and how it's distributed.
Determining Available VPS Traffic
Your VPS plan includes a specific amount of monthly traffic, for example, 1 TB or 2 TB. Some providers offer "unmetered" traffic, but even this often comes with a "fair usage policy" that limits peak load. You can read more about choosing traffic in the article Unmetered VPS vs. Traffic Limit (TB/month): What to Choose in 2026.
Suppose you have a VPS with 1 TB (1024 GB) of monthly traffic. If you plan to serve 10 users, the average quota per user would be 1024 GB / 10 = 102.4 GB.
Quota Calculation Formula
For a more accurate calculation, use the following formula:
Quota per user = (Total VPS Traffic - Reserved Traffic) / Number of Users
- Total VPS Traffic: The monthly limit of your service plan (e.g., 1024 GB).
- Reserved Traffic: A portion of traffic you set aside for unforeseen needs, system updates, peak loads, or your own use. It's recommended to reserve 10-20% of the total volume. For example, 1024 GB * 0.15 = 153.6 GB.
- Number of Users: How many active users you plan to serve.
Example: VPS with 1 TB (1024 GB) traffic, 15% reserve (153.6 GB), 10 users. Quota per user = (1024 GB - 153.6 GB) / 10 = 87.04 GB.
In this scenario, you can set the 3x-ui traffic limit or Marzban quota for a user at 80-85 GB to have a small buffer. For a deeper understanding of traffic consumption, refer to our article How much traffic does a VPN server consume: Bandwidth and limit calculation on a VPS.
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 →Managing VPN Users and Preventing Config Sharing: Limiting Devices per Account
The issue of a single VPN configuration being shared by multiple users or a dozen devices on one account is a common one. This not only increases the load on your VPS and traffic consumption but also degrades service quality for other legitimate users. Effective VPN user management includes measures to combat sharing.
Limiting Devices per Account in 3x-ui
3x-ui does not have direct built-in functionality to set a device limit per account or concurrent connections at the panel level for all protocols. However, for some protocols, such as VMess, you can indirectly manage this through specific settings.
For protocols like VLESS/XTLS-Reality, Xray-core does not natively provide a direct limit on the number of concurrent connections per single config. This means if one user shares their config with ten friends, all of them can connect. In 3x-ui, you can:
- Monitor IP addresses: In the user statistics, you can see the IP addresses from which connections are made. If you observe an unusually high number of unique IPs for a single user, it could indicate sharing.
- Manual Disconnection: If sharing is detected, you can temporarily disable the user or change their config to invalidate the old one.
- Speed Limiting: Setting a low speed limit can make sharing less appealing.
While there's no direct limit, regular monitoring and manual intervention remain key tools. This remains relevant for VLESS + Reality, which is gaining popularity. Read more about its setup in Your Own VPN on VPS: VLESS Reality + Xray-core in 10 Minutes.
Controlling Concurrent Connections in Marzban
Marzban offers more advanced capabilities for controlling concurrent connections, making it a more powerful tool for combating sharing and VPN user management.
- Set "User Limit" in a Plan: When creating or editing a Plan in Marzban, you can set a "User Limit". This number defines the maximum number of devices that can be simultaneously connected with a single config. For example, if you set
User Limit: 3, only three devices will be able to use the same account concurrently. A fourth connection will be rejected. - Individual "User Limit": Similar to traffic limits, you can set an individual "User Limit" for each user, overriding the Plan settings.
- Track Active Sessions: Marzban provides detailed information about active sessions for each user, including IP addresses and connection times, which significantly simplifies the identification of violators.
Setting a device limit per account in Marzban is the most effective way to combat sharing. It's recommended to set reasonable limits (e.g., 2-3 devices per account) to allow users to use the VPN on their phone and laptop, but prevent mass distribution of the config.
Marzban User Configuration:
Username: user_olga
Data Limit: 150 GB
Expire Duration: 30 days
User Limit: 2 # Max 2 simultaneous connections
Status: Active
Need a dedicated server?
Compare prices from top providers. Configure and order in minutes.
Why is VLESS and Other Protocol Speed Limiting Important?
Beyond traffic and connection limits, speed control is a crucial aspect of VPS resource management. VLESS speed limiting, along with VMess or other protocols, allows for equitable bandwidth distribution among users and prevents a single active user from monopolizing the channel.
Why is Speed Limiting Important?
- Fair Resource Distribution: If one user downloads large files at maximum speed, it can negatively impact the connection quality for other users, causing latency and disconnections.
- VPS Load Control: High traffic speeds create additional load on the VPS CPU and network interface. Speed limiting helps maintain stable server operation.
- Combating Sharing: As mentioned earlier, lower speeds make account sharing less appealing.
- Traffic Savings: Indirectly, speed limiting can reduce overall traffic consumption, as users will be less inclined to download very large volumes of data.
Implementing Speed Limiting in 3x-ui
In 3x-ui, as of this writing, direct speed limiting functionality for individual users or protocols (including VLESS speed limiting) is not a built-in option in the user interface. This is a limitation of Xray-core, which does not have a direct traffic shaping mechanism at the core level.
However, there are workarounds that require deeper intervention at the VPS operating system level:
- Using Traffic Control (tc): You can configure Traffic Control (
tc) rules in Linux to shape traffic by ports or IP addresses. This requires specific knowledge of network administration and can be complex for beginners. - External Scripts: Some advanced users write scripts that interact with the 3x-ui API to retrieve statistics and then apply
tcrules.
Example tc command to limit speed on a port (e.g., 443 for VLESS/Reality) to 10 Mbps:
sudo tc qdisc add dev eth0 root handle 1: htb default 11
sudo tc class add dev eth0 parent 1: classid 1:1 htb rate 1000mbit
sudo tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10mbit ceil 10mbit
sudo tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dport 443 0xffff flowid 1:11
This is a complex method that requires caution, as incorrect configuration can disrupt network operation.
Speed Limiting in Marzban
Marzban, being a more advanced panel, also lacks built-in UI functionality for direct speed limiting per user. This is due to the same Xray-core limitation.
As with 3x-ui, Marzban requires using system tools like tc or relying on indirect methods:
- Firewall-level Configuration: Using firewall rules (e.g.,
iptablesornftables) to limit speed by source IP addresses. - Packet Solutions: Some Linux distributions offer traffic management packages that can simplify
tcsetup.
Thus, for both panels, VLESS speed limiting and other protocols require manual configuration at the operating system level, which is an important consideration when planning your VPN infrastructure.
Automation and Notifications: 3x-ui Traffic Limit and Marzban Quota Configuration
Automating processes like user disconnection upon reaching limits and sending notifications significantly simplifies administration and enhances user experience.
Automatic Disconnection with 3x-ui Traffic Limit
3x-ui has a built-in mechanism for automatically disconnecting a user when the set traffic limit is reached. This happens instantly and requires no manual intervention.
- Set Limit: As mentioned, when creating or editing a user, set a value in the "Traffic Limit" field (e.g., 100 GB).
- Action on Exhaustion: When the user reaches this limit, 3x-ui will automatically change their account status to "Disabled" or render the config inoperable.
- Notifications: The 3x-ui panel itself does not have a built-in notification system for users via email or Telegram. However, you can use an external script that periodically queries the 3x-ui API, checks user traffic status, and, upon approaching or reaching the limit, sends a notification via Telegram Bot API or SMTP.
Example logic for an external script:
# Pseudocode for 3x-ui monitoring script
FOR EACH user IN 3xui.get_users():
IF user.traffic_used > user.traffic_limit * 0.9 AND user.traffic_used < user.traffic_limit:
send_notification("User {user.name}: Your traffic is almost exhausted (90%).", user.contact_info)
ELSE IF user.traffic_used >= user.traffic_limit AND user.status == "enabled":
send_notification("User {user.name}: Your traffic limit has been reached. Account disabled.", user.contact_info)
# Optional: call 3xui API to explicitly disable if not already
END IF
END FOR
The expiration limit works similarly. If "Expire" is set to 30 days, the account will also be automatically disabled after that period.
Automation and Notifications for Marzban Quota Configuration
Marzban offers more advanced automation and notification capabilities due to its architecture and active development.
- Automatic Disconnection: Marzban also automatically disables users upon reaching their "Data Limit" or "Expire Duration".
- Notification System (Built-in or via Plugins): Marzban features a more flexible system. Depending on the version and installed plugins, direct integrations with Telegram, email, or other services may be available to send notifications to users about approaching traffic limits or account expiration. You can configure notification thresholds (e.g., at 80% and 95% traffic usage).
- API for Integration: Marzban provides a full-fledged API, allowing you to easily create custom scripts for monitoring, management, and sending notifications, similar to the 3x-ui example, but with broader capabilities.
- Scheduled Traffic Reset: A key Marzban feature is the ability to automatically reset user traffic counters on a defined schedule (e.g., the 1st of each month). This is an ideal solution for recurring subscriptions.
When configuring Marzban quota settings, be sure to explore available plugins and options in the "Settings" or "Notifications" section for the most effective use of the notification system.
Monitoring and Reporting VPN Traffic Consumption
Regular monitoring of traffic consumption is fundamental for maintaining the stability of your VPN service and promptly responding to overloads or abuses.
Reports in 3x-ui
3x-ui provides fairly detailed traffic reports for each user:
- Inbounds List: On the main "Inbounds" page, you can see the total incoming and outgoing traffic volume for each Inbound.
- User Details: When viewing an Inbound, the user list displays "Used Traffic" for each account, along with its status (Enabled/Disabled) and remaining validity period.
- Graphs: 3x-ui also offers a graphical representation of traffic consumption for each Inbound, which helps visually assess the overall load.
Based on this data, you can make decisions about adjusting limits, disabling violators, or expanding VPS resources. For backing up and migrating this data, should you decide to migrate, we recommend the article 3x-ui Backup and Migration to another VPS without losing users.
Reports in Marzban
Marzban stands out with a more advanced monitoring and reporting system:
- Dashboard: The main Marzban dashboard displays overall server statistics, including current traffic consumption, number of active users, and resource status.
- User Details: In the "Users" section, detailed information is available for each user:
- Used traffic (Data Usage)
- Remaining traffic
- Account expiration date
- Status (Active/Expired/Disabled)
- Number of active sessions (Connected Users)
- Connection history, including IP addresses.
- Logs: Marzban maintains detailed event logs, which are useful for debugging and auditing.
- API for External Monitoring: The presence of a robust API allows Marzban to integrate with external monitoring systems (Prometheus, Grafana), creating custom dashboards and alerts.
These tools allow for detailed analysis of user behavior, identification of anomalies, and informed decisions to optimize your VPN service's operation.
Need a dedicated server?
Compare prices from top providers. Configure and order in minutes.
Choosing a VPS for VPN Hosting with Traffic Limits: Scaling Table
Effective limit management is directly tied to choosing the right VPS. The more users and higher their traffic and speed demands, the more powerful your server needs to be. An incorrect VPS choice will lead to low performance, latency, and ultimately, user dissatisfaction.
For 50 concurrent users actively using VPN for streaming and surfing, 4 vCPU, 8 GB RAM, and an 80 GB NVMe disk are sufficient.
| Users (concurrent) | vCPU | RAM | Disk | Network Port | Approx. Price ($/month) |
|---|---|---|---|---|---|
| 1-5 | 1-2 | 1-2 GB | 20-40 GB SSD/NVMe | 1 Gbps | $5 - $10 |
| 5-15 | 2 | 2-4 GB | 40-60 GB NVMe | 1 Gbps | $10 - $20 |
| 15-30 | 2-4 | 4-6 GB | 60-80 GB NVMe | 1 Gbps | $20 - $35 |
| 30-50 | 4 | 8 GB | 80-120 GB NVMe | 1 Gbps | $35 - $60 |
| 50-100+ | 4-8+ | 16 GB+ | 120 GB+ NVMe | 1-10 Gbps | $60 - $150+ |
Key Factors When Choosing a VPS for VPN:
- Processor (vCPU): Encryption and traffic processing require sufficient computational power. The more users, the more vCPU cores. For 50 users, 4 vCPU will be a good starting point.
- Random Access Memory (RAM): Xray-core and control panels (3x-ui/Marzban) don't require much RAM, but if you plan to run other services or have a very large number of users, 4-8 GB RAM for 30-50 users will be optimal.
- Disk Subsystem (SSD/NVMe): For a VPN server, disk speed is not critical, as traffic is primarily processed in RAM. However, NVMe disks provide better overall system performance. 40-80 GB will be sufficient.
- Network Port (Bandwidth): This is the most crucial parameter. Ensure your VPS has a 1 Gbps port (or 10 Gbps for very high loads) and sufficient monthly traffic volume (e.g., from 1 TB to 10 TB).
- Location: Choose a VPS location that is geographically close to your users to minimize latency (ping).
Valebyte.com offers a wide range of VPS with NVMe disks and high-speed ports, ideally suited for deploying VPN services with 3x-ui or Marzban. You can find plans starting from $5/month for basic configurations and extending to powerful servers with 16+ GB RAM and several TB of traffic for hundreds of users.
Frequently Asked Questions
Can you set a device limit per account in 3x-ui?
3x-ui does not have direct built-in functionality to set a device limit or concurrent connections per account. Users can share their configs, and all devices will be able to connect. To combat sharing, indirect methods such as monitoring IP addresses, manual disconnection, or limiting the overall channel speed must be used, which is not always effective for each individual user.
How do I reset a user's traffic limit in 3x-ui or Marzban?
In 3x-ui, to reset a traffic limit, go to the Inbounds section, select the desired user, and click the "Reset Traffic" button or manually change the "Used Traffic" value. In Marzban, you can reset traffic for an individual user through their settings, or configure an automatic monthly traffic reset for all users within a specific Plan, which is very convenient for regular subscriptions.
What happens when a user exhausts their traffic limit?
In both 3x-ui and Marzban, when the set traffic limit is exhausted, the user is automatically disconnected from the VPN service. Their config becomes inactive, and they will not be able to connect until the limit is reset or increased. This prevents exceeding your VPS's total traffic and ensures fair resource distribution among all users.
Can I configure notifications for users about approaching their limit?
3x-ui does not have built-in user notifications, but this can be implemented using external scripts that query the panel's API and send messages via Telegram or email. Marzban offers more advanced capabilities, including built-in plugins for notifications or an easily accessible API for integration with external systems, allowing alerts to be sent when approaching 80% or 95% of the traffic limit.
How much traffic does an average VPN user consume per month?
Traffic consumption heavily depends on user activity. For casual browsing and messaging, 30-50 GB per month is usually sufficient. However, with active HD/FullHD video streaming (Netflix, YouTube), online gaming, or downloading large files, consumption can easily reach 100-300 GB or more. When calculating quotas for a VPS with 1 TB of traffic for 10 users, it is recommended to allocate 80-100 GB per account.
Conclusion
Effective management of traffic limits, expiration dates, and concurrent connections in 3x-ui and Marzban is critically important for maintaining the stability and profitability of your VPN service on a VPS. Marzban offers more advanced features, such as device limits per account and scheduled automatic traffic resets, making it the preferred choice for large-scale deployments.
Careful quota calculation, regular monitoring, and timely responses to limit overages will help avoid VPS resource overspending, ensure fair bandwidth distribution, and prevent abuse. Choose a VPS with sufficient traffic volume and performance to match your needs, ensuring uninterrupted operation for all users.
Ready to choose a server?
VPS and dedicated servers in 72+ countries with instant activation and full root access.
Get started now →