Skip to content
Service Servers

Service Servers

  • Cloudbase Solutions
  • Service Servers
Service Servers
Service Servers
Home / Linux / IP Tables Block IP and Port
Linux

IP Tables Block IP and Port

CentOS, CloudLinux™, or Red Hat® Enterprise Linux (RHEL) 6, or Amazon Linux On a CentOS, CloudLinux, or RHEL 6, or Amazon Linux system, use the iptables utility to manage your firewall. CentOS 7, CloudLinux 7, or RHEL 7 On a CentOS 7 or CloudLinux 7 system, use the firewalld utility to manage your firewall. For example, to block traffic for a single IP…

CentOS, CloudLinux™, or Red Hat® Enterprise Linux (RHEL) 6, or Amazon Linux

On a CentOS, CloudLinux, or RHEL 6, or Amazon Linux system, use the iptables utility to manage your firewall.

  • You can block a specific IP address with the iptables command. For example, to block 192.168.0.0, run the following command:

    iptables -A INPUT -s 192.168.0.0 -j DROP

     
  • You can block a specific port for an IP address. For example, to block port 23 on 192.168.0.0, run the following command:

    iptables -A INPUT -s 192.168.0.0 -p tcp –destination-port 23 -j DROP

     

CentOS 7, CloudLinux 7, or RHEL 7

On a CentOS 7 or CloudLinux 7 system, use the firewalld utility to manage your firewall.

For example, to block traffic for a single IP address, run the following command, where 192.168.0.0 is the IP address that you wish to block:

firewall-cmd –add-rich-rule=’rule family=”ipv4″ source address=”192.168.0.0″ drop’ –permanent

 
Post Tags: #Firewall#IP#IPTables#Port#Security

Post navigation

Previous Previous
.htaccess SSL check problems
NextContinue
Check folder and disk size in Linux command
  • Troubleshooting VM RAM Allocation Error
  • Synchronize files between servers
  • Check folder and disk size in Linux command
  • IP Tables Block IP and Port
  • .htaccess SSL check problems

    Copyright © 2025 Service Servers

    • Cloudbase Solutions
    • Service Servers
    Search