Linux - How to block an ip address on linux server iptables, Block an IP Address using iptable rules
How to block an ip address on linux server iptables
How to block an IP Address on LINUX Server using iptable rules
Use iptables command to add an IP rule to your LINUX firewall. Add an IP table rule block the IP particular ipaddress. You must have root access to add an IP table rule.
Syntax to block an IP address
iptables -A INPUT -s IP-ADDRESS -j DROP
Example to block an IP address
# iptables -A INPUT -s 22.214.171.124 -j DROPAdd an IP table rule to block an ip address.
Linux Command to block port 25 of an ip 74.12.nn.10
# iptables -A INPUT -s 74.12.nn.10 -p tcp --destination-port 25 -j DROP
This command will block all the incoming packets to the port 25, of IP Address 74.12.xx.10
After adding the rules the firewall will immediately block the IP Address. If not save the IP tables and then restart the iptables
Command to save the iptables rule
# /etc/init.d/iptables restart
The topic on Linux - How to block an ip address on linux server iptables is posted by - Maha
Hope you have enjoyed, Linux - How to block an ip address on linux server iptablesThanks for your time