I am Trying to ban a particular ip without any success.
I am trying
sh firewall BANSINGLE=x.x.x.x
I also tried with quotes
sh firewall BANSINGLE="x.x.x.x"
The command is:
Code:
sh firewall BANSINGLE
It will then prompt you to enter an IP address. If that doesn't work, see the changes I made to the script below.
So I've been working on this, to get it working on my RT-N66U. What I have working so far works fine for manually entered blocks, but the automatic part not so much.
Where it falls down is right here:
Code:
#iptables -D logdrop -m state --state NEW -j SET --add-set Blacklist src
#iptables -I logdrop -m state --state NEW -j SET --add-set Blacklist src
It's complaining about -add-set, but from what I'm seeing in documentation that SHOULD be a valid command for that version of iptables.
Unfortunately, I'm no Linux guru. I've read comments about monitoring the syslog, and when a drop is read adding it to the Blacklist ipset. That wouldn't be real time blocking, unless you also reran the firewall script every time (or create a cron job to rerun it every 60 minutes or so?).
Anyway, here are the tweaks I've made to the script.
- In each of the if statements, removed the $ from the value side.
if [ X"$@" = X"$UNBANSINGLE" ] to if [ X"$@" = X"UNBANSINGLE" ]
- Reordered the whitelist/blacklist/blocked countries section, and added some extra echos to troubleshoot which of the ones were failing.
- Commented out the three iptables commands for logdrop.
- I tweaked the BlacklistTotal number to -21 from -26. For some reason, with the IP blocklist empty, it showed -6 (number of non-commented lines in there, coincidence?). -20 worked fine for a while, but then it started showing 1 off between the $NEWAMOUNT and BlacklistTotal (BlacklistTotal showed 1 more than was accurate). -21 seems to work fine, but it might not be accurate until a few IPs are added (or maybe the firewall script is ran a few times?).
See the next post for the actual code.....