To block the ip address in Linux, we need to use iptables and netfilter firewall along with login as root user.  To block the IP Address, we can use the below command:  iptables -A INPUT -s -j DROP  In case if we want to block the access to one port from an ip address to port n then we can below command:  iptables -A INPUT -s -p tcp --destination-port n -j DROP  The above rule will drop all packets coming from IP- address to port mail server port n.  In case, we want to unblock these IP:   iptables -D INPUT -s xx.xxx.xx.xx -j DROP
iptables -D INPUT -s -j DROP
service iptables save