Как запустить / остановить и включить / отключить FirewallD и Iptables Firewall в Linux

Как запустить / остановить и включить / отключить FirewallD и Iptables Firewall в Linux

Как запустить / остановить и включить / отключить службу FirewallD

If you’re using CentOS/RHEL 7 or Fedora 18+ versions, you should follow below instructions to manage FirewallD service.

Start FirewallD Service

# systemctl start firewalld 

Stop FirewallD Service

# systemctl stop firewalld

Check the Status of FirewallD

# systemctl status firewalld

Check the State of FirewallD

# firewall-cmd --state

As an alternative, you can disable the firewalld service so that it doesn’t apply rules to packets and enable ones needed again.

Disable FirewallD Service

# systemctl disable firewalld

Enable FirewallD Service

# systemctl enable firewalld

Mask FirewallD Service

# systemctl mask firewalld

Кроме того, вы можете замаскировать службу брандмауэра, которая создает символическую ссылку firewall.service на /dev/ null, тем самым отключая службу.

Unmask FirewallD Service

# systemctl unmask firewalld

This is reverse of masking the service. This removes the symlink of the service created during masking, thus re-enabling the service.

Как запустить / остановить и включить / отключить службу IPtables

On RHEL/CentOS 6/5/4 and Fedora 12-18 iptables firewall comes as pre and later, the iptables service can be installed via:

# yum install iptables-services

Then, the service can be started, stopped or restarted via following commands:

Start Iptables Service

# systemctl start iptables
OR
# service iptables start

Stop Iptables Service

# systemctl stop iptables
OR
# service iptables stop

Disable Iptables Service

# systemctl disable iptables
Or
# service iptables save
# service iptables stop

Enable Iptables Service

# systemctl enable iptables
Or
# service iptables start

Check Status of Iptables Service

# systemctl status iptables
OR
# service iptables status

On Ubuntu and some other Linux distributions however, ufw is the command which is used to manage the iptables firewall service. Ufw provides an easy interface for the user to handle the iptables firewall service.

Enable Ufw Iptables Firewall

$ sudo ufw enable

Disable Ufw Iptables Firewall

$ sudo ufw disable

Check Status of Ufw Iptables Firewall

# sudo ufw status 

However, if you want to list chains in iptables which contains all the rules following command can help you achieve the same:

# iptables -L -n -v

< Назад к списку новостей