Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to turn on or off the firewall port in Linux

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report