How to turn on or off the firewall port in Linux
Today, I will talk to you about how to turn on or off firewall ports in Linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
In many cases, the firewall will organize some port number communication. For example, our tomcat,nginx,redis is obviously installed without problems, but it cannot be accessed externally. That is probably the reason for the protective wall. We can open some ports in the firewall for external access, such as tomcat 8080, mysql 3306, Redis 6379, Nginx 80.
Path to the / etc/sysconfig/iptables// firewall configuration file
In many cases, the firewall will organize some port number communication. For example, our tomcat,nginx,redis is obviously installed without problems, but it cannot be accessed externally. That is probably the reason for the protective wall. We can open some ports in the firewall for external access, such as tomcat 8080, mysql 3306, Redis 6379, Nginx 80. When we open the configuration file, we will find that he only opens port 22 by default, so we can copy that line, insert it immediately below him, and change it to the port number we want to open. Note (it has to be the next line next to it)
When the setup is complete, restart the firewall:
Service iptables restart
View firewall status:
Service iptables status
Of course, since this is a development environment, we can turn off the firewall.
Service iptables stop
But in this way, the firewall will turn on again next time, so we can turn it off.
Chkconfig iptables off// base firewall self-boot chkconfig iptables-- list / / View the list of self-boot status. After reading the above, do you have any further understanding of how to open or close the firewall port in Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.