附-防火墙设置
# Centos7
查看状态
- 表示防火墙开启中 active (running)
- 表示防火墙关闭中 inactive (dead)
[root@linux101 module]# 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 四 2022-04-07 23:02:26 CST; 22h ago
Docs: man:firewalld(1)
Main PID: 802 (firewalld)
Tasks: 2
CGroup: /system.slice/firewalld.service
└─802 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
4月 07 23:02:24 linux101 systemd[1]: Starting firewalld - dynamic firewall daemon...
4月 07 23:02:26 linux101 systemd[1]: Started firewalld - dynamic firewall daemon.
# 或者
[root@linux101 zookeeper]# firewall-cmd --state
running
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
开启防火墙
systemctl start firewalld
1
关闭防火墙
systemctl stop firewalld
1
永久关闭防护墙
systemctl disable firewalld.service
1
# Centos6
# 永久操作
# 查看防火墙状态
chkconfig iptables --list
iptables 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
# 关闭防火墙
chkconfig iptables off
# 再查看防火墙状态
chkconfig iptables --list
iptables 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 临时操作
# 查看防火墙状态
service iptables status
# 临时关闭防火墙
service iptables stop
1
2
3
4
2
3
4
Last Updated: 2022/05/15, 15:38:49