Open a specific port (iptables) to the CentOS Firewall)
Iptables is the firewall and service name in linux.Service iptables status view Firewall status service iptables start Enable Firewall service iptables stop disable Firewall service iptables restart firewall open specific port: ① file/etc/sysconfig/iptables ② Add: -ARH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 8080-j ACCEPT in my centos6.5, you only need to enter the red part.★The number 8080 indicates that port 8080 is opened, or you can change it to another port.★③ Restart the Firewall
========================================================== =====================================Save settings for the firewall serivce iptables save view iptables rules and number iptables-nL -- line-number: Disable all input forward (forwarding) all OUTPUT ports iptables-p input DROPiptables-p forward DROPiptables-p output drop open only port 22 iptables-a input-p tcp -- dport 22-j ACCEPTiptables-a output-p tcp -- sport 22-j ACCEPT parameter description: -The A parameter is regarded as adding A rule-p to specify the protocol. We usually use tcp protocol. Of course, udp also exists. For example, the DNS-dport of port 53 is the target port, when the data enters from the external server as the target port-sport the data goes out of the server, if-j is used for the data source port, it is specified to be ACCEPT-receiving or DROP-not receiving. If an IP address is not allowed to access iptables-a input-p tcp-s 192.168.1.2-j DROP-s, the parameter is source (192.168.1.2) the DROP deletion rule iptables-d input 2 is used to delete the rule whose INPUT Chain number is 2.