Block range of IP Addresses

iptables1

Block range of IP Addresses

iptables is a user-space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores.

To block 116.10.191.* addresses:

$ sudo iptables -A INPUT -s 116.10.191.0/24 -j DROP

To block 116.10.. addresses:

$ sudo iptables -A INPUT -s 116.10.0.0/16 -j DROP

To block 116...* addresses:

$ sudo iptables -A INPUT -s 116.0.0.0/8 -j DROP

But be careful what you block using this method. You don’t want to prevent legitmate traffic from reaching the host.