Iptables is a firewall management tool that is commonly used on CentOS and Red Hat Linux systems. Iptables allows you to configure rules that control incoming and outgoing traffic on your system.
Here are the basic steps to configure iptables on a CentOS or Red Hat Linux system:
iptables
command:iptables -L
This will show you the current rules that are applied to the system.
iptables
command with the -A
option. For example, to allow incoming traffic on port 80 (HTTP), you can use the following command:iptables -A INPUT -p tcp --dport 80 -j ACCEPT
This will allow incoming traffic on port 80 and pass it through to the system.
REJECT
target instead of ACCEPT
. For example, to block incoming traffic on port 22 (SSH), you can use the following command:iptables -A INPUT -p tcp --dport 22 -j REJECT
iptables-save
command. For example:iptables-save > /etc/sysconfig/iptables
This will save the iptables rules to the /etc/sysconfig/iptables
file, so they will be applied on boot.
It's always a good idea to carefully review the documentation and use the appropriate commands to configure the iptables firewall on your system. This will help ensure that you have a secure and reliable firewall to protect your system.