在 Debian 系统中,防火墙可以通过多种工具进行管理,如 iptables
、firewalld
和 ufw
。以下是使用这些工具启用和禁用防火墙的方法。
ufw
(Uncomplicated Firewall)是 Debian 和 Ubuntu 系统中常用的防火墙管理工具。
要启用 ufw
防火墙,请在终端中输入以下命令:
sudo ufw enable
此命令将启用 ufw
防火墙,并使其在系统启动时自动启动。
要禁用 ufw
防火墙,请在终端中输入以下命令:
sudo ufw disable
此命令将禁用 ufw
防火墙。
firewalld
是 Red Hat 系列(如 CentOS、Fedora)中默认的防火墙管理工具,但也可以在 Debian 系统上使用。
要启用 firewalld
防火墙,请在终端中输入以下命令:
sudo systemctl start firewalld
sudo systemctl enable firewalld
第一行命令将启动 firewalld
服务,第二行命令将使其在系统启动时自动启动。
要禁用 firewalld
防火墙,请在终端中输入以下命令:
sudo systemctl stop firewalld
sudo systemctl disable firewalld
第一行命令将停止 firewalld
服务,第二行命令将禁用该服务,防止其在系统启动时自动启动。
请注意,在执行任何防火墙操作之前,确保了解这些操作的影响,并在必要时采取适当的安全措施。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:debian防火墙如何启用