在本文我们学习如何在Ubuntu上配置和设置UFW(防火墙),UFW代表“不复杂的防火墙”,它充当IPTABLES的接口,从而简化了防火墙的配置过程,对于防火墙来说,这是非常困难的。初学者学习和配置防火墙规则,在这些规则中,我们将保护计算机免受未知用户的访问。UFW使用我们配置为规则的策略。
需要条件
在计算机上具有root权限的用户。
安装UFW(防火墙)
UFW默认情况下随Ubuntu一起安装,如果未安装,则我们将使用以下命令进行安装
$ sudo apt-get install ufw -y # 指令
# 返回内容
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
ufw
0 upgraded, 1 newly installed, 0 to remove and 88 not upgraded.
Need to get 149 kB of archives.
After this operation, 838 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 ufw all 0.35-0ubuntu2 [149 kB]
Fetched 149 kB in 0s (165 kB/s)
Preconfiguring packages ...
Selecting previously unselected package ufw.
(Reading database ... 98515 files and directories currently installed.)
Preparing to unpack .../ufw_0.35-0ubuntu2_all.deb ..
Unpacking ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ufw (0.35-0ubuntu2) ...
启用UFW(防火墙)
以下是启用UFW的命令
sudo ufw enable