mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #3795] ip limit not work #2562
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#2562
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @roozbehsat on GitHub (Feb 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3795
Describe the bug
the ip limit is not work in new version,
How to repeat the problem?
hi, the ip limit is not work in new version, also don't show the ip of client and shown [object Object]
Expected action
No response
Received action
No response
3x-ui Version
2.8.10
Xray-core Version
26.2.6
Checklist
@IvanNumberOne24 commented on GitHub (Feb 13, 2026):
fixed in #3785
@p4shark commented on GitHub (Feb 13, 2026):
@IvanNumberOne24 This commit only fixes the visual part of the problem, and the IP is not disconnected when the limit is exceeded with the error:
WARNING - [LIMIT_IP] Failed to remove user %client%: failed to remove user: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:10085: connect: connection refused@IvanNumberOne24 commented on GitHub (Feb 13, 2026):
@p4shark Thanks for the comment, I had difficulty translating.
A hint from Mr.D
The Xray API listens on port 62789, and the IP Limit tries to connect to 10085, which is the default of the panel.
The IP Limit is triggered and writes to the log, fail2ban reads this log and bans the IP through iptables,
but Xray itself does not disable the user because it cannot reach the API.
Temporary solution:
cp/etc/x-ui/x-ui.db /etc/x-ui/x-ui.db.bak
sqlite3 /etc/x-ui/x-ui.db "UPDATE settings SET value = REPLACE(value, '"port": 62789', '"port": 10085') WHERE key = 'xrayTemplateConfig';"
sed -i 's/"port": 62789/"port": 10085/' /usr/local/x-ui/bin/config.json
systemctl restart x-ui
I hope @MHSanaei will check this decision and make adjustments.
@p4shark commented on GitHub (Feb 13, 2026):
@IvanNumberOne24 I am using an online translator, sorry for the inconvenience.
I followed your steps, but for some reason the port in the specified files did not change. I changed the commands a little, but the essence remains the same, BUT it did not help.
command:
cp /etc/x-ui/x-ui.db /etc/x-ui/x-ui.db.baksqlite3 /etc/x-ui/x-ui.db "UPDATE settings SET value = json_set(value, '$.inbounds[0].port', 10085) WHERE key = 'xrayTemplateConfig';"manually changed the port in /usr/local/x-ui/bin/config.jsonsystemctl restart x-uiThe error I mentioned above is gone, but there is still no ban (the ban list is empty).
IP Limit writes the correct data about connection attempts to the log (/var/log/x-ui/3xipl.log)
2026/02/13 10:17:11 [LIMIT_IP] Email = p4shark || Disconnecting OLD IP = oneIP || Timestamp = 17709778292026/02/13 10:17:51 [LIMIT_IP] Email = p4shark || Disconnecting OLD IP = twoIP || Timestamp = 17709778632026/02/13 10:18:01 [LIMIT_IP] Email = p4shark || Disconnecting OLD IP = oneIP || Timestamp = 17709778692026/02/13 10:18:21 [LIMIT_IP] Email = p4shark || Disconnecting OLD IP = twoIP || Timestamp = 17709778812026/02/13 10:18:41 [LIMIT_IP] Email = p4shark || Disconnecting OLD IP = oneIP || Timestamp = 1770977893The strangest thing is that I only changed the panel port (and inbounds of course); I never encountered 10085 anywhere.
@IvanNumberOne24 commented on GitHub (Feb 13, 2026):
Then it remains to wait for a solution from more advanced users.
@p4shark commented on GitHub (Feb 13, 2026):
As a temporary solution, you can roll back to version 2.8.9, comment out all lines with sort in the
/web/job/check_client_ip_job.go, and rebuild the project for your OS.Then, after the limit is exceeded, the first connected IP will be blocked.
FIFB (First In First Banned) (haha, sorry, bad joke)
@p4shark commented on GitHub (Feb 14, 2026):
Hmm, maybe @AungYeZawDev help us?
@AungYeZawDev commented on GitHub (Feb 14, 2026):
Hi @p4shark , thanks for tagging me.
This issue is likely caused by the data structure change in my previous PR (#3735). I modified the stored IP format to include timestamps (to support the 'last IP wins' logic), but it seems the frontend display logic interprets it as an object instead of extracting the IP string.
I will investigate the code and submit a fix for this ASAP.
@akhxp commented on GitHub (Feb 16, 2026):
I think you should change this line in /etc/fail2ban/filter.d/3x-ipl.conf :
old :
failregex = \[LIMIT_IP\]\s*Email\s*=\s*<F-USER>.+</F-USER>\s*\|\|\s*SRC\s*=\s*<ADDR>new :
failregex = \[LIMIT_IP\]\s*Email\s*=\s*<F-USER>.+</F-USER>\s*\|\|\s*Disconnecting\s*OLD\s*IP\s*=\s*<ADDR>@JacksonSwich commented on GitHub (Feb 19, 2026):
Hello everybody! The comment was made with the help of a translator, so I apologize in advance.
I have been observing the problem with Limit_IP since the release of the latest version and have been waiting for the problem to be resolved.
Now, after installing the new version 2.8.10, the problem has not been resolved yet. I completely ran into the same thing as @p4shark .
I solved the problem with listening to the wrong portal by changing the configuration of XRay. I changed the port to the required one, as mentioned above. After that, this warning disappeared:
WARNING - [LIMIT_IP] Couldn't delete user %client%: couldn't delete user: rpc error: code = unavailable Description = connection error: description= "Transport: Error when dialing: dial tcp 127.0.0.1:10085: connect: Connection denied.Well, as you indicated, the ip address remains unblocked, although the logs say otherwise.:
2026/02/19 18:07:11 [LIMIT_IP] Email = test || Disabling OLD IP = ip || Timestamp = 1770977829I found a lot of topics on this issue on github. But still, I would like to clarify the status of the solution to this problem.
@MHSanaei commented on GitHub (Feb 20, 2026):
try this version
https://github.com/MHSanaei/3x-ui/actions/runs/22045725105
@almen2006 commented on GitHub (Feb 21, 2026):
After the update, users lost their ip limit choice.
@GmeX1 commented on GitHub (Feb 22, 2026):
Now IPs are being displayed correctly in the panel, BUT the ban doesn't work. Tested with 2 different IPs and IP Limit set to 1, both of them work perfectly
@ermilov-dmitry commented on GitHub (Mar 3, 2026):
Hi thread! Any success fighting this bug? Is there a way to limit the use of the issued configs?
@ermilov-dmitry commented on GitHub (Mar 9, 2026):
@MHSanaei Hello! How is this issue closed? The "IP Limit" feature still doesn't work.
I've just tested on the fresh 2.8.11:
Expected:
First device connects, all good.
Second device connects (another IP), first device (Initial IP) drops connection.
Is that correct expected behavior?
What happens:
Could you please take a deeper look into this issue? It's a core functionality that prevents abuse from the clients. It's impossible now to limit the use.
Thank you for your time and effort!
@steppash commented on GitHub (Mar 10, 2026):
We need to open a new issue. This must be one of the basic functions that should work as intended. @MHSanaei, thanks.
@MHSanaei commented on GitHub (Mar 10, 2026):
@steppash everything should works on the last update
U need to reinstall fail2ban for it
@steppash commented on GitHub (Mar 10, 2026):
@MHSanaei I did this. The fail2ban logs are clean, but the session for the first of the two IP addresses isn't disconnected, apparently blocking occurs at the TCP connection level. Both clients quickly try to reconnect, thereby ensuring that the traffic from their IP addresses is loaded onto the same client. Perhaps I'm misunderstanding how fail2ban works, but I think it's simply a quirk of the Xray architecture.
@ermilov-dmitry commented on GitHub (Mar 10, 2026):
@MHSanaei thanks for clarification! I does seem to work for me now, after I've re-installed fail2ban.
@ermilov-dmitry commented on GitHub (Mar 10, 2026):
@steppash what do you have set for IP limit?
Try a clean experiment after refreshing the whole system: reboot, re-install fail2ban. Ensure the settings are correct and at least 2 IPs are at play.
@ermilov-dmitry commented on GitHub (Mar 10, 2026):
Although I'm getting this weird warning after i've set the IP limit to 2 (my baseline conifg).
WARNING - X-UI: [LIMIT_IP] Failed to remove user [REDACTED]: failed to remove user: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:10085: connect: connection refused"@ermilov-dmitry commented on GitHub (Mar 10, 2026):
Should I have the port 10085 open?