EQnoble
Well-known member
I have been trying to block access to a server from a whole bunch of country's server blocks that I know to be owned & or operated by people I don't want hitting my server from those ips. Manually adding them as I discover the blocks that they pick up has become a PITA lemme tell you...so my solution was to try and make a .sh script to execute that would add all the blocks of ips which I have grabbed and turned into iptables commands using some macros.
This is an example of a line in my script:
I have also tried....
What am I doing wrong or can this even be done??? Please oh please help me.
This is an example of a line in my script:
Code:
iptables -A INPUT -s xxx.xxx.xxx.0/23 -j DROP
I have also tried....
Code:
iptables="/sbin/iptables"
iptables -A INPUT -s x.x.x.0/24 -j DROP
iptables -A INPUT -s x.x.x.0/23 -j DROP
iptables -A INPUT -s x.x.x.0/21 -j DROP
iptables -A INPUT -s x.x.x.0/19 -j DROP
What am I doing wrong or can this even be done??? Please oh please help me.