I found this site:

In it, the author created default rules:

# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

But in this video @15:24, it's mentioned that you can set a default policy to DROP using

iptables --policy INPUT DROP

What is the difference between these two methods of creating an initial block all traffic rule set?


1 Answer 1


There is no difference at all. The only difference is whether the rule is created on the command line or in a config file.

The commands are also the same: iptables man page:

-P, --policy chain target

The config file approach means that setting up rules is consistent, done in the right order, and you can more easily review the whole rule set at a glance.

  • Sorry! Stupid question, I didn't realise that -P meant --policy!
    – Xoteric
    Commented May 30, 2023 at 13:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .