0

My question is about setting a connection limit to each port.

I've made a v2ray server for VPN using x-ui.

  • When I create a new config for users, each config uses to a random port. Now I want to limit each port to have a maximum connection and I want to update it when I need.
  • For example, I sold a config to someone and set the limit to 1 (let's name it "cfg-1"). After a few hours another person want a config and I give him/her the cfg-1, now I need to set the limit to 2 connections for that port.

I tried something like this command and I found if someone connect to that port and then disconnect from it, next person can't connect and connection request will drop.

iptables -A INPUT -p 17 --syn --dport 57769 -m connlimit --connlimit-above 1 -j DROP

1 Answer 1

1

Protocol number 17 is UDP and 6 is TCP. UDP does not have states and flags. Therefore SYN does not exist in UDP. Your iptables command is perfect but replace 17 with 6. I tested and it works fine

$ sudo iptables -A INPUT -p 6 --syn --dport 57769 -m connlimit --connlimit-above 1 -j DROP

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .