Home >Operation and Maintenance >CentOS >Detailed explanation of CentOS7 firewall settings

Detailed explanation of CentOS7 firewall settings

藏色散人
藏色散人forward
2020-11-24 15:19:563574browse

The following column centos basic tutorial will introduce CentOS7 firewall settings to you. I hope it will be helpful to friends in need!

Detailed explanation of CentOS7 firewall settings

1. Check the system version

When setting up the firewall, first check the Linux system version.

lsb_release -a

centOS7 system does not have this command

cat /etc/redhat-release(/etc/centos-release)
输出:CentOS Linux release 7.4.1708 (Core)

This command can be used for both CentOS6 and CentOS7. The etc folder in the Linux system is mainly used to store some configuration files.

2. Firewall related commands

启动: systemctl start firewalld
查看状态: systemctl status firewalld 
禁止开机启动: systemctl disable firewalld  
关闭服务: systemctl stop firewalld 关闭

3.systemctl command

systemctl is the main tool in the service management tool of CentOS7. It integrates the functions of the previous service and chkconfig. . The usage method is as follows:

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

Note: CentOS7 and the following versions use iptables to serve the firewall.

The above is the detailed content of Detailed explanation of CentOS7 firewall settings. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete

Related articles

See more