日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

linux防火墻配置基本步驟 win7防火墻設(shè)置


linux防火墻配置基本步驟 win7防火墻設(shè)置


在上節(jié)的筆記中,大家還記得那條防火墻的設(shè)置命令么?為什么要使用防火墻呢?Linux 系統(tǒng)中,安全的第一道防線就是它 。跟 Windows 中防火墻一樣,都是要設(shè)置端口的開(kāi)放與關(guān)閉 。那除了增加的命令之外,還有沒(méi)有其它的操作呢?是如何實(shí)現(xiàn)的?那我們本節(jié)進(jìn)行簡(jiǎn)單地講解一下與防火墻有關(guān)的筆記內(nèi)容 。
防火墻的配置,在 Centos 6 以前是使用命令 iptables,而到了 Centos 7 以之后的版本,改成了 firewall-cmd 命令,為了大家更方便的理解,我把整個(gè)過(guò)程分解成(查看狀態(tài)、增加端口操作、其它安全設(shè)置)三個(gè)方面給大家講解,讓大家盡可能明白防火墻是如何去配置的 。
一、如何去查看防火墻的狀態(tài)以及防火墻開(kāi)啟與關(guān)閉
1、iptables 版本命令:
啟動(dòng): service iptables start
關(guān)閉: service iptables stop
查看狀態(tài): service iptables status
設(shè)置開(kāi)機(jī)禁用 : chkconfig iptables off
設(shè)置開(kāi)機(jī)啟用 : chkconfig iptables on
iptables 配置文件目錄/etc/sysconfig/iptables,如果不想使用命令,也可以直接使用 vim/vi 來(lái)編輯配置文件,使用 cat 命令來(lái)查看配置內(nèi)容 。
實(shí)例:
[root@localhost ~]# service iptables status //查看防火墻狀態(tài),開(kāi)了就會(huì)有下面的內(nèi)容表格:filterChain INPUT (policy ACCEPT) //接入的端口信息 numtargetprot opt sourcedestination1ACCEPTtcp--0.0.0.0/00.0.0.0/0tcp dpt:8089 Chain FORWARD (policy ACCEPT) //numtargetprot opt sourcedestinationChain OUTPUT (policy ACCEPT) //接出允許信息 numtargetprot opt sourcedestination[root@localhost ~]# service iptables status //沒(méi)開(kāi)防火墻的提示 iptables:未運(yùn)行防火墻 。[root@localhost ~]# service iptables stop //關(guān)閉防火墻 iptables:將鏈設(shè)置為政策 ACCEPT:filter[確定]iptables:清除防火墻規(guī)則:[確定]iptables:正在卸載模塊:[確定][root@localhost ~]# service iptables start //開(kāi)啟防火墻 iptables:應(yīng)用防火墻規(guī)則:[確定][root@localhost ~]# 2firewall-cmd 版本命令
這里要對(duì) systemctl 這個(gè)命令注釋一下:
systemctl 命令結(jié)合了 service 與 chkconfig 兩個(gè)命令的功能,是 Centos 7 版本后用來(lái)對(duì)“服務(wù)”進(jìn)行管理的一個(gè)命令 。而 service 與 chkconfig 兩個(gè)命令之后版本都沒(méi)再出現(xiàn)過(guò) 。
啟動(dòng)服務(wù):systemctl start firewalld
關(guān)閉服務(wù):systemctl stop firewalld
重啟服務(wù):systemctl restart firewalld
顯示服務(wù)的狀態(tài):systemctl status firewalld
開(kāi)機(jī)時(shí)啟用服務(wù):systemctl enable firewalld
開(kāi)機(jī)時(shí)禁用服務(wù):systemctl disable firewalld
實(shí)例:
[root@localhost ~]# systemctl status firewalld //已開(kāi)啟防火墻狀態(tài)● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: active (running) since 三 2021-10-13 22:43:01 CST; 3 weeks 6 days agoDocs: man:firewalld(1) Main PID: 840 (firewalld)//或者使用以下命令也可以查看[root@localhost ~]# firewall-cmd --staterunning[root@localhost ~]# systemctl state firewalld//未開(kāi)啟防火墻的提示 Unknown operation 'state'.[root@localhost ~]# systemctl status firewalld● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: inactive (dead) since 三 2021-11-10 17:50:09 CST; 17s agoDocs: man:firewalld(1)Process: 840 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS) Main PID: 840 (code=exited, status=0/SUCCESS)[root@localhost ~]# firewall-cmd --state//另外一種提示命令 not running 二、端口的放行及關(guān)閉
防火墻的端口開(kāi)放與關(guān)閉,是運(yùn)維工作當(dāng)中常用的操作,安全配置上也有相關(guān)的要求 。因此我們要比較熟悉的學(xué)習(xí)到這一塊的內(nèi)容 。當(dāng)連接數(shù)據(jù)庫(kù)或遠(yuǎn)程登陸等與網(wǎng)絡(luò)相關(guān)的故障,我們都要第一時(shí)間想到防火墻的配置問(wèn)題,可以讓我們走少很多的彎路 。

推薦閱讀