How Do I Block An IP With ISPConfig And Have It Persist After Reboot? I have several IP's that are clearly up to no good that I want to block. I found a HowtoForge post on how to use "route" to block an IP. Code: route add -host xxx.xxx.xxx.xxx reject When the server reboots, all of the IPs that I've added to the blacklist are now gone. How can I keep these IPs from being erased at reboot? Do I need to enter them through ISPConfig somehow?
either you save all the ips in a text file like this route add -host xxx.xxx.xxx.xxx reject route add -host xxx.xxx.xxx.xxx reject route add -host xxx.xxx.xxx.xxx reject and copy paste in terminal on reboot. or better still use fail2ban to automatically ban the offending IPs automatically.
Yes, but is there a place to add these so that the IP's are blocked automatically on reboot? like the server rebooting after a power outage or some other unattended unplanned reboot?
Just use iptables for this and add a new DROP or REJECT rule to the default INPUT Chain: Code: sudo iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP Save the rules for persistens: Code: iptables-save -c > /etc/iptables/rules.v4 or for ipv6: Code: ip6tables-save -c > /etc/iptables/rules.v6
You can also add the rules to the file Code: /etc/ufw/before.rules after the rows: Code: # Don't delete these required lines, otherwise there will be errors *filter :ufw-before-input - [0:0] :ufw-before-output - [0:0] :ufw-before-forward - [0:0] :ufw-not-local - [0:0] # End required lines Add your rules here: Code: # Block spammers -A ufw-before-input -s XXX.XXX.XXX.XXX -j DROP and reload ufw Code: ufw reload