Iptables Drop IP Address

www.la‮ttu‬uri.com
Iptables Drop IP Address

To drop incoming traffic from a specific IP address or range of IP addresses using the iptables firewall in Linux, you can use the following command:

iptables -A INPUT -s IP_ADDRESS -j DROP

Replace "IP_ADDRESS" with the actual IP address or range of IP addresses that you want to block.

For example, to drop incoming traffic from the IP address "192.168.1.100", you can use the following command:

iptables -A INPUT -s 192.168.1.100 -j DROP

To drop incoming traffic from a range of IP addresses, you can use the "!" operator to specify the range. For example, to drop incoming traffic from all IP addresses in the range "192.168.1.0/24", you can use the following command:

iptables -A INPUT -s 192.168.1.0/24 -j DROP

Note: The above commands will drop all incoming traffic from the specified IP address or range of IP addresses. Make sure to use these commands carefully and only block traffic from IP addresses that you want to block.

Additionally, make sure to save the iptables configuration after adding the rule by running the following command:

service iptables save

This will persist the changes across system reboots.

Created Time:2017-10-29 22:08:49  Author:lautturi