sudo ufw status查看防火墙状态
lychie@ubuntu:/$ sudo ufw status
Status: active
sudo ufw disable关闭防火墙
lychie@ubuntu:/$ sudo ufw disable
Firewall stopped and disabled on system startup
lychie@ubuntu:/$ sudo ufw status
Status: inactive
sudo ufw enable启动防火墙
lychie@ubuntu:/$ sudo ufw enable
Firewall is active and enabled on system startup
lychie@ubuntu:/$ sudo ufw status
Status: active
sudo ufw allow 端口打开某个端口
lychie@ubuntu:/$ sudo ufw allow 22
Rule added
Rule added (v6)
lychie@ubuntu:/$ sudo ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
sudo ufw delete allow 端口关闭某个端口
lychie@ubuntu:/$ sudo ufw delete allow 22
Rule deleted
Rule deleted (v6)
lychie@ubuntu:/$ sudo ufw status
Status: active