Linux firewall to open a port number and commonly used firewall commands (detailed explanation)


1. It is permanent and will not recover after restart

Open: chkconfiguriptables on

Close: chkconfiguriptables off

2. Immediate effect, recovery after restart

service iptables restart

Mode 1: etc / init.d/iptables restart

Method 2: Service iptables restart

Turn off firewall:

Mode 1: etc / init.d/iptables stop

Method 2: Service iptables stop

Start firewall

Mode 1: etc / init.d/iptables start

Method 2: Service iptables start

Open related interfaces

1. Find the firewall configuration file and modify it

The directory is in / etc / sysconfig / iptables

Add a line of code in it. The code is as follows:

-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 8088 -j ACCEPT

This code must be placed on top of the following code

-A rh-firewall-1-input – J reject – reject with ICMP host promoted, otherwise it will not work. The specific configuration file is as follows:

2. Restart the firewall for the changes to take effect

service iptables restart

The above Linux firewall to open a port number and the use of common firewall commands (detailed explanation) is Xiaobian to share with you all the content, I hope to give you a reference, also hope you can support developer.