Linux第5章 网络配置和系统管理操作
5.5关闭防火墙(CentOS7)
5.5.1 systemctl后台服务管理
1)基本语法:
systemctl start 服务名(xxxx.service) (功能描述:开启服务)
systemctl stop 服务名(xxxx.service) (功能描述:关闭服务)
systemctl restart 服务名(xxxx.service) (功能描述:重新启动服务)
systemctl status 服务名(xxxx.service) (功能描述:查看服务状态)
2)经验技巧
查看服务的方法:/usr/lib/systemd/system/服务名
[[email protected] system]# pwd
/usr/lib/systemd/system
[[email protected] system]# ls -al
3)案例实操
(1)查看网络服务的状态
[[email protected] 桌面]#systemctl status network.service
(2)停止网络服务
[[email protected] 桌面]#systemctl stop network.service
(3)启动网络服务
[[email protected] 桌面]#systemctl start network.service
(4)重启网络服务
[[email protected] 桌面]#systemctl restart network.service
5.5.2 systemctl 设置后台服务的自启配置
1)基本语法:
systemctl list-unit-files (功能描述:查看所有服务自启配置)
systemctl --type service (功能描述:查看服务运行情况)
systemctl enable 服务名 (功能描述:开启指定服务的自动启动)
systemctl disable 服务名 (功能描述:关闭指定服务的自动启动)
2)案例实操
(1)关闭firewalld(防火墙)服务的自动启动
[[email protected] 桌面]# systemctl disable firewalld.service
(2)开启firewalld(防火墙)服务的自动启动
[[email protected] 桌面]# systemctl enable firewalld.service
5.4.3 进程运行级别
5.4.4 关闭防火墙
1)临时关闭防火墙:
(1)查看防火墙状态
[[email protected]桌面]# systemctl status firewalld.service
(2)临时关闭防火墙
[[email protected]桌面]# systemctl stop firewalld.service
2)开机启动时关闭防火墙
(1)查看防火墙开机启动状态
[[email protected]桌面]# systemctl list-unit-files |grep firewalld
(2)设置开机时关闭防火墙
[[email protected]桌面]# systemctl enable firewalld.service
本教程由尚硅谷教育大数据研究院出品,如需转载请注明来源。