1

How I can block specific IP's? And as I know, if I somehow block them, it will be not blocked again after reboot. How I can make a script which will block specific IP's?

  • How I can use it – Matas Vault Jun 19 '17 at 19:13
3

You can add this rule. In --src you also can define various IPs seperated by , (and without spaces!)

iptables -A INPUT --src <the specific IP> -j DROP

Be careful not to lock yourself out though!

For keeping them after reboot read how-can-i-make-a-specific-set-of-iptables-rules-permanent


A quite complete and easy to maintain iptables setup I've found is

DigitalOcean: How to implement a basic firewall template with iptables on Ubuntu 14.04

  • It would be nice, if you can explain more, so I need to do this in /etc/iptables/rules.v4/v6 file? – Matas Vault Jun 20 '17 at 12:00
  • No you run it as command in the terminal. – derHugo Jun 20 '17 at 13:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.