linux centos view firewall firewalld, iptables status

firewalld something with the iptables.service a level.

Relations with iptables firewall is the firewall will use the iptables command.

CentOS6.5 view the status of the firewall:

[linuxidc@localhost ~]$service iptable status

CentOS 6.5 turn off the firewall

[root @ localhost ~] #servcie iptables stop - temporarily disable the firewall 
[root @ localhost ~] #chkconfig iptables off - permanently turn off the firewall

From centos7 start using systemctl to manage services and programs, including the service and chkconfig.

[root @ localhost ~] #systemctl list -unit-files | grep firewalld.service - the firewall is turned off 
firewalld.service disabled

or

[root@localhost ~]#systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)

Turn off the firewall:

systemctl stop firewalld.service # Stop firewall 
systemctl disable firewalld.service # prohibit firewall boot

start a service: systemctl start firewalld.service
shut down a service: systemctl stop firewalld.service
restart a service: systemctl restart firewalld.service
displays the status of a service : systemctl status firewalld.service
enable a service at boot: systemctl enable firewalld.service
disable a service at boot: systemctl disable firewalld.service
see if the service startup: systemctl is-enabled firewalld.service; echo
view your active service list: systemctl list-unit-files | grep enabled

Centos 7 firewall command:

View already open ports:

firewall-cmd --list-ports

Open port

firewall-cmd --zone=public --add-port=80/tcp --permanent

Command Meaning:

-zone # Scope

-add-port = 80 / tcp # Add port, the format is: port / protocol

-permanent # permanent, this parameter does not restart after failure

Restart the firewall


firewall-cmd --reload # restart firewall
systemctl firewalld.service STOP # Stop firewall
systemctl disable firewalld.service # prohibit firewall startup
firewall-cmd --state # view the default firewall status (turn off the display after notrunning, display running after opening)

Guess you like

Origin www.cnblogs.com/johnnyblog/p/11372561.html