Answer the question
In order to leave comments, you need to log in
How to block a website using iptables?
The server has nginx installed, which gives site.ru
Is it possible to block access to the site from certain ip addresses using iptables?
It is through iptables that there is no response from the server at all.
Operating system CentOS 7
Answer the question
In order to leave comments, you need to log in
Add to /etc/sysconfig/iptables (well, or wherever rules are stored in el7):
-A INPUT -p tcp --dport 80 -s IP-to-block -j DROP
Thus, requests to the server simply will not get. If there are many such addresses, then you can write one rule:
-A INPUT -p tcp --dport 80 -m set --match-set ip-to-block src -j DROP
In order for this to work, you need to install the ipset package, create /etc/sysconfig/ipset file and add the following to it:
create ip-to-block hash:net family inet hashsize 1024 maxelem 65536
add ip-to-block ip-to-block
add ip-to-block one more- IP
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question