A firewall is a technology that helps a computer build a relatively isolated protective barrier between internal networks and external networks to protect data. If you enable a firewall for a simple application server and configure rules to block external access, you may be unable to connect to the server. This topic describes how to enable or disable the system firewall in a Linux simple application server.
Procedure
Run commands that are suitable for the Linux distribution of your instance.
CentOS 7/Red Hat 7/Alibaba Cloud Linux 2
Enable the system firewall.
systemctl start firewalld.serviceDisable the system firewall.
systemctl stop firewalld.serviceCheck the status of the system firewall.
firewall-cmd --state
Ubuntu
Enable the system firewall.
ufw enableDisable the system firewall.
ufw disableCheck the status of the system firewall.
ufw status
Debian
By default, no firewall is installed on Debian. If a firewall is installed on Debian, you can delete all firewall rules to remove traffic blocking.
Before you delete all firewall rules, back up the rules.
Run the following commands to back up firewall rules:
touch [$Iptables] iptables-save > [$Iptables]NoteReplace the
[$Iptables]variable with the actual directory in which you want to save the firewall rule backup file.Run the following command to delete all firewall rules:
iptables -F