Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos6&7 Common system Firewall Command

Shulou Source: shulou.com Published: 2022-06-03 04:47:08 09月21日 Update

Cento7 Common query commands start: systemctl start firewalld View status: systemctl status firewalld or firewall-cmd-- state permanently closed: systemctl disable firewalld temporarily closed: systemctl stop firewalld configuration firewalld View version: $firewall-cmd-- version View help: $firewall-cmd-- help View Settings: display status: $firewall-cmd-- state View area Information: $firewall-cmd-- get-active-zones View the area to which the specified interface belongs: $firewall -cmd-- get-zone-of-interface=eth0 updates firewall rules: firewall-cmd-- reload firewall-cmd-- the difference between the two is that the first one does not need to be disconnected It is one of the firewalld features to dynamically add rules, and the second one needs to be disconnected, similar to restarting the service to add interfaces to the zone. The default interfaces are in public' firewall-cmd-- zone=public-- add-interface=eth0 permanent plus-- permanent and then reload Firewall sets the default interface area firewall-cmd-- set-default-zone=public takes effect immediately without restarting the open / closed ports to view all open ports: firewall-cmd-- zone=dmz-- list-ports join a port to the zone: firewall-cmd-- zone=dmz-- add-port=8080/tcp if you want to be permanently effective. Ditto-- permanent opens a service Firewall-cmd-- zone=work-- add-service=smtp remove service / port / Nic firewall-cmd-- zone=work-- remove-service=smtp firewall-cmd-- zone=work-- remove-port=8080/tcp firewall-cmd-- zone=work-- remove-interfance=eth0centos6.X basic command View status: service iptables status start: service iptables start off: service iptables stop Restart: service iptables restart is permanently closed: chkconfig iptables off is turned on after permanent shutdown: chkconfig iptables on firewall adds a port: 80 as an example (save exit restart firewall after adding)-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 80-j ACCEPT check status after adding

Check the firewall port open list: vi / etc/sysconfig/iptables

| View a port occupancy Netstat-anlpt | grep port number |

Tags: Port firewall fire protection zone permanent interface status service command namely rule common use information dynamic slogan foundation commonly used query situation ownership method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi Redmi MariaDB Shulou Technology