roarkh
Verified User
Hello, I'm wondering if someone can enlighten me, we are running DirectAdmin on a CentOS server and have been getting hit by a lot of brute force attacks lately and I am trying to permanently block some IP Ranges from connecting to our server, after some searching on the internet I found the iptables commands that do seem to block the traffic...
For example, to block a class C IP Range I'm using something like...
or for a single IP
That works fine for a while but it seems as though iptables must get restarted automatically sometimes and when that happens the rules I added go away.
Does anyone know the command to make those changes permanent, or should I be blocking these ips some other way? I've searched the internet but what I'm finding seem inconsistent. For instance, I've seen that perhaps I could use "iptables-save > /etc/sysconfig/iptables" but when I look in /etc/sysconfig/ I don't see that file there at all so I'm a little worried about trying that. (I do have files named ip6tables-config and iptables-config in /etc/syscconfig but no file named just iptables).
CFS/LFD is installed but it only blocks so many servers before deleting the oldest ones to make way for more new ones, I'm getting hit by so many attempts these days that that is not good enough for blocking the few servers that seem to never let up so I'd like a more permanent way to block those.
Thanks in advance for any help anyone can provide.
For example, to block a class C IP Range I'm using something like...
Code:
iptables -I INPUT -s xx.xx.xx.0/24 -j DROP
or for a single IP
Code:
iptables -I INPUT -s xx.xx.xx.xx -j DROP
That works fine for a while but it seems as though iptables must get restarted automatically sometimes and when that happens the rules I added go away.
Does anyone know the command to make those changes permanent, or should I be blocking these ips some other way? I've searched the internet but what I'm finding seem inconsistent. For instance, I've seen that perhaps I could use "iptables-save > /etc/sysconfig/iptables" but when I look in /etc/sysconfig/ I don't see that file there at all so I'm a little worried about trying that. (I do have files named ip6tables-config and iptables-config in /etc/syscconfig but no file named just iptables).
CFS/LFD is installed but it only blocks so many servers before deleting the oldest ones to make way for more new ones, I'm getting hit by so many attempts these days that that is not good enough for blocking the few servers that seem to never let up so I'd like a more permanent way to block those.
Thanks in advance for any help anyone can provide.