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

What if the CentOS firewall configuration and REJECT do not take effect

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

Share

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

What to do if the CentOS firewall configuration and REJECT does not take effect. In view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

In the Linux system, we usually set up a firewall to block and open the port through the firewall. Configure the firewall based on CentOS and some problems that may cause inaccessibility due to configuration errors.

After installing CentOS 7.0, the version of iptables firewall iptables firewall uses firewall as firewall by default. Since iptables firewall is used here, we need to disable firewall firewall and install iptables.1, close firewall:systemctl stop firewalld.service # stop firewallsystemctl disable firewalld.service # prohibit firewall boot 2, install iptablesyum install iptables-services # install ```> # iptables configuration 1, and enter / etc/sysconfig directory. 2. Use the vi command to edit the iptables. "vi iptables" 3. This is port 3306 of the new mysql.

-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 3306-j ACCEPT

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

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

COMMIT

Iptables does not take effect due to configuration problems configuring REJECT

1.-An INPUT-j REJECT-- reject-with icmp-host-prohibited, this line has rejected commands from other ports. If we put the newly inserted open port after this command, the open port in the later configuration will not be enabled. For example:

-An INPUT-j REJECT-- reject-with icmp-host-prohibited-A FORWARD-j REJECT-- reject-with icmp-host-prohibited-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT's answer to the question about what to do when CentOS firewall configuration and REJECT does not work is shared here. I hope the above content can be of some help to you, if you still have a lot of doubts unsolved. You can follow the industry information channel for more related knowledge.

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