Setting Up UFW Firewall
Learn how to set up and manage UFW (Uncomplicated Firewall) on Ubuntu with advanced configurations.
- Install UFW:
sudo apt install ufw
- Set default policies:
sudo ufw default deny incoming
sudo ufw default allow outgoing
- Enable UFW:
sudo ufw enable
- Allow specific services:
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
- Advanced configurations:
# Allow specific IP range
sudo ufw allow from 192.168.1.0/24
# Rate limiting
sudo ufw limit ssh
# Delete rule
sudo ufw delete allow http
Monitoring and logging:
- Check status:
sudo ufw status verbose
- View logs:
sudo less /var/log/ufw.log
- Monitor real-time:
sudo ufw logging on
Read more: UFW Documentation