Centos7 of the firewall configuration commands

  1. The basic use of firewalld
    view the status: systemctl status firewalld
    start: systemctl start firewalld
    stop: systemctl stop firewalld
    enabled: systemctl enable firewalld
    disabled: systemctl disable firewalld

  2. systemctl is CentOS7 service management tool in the main tool before it blends service and chkconfig functions in one.
    Start a service: systemctl start firewalld.service
    shut down a service: systemctlstop firewalld.service
    restart a service: systemctlrestart firewalld.service
    displays the status of a service: systemctlstatus firewalld.service
    enable a service at boot: systemctlenable firewalld.service
    disabled at boot a service: systemctldisable firewalld.service
    see if the service startup: systemctlis-enabled firewalld.service
    view your active list of services: systemctllist-unit-files | grep enabled
    to view list of services failed to start: systemctl - failed

  3. Configuring firewalld-cmd
    view version: firewall-cmd --version
    View help: firewall-cmd --help
    display status: firewall-cmd --state
    view all open ports: firewall-cmd - zone = public --list-ports
    update firewall rules: firewall-cmd --reload
    viewing area information: firewall-cmd - get-active -zones
    Specifies an interface belongs: firewall-cmd - get-zone -of-interface = eth0
    to reject all packets: firewall- cmd --panic-on
    unblock status: firewall-cmd --panic-off
    to see if refused: firewall-cmd --query-panic

How to open a port that does
add
firewall-cmd --zone = public --add- port = 80 / tcp --permanent (--permanent permanent, this argument does not restart after failure)

Reload
firewall-cmd --reload

See
firewall-cmd --zone = public --query- port = 80 / tcp

删除
firewall-cmd --zone=public --remove-port=80/tcp --permanent

Check firewall is running, the following two commands can
systemctl Status firewalld.service
firewall-cmd --state

Check which ports are currently open
in fact a service corresponding to a port, each service corresponds to / usr / lib / firewalld / services following an xml file.
firewall-cmd --list-services

See what other services can open
firewall-cmd --get-services

View all open ports:
Firewall-cmd = --zone public --list-the ports

Update firewall rules:
Firewall-cmd --reload

Guess you like

Origin www.cnblogs.com/JaxYoun/p/12335977.html