zl程序教程

您现在的位置是:首页 >  系统

当前栏目

【项目实战】Linux服务管理 之 开启/关闭防火墙

Linux项目服务防火墙 管理 实战 开启 关闭
2023-09-14 09:04:55 时间

一、service命令是什么?

service命令用于对系统服务进行管理,比如

  • 启动(start)
  • 停止(stop)
  • 重启(restart)
  • 查看状态(status)

service命令本身是一个shell脚本
它在/etc/init.d/目录查找指定的服务脚本,然后调用该服务脚本来完成任务。

二、 常用的service命令

格式说明
service 打印指定服务的命令行使用帮助。
service start启动指定的系统服务
service stop停止指定的系统服务
service restart重新启动指定的系统服务,即先停止(stop),然后再启动(start)。

三、其他与service相关命令

命令说明
chkconfig查看、设置服务的运行级别
ntsysv直观方便的设置各个服务是否自动启动

四、firewalld的基本使用

Linux服务管理 之 开启/关闭防火墙

systemctl是CentOS7的服务管理工具中主要的工具
它融合之前service和chkconfig的功能于一体。

启动:systemctl start firewalld
关闭:systemctl stop firewalld
查看状态:systemctl status firewalld
开机禁用:systemctl disable firewalld
开机启用:systemctl enable firewalld