sexta-feira, 22 de novembro de 2019

How to list, delete and include iptables rules.

First you should list all rules and index tem so you can pinpont your request correctly:

 sudo iptables -nL --line-numbers

Note: the -n means to not use DNS to resolve IP; the -L means to list rules; --line-numbers you can guess what it means.

Now you can choose a "chain", in this example: "INPUT" and use the "-D" to indicate delete and the final number is point to rule "5"

 sudo iptables -D INPUT 5

You can also add a rule, and bellow I will use chain INPUT for a known hacker from Kenya, Africa:

 sudo iptables -I INPUT 1 -s -j DROP

That's it for now. 
Cheers!  and Shields up!