setting ufw rules…..
1. Read the rules:
~$ sudo ufw status numbered Status: active To Action From -- ------ ---- [ 1] Anywhere DENY IN xxx.xxx.xxx.xxx [ 2] Anywhere DENY IN xxx.xxx.xxx.xxx [ 3] 22 ALLOW IN Anywhere [ 4] 80 ALLOW IN Anywhere [ 5] 25 ALLOW IN Anywhere [ 6] 22 (v6) ALLOW IN Anywhere (v6) [ 7] 80 (v6) ALLOW IN Anywhere (v6) [ 8] 25 (v6) ALLOW IN Anywhere (v6)
2. Delete some numbered rule (delete rule number 1):
sudo ufw delete 1
Now importantly: Rule number 2 is now known as rule number 1,
So to delete that rule, do sudo ufw delete 1 again 😉
or refresh the list with sud ufw status numbered
3. Create a new rule, to ban all trafic from some ip-number:
sudo ufw insert 1 deny from xxx.xxx.xxx.xxx
-> this sets a new rule at first place in the rule list.