NO IMAGE

ufw是一個主機端的iptables類防火牆配置工具

安裝:

sudo apt-get install ufw

開啟,建議預設關閉所有外部訪問

sudo ufw enable
sudo ufw default deny

檢視ufw現在已經開放的埠:

[email protected]:~$ sudo ufw status
[sudo] password for ubuntu:
Status: active

ToActionFrom
———-
16430ALLOWAnywhere
30000ALLOWAnywhere
30001ALLOWAnywhere
1194/tcpALLOWAnywhere
16430 (v6)ALLOWAnywhere (v6)
30000 (v6)ALLOWAnywhere (v6)
30001 (v6)ALLOWAnywhere (v6)
1194/tcp (v6)ALLOWAnywhere (v6)
[email protected]:~$

新增埠

sudo ufw allow 8080

刪除埠

sudo ufw delete allow 8080

允許特定來源的ip地址訪問

sudo ufw allow from 192.168.1.1

其他命令可以如此檢視:

[email protected]:~$ sudo ufw –help

Usage: ufw COMMAND

Commands:

command:explanation:
enableenables the firewall
disabledisables the firewall
……