[Discuss] Limit the number of ip addresses which can connect to a port

Tom Luo mariolzx at gmail.com
Mon Oct 30 18:08:36 EDT 2017


Hi, All,

I am running a service in Ubuntu on a port. I try to limit the number of ip
addresses which can connect to the port. For example, if the limit is set
to 1, only connect from on ip address is allowed.
If there is a connection from another ip address, it will be declined.

The only thing I can find so far is:
iptables -I INPUT -p tcp --dport 8000 -m connlimit --connlimit-upto 200
--connlimit-mask 0 -j ACCEPT

However, this only limits the number of connections instead of the number
of ip addresses.
Any one knows how to do it?


Thanks a lot!

Tom



More information about the Discuss mailing list