How do I block requests from an IP address/range with iptables?


To block incoming requests from a single IP address, you can use:
iptables -I INPUT -s {IP-HERE} -j DROP
so if you’d want to block incoming requests from IP address, you’d use:
iptables -I INPUT -s -j DROP

Should you want to block an entire range, for example, you can use:
iptables -I INPUT -s -j DROP

In all cases: Use iptables -L to verify the address/range you added is indeed on top of the list now.

Was this answer helpful ? Yes (1) / No (0)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.