-1

I'm being trolled by China, and don't know why I can't block their request to my server.

//host.deny

ALL: item.taobao.com
ALL: 117.25.128.*

But when I watch the error log on my webserver tail -f /var/log/apache2/error.log the requests are still being allowed through.

Question: Why isn't my host.deny config working?

Jordan Davis
  • 1,485
  • 7
  • 21
  • 40

1 Answers1

2

Hosts deny will not block every socket connection, only on apps that rely on hosts.deny which is ssh, inetd, and a few others. To block all connections you need to use iptables.

It varies from distro to distro but the command line is something like:

iptables -A INPUT -s 117.25.128.0/24 -j DROP

You'll need to use CIDR notation (ie, a.b.c.d/x) to do ranges. To wildcard the last digit change (class C network) it to a zero and use /24. For the last two IPs change them to zero and use /16.

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
AndrewWhalan
  • 417
  • 3
  • 12