Skip to content

Instantly share code, notes, and snippets.

@tonmanna
Created November 3, 2021 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonmanna/1e12410d95cd44948582d780e8d5709d to your computer and use it in GitHub Desktop.
Save tonmanna/1e12410d95cd44948582d780e8d5709d to your computer and use it in GitHub Desktop.
UFW Block firewall
sudo ufw deny from {ip-address-here} to any
sudo ufw deny from 192.168.1.5 to any
sudo ufw reject from 202.54.5.7 to any
sudo ufw status
ufw deny from {ip-address-here} to any port {port-number-here}
sudo ufw deny from 202.54.1.5 to any port 80
sudo ufw status numbered
sudo vi /etc/ufw/before.rules
# Block spammers
-A ufw-before-input -s 178.137.80.191 -j DROP
# Block ip/net (subnet)
-A ufw-before-input -s 202.54.1.0/24 -j DROP
ufw reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment