下面由centos基礎(chǔ)教程欄目給大家介紹centos7防火墻設(shè)置,希望對(duì)需要的朋友有所幫助!
1.查看系統(tǒng)版本
在設(shè)置防火墻的時(shí)候,首先查看linux系統(tǒng)版本。
lsb_release -a
centOS7 系統(tǒng)沒有此命令
cat /etc/redhat-release(/etc/centos-release) 輸出:CentOS linux release 7.4.1708 (Core)
此命令對(duì)于CentOS6和CentOS7都可以使用。linux系統(tǒng)中etc文件夾主要用于存放一些配置文件。
2.防火墻相關(guān)命令
啟動(dòng): systemctl start firewalld 查看狀態(tài): systemctl status firewalld 禁止開機(jī)啟動(dòng): systemctl disable firewalld 關(guān)閉服務(wù): systemctl stop firewalld 關(guān)閉
3.systemctl命令
systemctl是CentOS7的服務(wù)管理工具中主要的工具,它融合之前service和chkconfig的功能于一體。使用方法如下:
啟動(dòng)一個(gè)服務(wù):systemctl start firewalld.service 關(guān)閉一個(gè)服務(wù):systemctl stop firewalld.service 重啟一個(gè)服務(wù):systemctl restart firewalld.service 顯示一個(gè)服務(wù)的狀態(tài):systemctl status firewalld.service 在開機(jī)時(shí)啟用一個(gè)服務(wù):systemctl enable firewalld.service 在開機(jī)時(shí)禁用一個(gè)服務(wù):systemctl disable firewalld.service 查看服務(wù)是否開機(jī)啟動(dòng):systemctl is-enabled firewalld.service 查看已啟動(dòng)的服務(wù)列表:systemctl list-unit-files|grep enabled 查看啟動(dòng)失敗的服務(wù)列表:systemctl --failed
注意:CentOS7 以下版本是用iptables為防火墻服務(wù)的。
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END