Skip to content
Blog How to Block an ip address using iptables

How to Block an ip address using iptables

You can block an user with an ip address from accessing your system using the iptables.

For that follow these steps.

1. Open up a shell and login as root.

2. now type the command below to block the ip(XXX.XXX.XXX.XXX).

# iptables -I INPUT -s XXX.XXX.XXX.XXX -j DROP

3. See whether the new rule has been added.

# /sbin/iptables -L -n

You can find other options to choose from with the following command:

# iptables --help

Leave a Reply

Your email address will not be published. Required fields are marked *

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