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

Linux configure firewall how to open ports 80 and 3306

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "Linux configuration firewall how to open port 80 and port 3306". In daily operation, I believe many people have doubts about how to open port 80 and port 3306 in Linux configuration firewall. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "Linux configuration firewall how to open port 80 and port 3306". Next, please follow the editor to study!

Vi / etc/sysconfig/iptables

-An INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT (allows port 80 to pass through the firewall)

-An INPUT-m state-state NEW-m tcp-p tcp-dport 3306-j ACCEPT (allow port 3306 to pass through the firewall)

Special note: many netizens add these two rules to the last line of the firewall configuration, causing the firewall to fail to start, and the correct one should be added to the default port 22 rule.

After being added, the firewall rules are as follows:

The code is as follows:

# Firewall configuration written by system-config-firewall

# Manual customization of this file is not recommended.

* filter

: INPUT ACCEPT [0:0]

: FORWARD ACCEPT [0:0]

: OUTPUT ACCEPT [0:0]

-An INPUT-m state-state ESTABLISHED,RELATED-j ACCEPT

-An INPUT-p icmp-j ACCEPT

-An INPUT-I lo-j ACCEPT

-An INPUT-m state-state NEW-m tcp-p tcp-dport 22-j ACCEPT

-An INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT

-An INPUT-m state-state NEW-m tcp-p tcp-dport 3306-j ACCEPT

-An INPUT-j REJECT-reject-with icmp-host-prohibited

-A FORWARD-j REJECT-reject-with icmp-host-prohibited

COMMIT

/ etc/init.d/iptables restart

# finally restart the firewall to make the configuration effective

At this point, on the "Linux configuration firewall how to open port 80 and port 3306" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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