Ubuntu防火墙管理:ufw安装与配置
查看防火墙状态
root@ecs:~# ufw status Status: inactive开启防火墙
root@ecs:~# ufw enable Command may disrupt existing ssh connections. Proceed with operation (y|n)? y Firewall is active and enabled on system startup关闭防火墙
root@ecs:~# ufw disable Firewall stopped and disabled on system startup查看防火墙版本
root@ecs:~# ufw version ufw 0.36.1 Copyright 2008-2021 Canonical Ltd.允许外部访问
root@ecs:~# ufw default allow Default incoming policy changed to 'allow' (be sure to update your rules accordingly)拒绝外部访问
root@ecs:~# ufw default deny Default incoming policy changed to 'deny' (be sure to update your rules accordingly)允许外部访问80端口
root@ecs:~# ufw allow 80 Rule added Rule added (v6)拒绝外部访问80端口
root@ecs:~# ufw deny 80 Rule updated Rule updated (v6)允许指定IP访问本机所有端口
root@ecs:~# ufw allow from 192.168.1.9 Rule added