Home  >  Article  >  Operation and Maintenance  >  What to do if the firewall fails to be enabled under centos

What to do if the firewall fails to be enabled under centos

王林
王林Original
2020-03-27 18:10:052627browse

What to do if the firewall fails to be enabled under centos

Environment:

centos6.8

Problem:

In the process of configuring vsftpd, firewall configuration is required. But the startup failed.

(Recommended tutorial: centos tutorial)

The solution steps are as follows:

1. First of all, my /etc/sysconfig/iptables file does not exists and needs to be addressed.

1. Run any iptables firewall rule configuration command:

iptables -P OUTPUT ACCEPT

2. Save the iptables service:

service iptables save

3. Restart the iptables service:

service iptables restart

Check the file again.

After that, you can use the following commands to configure certain configurations according to your needs.

sudo vim /etc/sysconfig/iptables

After saving and exiting, using the service iptables start command to start the firewall still fails. The error is: Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service " and "journalctl -xe" for details.

Solution:

After checking, I found that it was because a new file was created for editing when the iptables file did not exist initially, and Saved using service iptables save command.

But after saving, the iptables.save file was generated in the /etc/sysconfig folder. After opening it, I found that it was the same as the iptables I originally created and edited. Then I cleared the iptables.save file and tried it again. service iptables start, the firewall started successfully.

The above is the detailed content of What to do if the firewall fails to be enabled under centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn