Monday, October 31, 2011

Block an IP address under Linux

If you just want to block access to all port from an ip 65.55.44.100 then type command :

#iptables -A INPUT -s 65.55.44.100 -j DROP
#service iptables save
#service iptables restart

If you just want to block access to one port from an ip 65.55.44.100 to port 25 then type command:

# iptables -A INPUT -s 65.55.44.100 -p tcp --destination-port 25 -j DROP
#service iptables save
#service iptables restart

Unblock An IP Address:
Use the following syntax (the -d options deletes the rule from table):

# iptables -D INPUT -s 65.55.44.100 -j DROP
# service iptables save
#service iptables restart

0 comments:

Post a Comment