0

I have a server of a videogame hosting in a Google cloud VM using Ubuntu 16. Some people are using bots to stop the server by reaching the connection limit

The error shown

I was thinking of limiting how many connections a public IP can start, hopefully that will fix the problem. I tried using

iptables -A INPUT -p udp -m connlimit --connlimit-above 5 --connlimit-mask 32 -j REJECT

but i dont know if its working, but its blocking connections to domains like api.steampowered.com

Steam authentication for (player) failed: Could not resolve host: api.steampowered.com - CURL error code 6 (Couldn't resolve host name)

And that works if I remove that IP table.

How can I block the connection limit (per public IP) to a specified port (30145) TCP & UDP to lets say 10?

Dave M
  • 4,514
  • 22
  • 31
  • 30
  • 1
    While this is a good question, please avoid posting pictures of text. Post text instead. To answer the question, if it is a single IP address, or just a handful, or an entire subnet, you can add the `--source` option to the rule. If you want to block connections to port 30145, add `--dport 30145`. – berndbausch May 23 '21 at 01:53
  • this is a question that is imho offtopic on serverfault.com but maybe not on superuser.com – djdomi May 23 '21 at 10:15
  • @Quique1222 try to use recent module, limit from what I know, doesn't keep track of the source https://serverfault.com/questions/333480/iptables-rate-limit-what-are-the-differences-between-modules-recent-limit – c4f4t0r May 23 '21 at 10:47

0 Answers0