centos7 檢視,關閉,開啟防火牆命令

2021-10-24 19:05:09 字數 3062 閱讀 5977

[root@localhost bin]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

active: active (running) since wed 2020-10-14 20:47:45 edt; 50min ago

docs: man:firewalld(1)

main pid: 6267 (firewalld)

cgroup: /system.slice/firewalld.service

└─6267 /usr/bin/python -es /usr/sbin/firewalld --nofork --nopid

oct 14 20:47:44 localhost.localdomain systemd[1]: starting firewalld - dynamic firewall daemon...

oct 14 20:47:45 localhost.localdomain systemd[1]: started firewalld - dynamic firewall daemon.

[root@localhost bin]#

[root@localhost bin]# systemctl stop firewalld

[root@localhost bin]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

active: inactive (dead) since wed 2020-10-14 21:41:01 edt; 2s ago

docs: man:firewalld(1)

process: 6267 execstart=/usr/sbin/firewalld --nofork --nopid $firewalld_args (code=exited, status=0/success)

main pid: 6267 (code=exited, status=0/success)

oct 14 20:47:44 localhost.localdomain systemd[1]: starting firewalld - dynamic firewall daemon...

oct 14 20:47:45 localhost.localdomain systemd[1]: started firewalld - dynamic firewall daemon.

oct 14 21:41:00 localhost.localdomain systemd[1]: stopping firewalld - dynamic firewall daemon...

oct 14 21:41:01 localhost.localdomain systemd[1]: stopped firewalld - dynamic firewall daemon.

[root@localhost bin]# systemctl start firewalld

[root@localhost bin]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon

loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

active: active (running) since wed 2020-10-14 21:41:17 edt; 3s ago

docs: man:firewalld(1)

main pid: 8128 (firewalld)

cgroup: /system.slice/firewalld.service

└─8128 /usr/bin/python -es /usr/sbin/firewalld --nofork --nopid

oct 14 21:41:17 localhost.localdomain systemd[1]: starting firewalld - dynamic firewall daemon...

oct 14 21:41:17 localhost.localdomain systemd[1]: started firewalld - dynamic firewall daemon.

[root@localhost bin]#

上面開啟和關閉防火牆都是臨時的,重啟電腦後又會恢復到預設的狀態。假如先關閉了防火牆,然後輸入reboot重啟centos7,重啟後再執行檢視防火牆的命令會發現防火牆還是開啟的狀態。

如果想重啟後防火牆還是處於關閉的狀態,得使用命令:

sudo systemctl disable firewalld

檢視防火牆的狀態的命令為:sudo systemctl status firewalld

開啟防火牆的方式有兩種,一種是開啟後重啟會恢復回原來的狀態,命令為:sudo systemctl start firewalld;另一種是開啟後重啟不會恢復到原來的狀態,命令為:sudo systemctl enable firewalld,這種方式輸入命令後要重啟系統才會生效。

關閉防火牆的方式也有兩種,和開啟相對應,命令分別為

sudo systemctl stop firewalld

sudo systemctl disable firewalld。

centos7 檢視 開啟 關閉防火牆

檢視狀態 sudo systemctl status firewalld未開啟的狀態如下,開啟的狀態如下,顯示running則為開啟 開啟防火牆的命令 1.開啟後重啟還會恢復原來的狀態 sudo systemctl start firewalld2.開啟後重啟不會恢復原來的狀態 sudo syste...

CentOS7關閉 開啟防火牆

centos 7.0預設使用的是firewall作為防火牆,使用iptables必須重新設定一下 1 直接關閉防火牆 systemctl stop firewalld.service 停止firewall systemctl disable firewalld.service 禁止firewall開...

CentOS 7 防火牆開啟 關閉

centos 7.0預設使用的是firewall作為防火牆 使用systemctl來管理服務和程式,包括了service和chkconfig 1 檢視預設防火牆狀態 關閉後顯示not running,開啟後顯示running firewall cmd state 2 檢查防火牆的狀態 systemc...