UFW (Ubuntu):

  1. Default deny: sudo ufw default deny incoming

  2. Allow necessary ports: sudo ufw allow ssh

  3. Enable UFW: sudo ufw enable

Firewalld (CentOS):

  1. Start: sudo systemctl start firewalld

  2. Default zone: sudo firewall-cmd --set-default-zone=public

  3. Allow SSH: sudo firewall-cmd --permanent --add-service=ssh

  4. Reload: sudo firewall-cmd --reload

Proper firewall rules help control who can access your VPS and how.

Was this answer helpful? 0 Users Found This Useful (0 Votes)