linux(centos7)firewalld-cmd查看防火墙状态以及查看当前规则
查看防火墙状态:
[root@localhost ~]# firewall-cmd --state running [root@localhost ~]# 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-03-11 11:32:21 CST; 1min 30s ago Docs: man:firewalld(1) Main PID: 3353 (firewalld) CGroup: /system.slice/firewalld.service └─3353 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid Mar 11 11:32:16 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Mar 11 11:32:21 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. 查看当前规则: firewalld uses zones to manage the traffic. If a zone is not specified by the --zone option, the command is effective in the default zone assigned to the active network interface and connection.To list all the relevant information for the default zone: [root@localhost ~]# firewall-cmd --list-all --zone=public public (active) target: default icmp-block-inversion: no interfaces: ens33 sources: services: dhcpv6-client http https ssh ports: 3306/tcp 443/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: For example, to see which services are allowed in the current zone: [root@localhost ~]# firewall-cmd --list-services dhcpv6-client http https ssh