What's wrong with "iptables -P FORWARD DROP"?

I don't want my device to route IP packets between any other devices that I don't know about.

The default setting is ACCEPT, not DROP. Why?

(3 votes)
Loading...

Similar Posts

Subscribe
Notify of
15 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
KarlRanseierIII
8 months ago
# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

Typically, Forwarding eh is disabled and if you activate it, you can also configure the FW immediately.

From this, the default policy is ACCEPT in everything, simply because such keien intervention takes place when nothing has been configured.

KarlRanseierIII
8 months ago
Reply to  DummeStudentin

Not necessarily.

kmkcl
8 months ago

I’d say the standard case is that no firewall is active. So first of all, a trustworthy network.

iQa1x
8 months ago

The default setting of all iptables policies is ACCEPT. Turning to DROP is always sensible. Even if you use the function, you will set specific rules for the permitted traffic.

If you don’t forwarding / routing, you can change the problem.

I also have policy DROP at INPUT and OUTPUT, but with appropriate rules for the permitted traffic before.

Typically, however, there is a net.ipv4.ip_forward Kernel Flag, which is often default, so that Accept does not exist in principle.

PS: If you do a docker or virtualization on the box, you may need it. Rules for.

iQa1x
8 months ago
Reply to  DummeStudentin

DROP allows more control. for the services there are rules that explicitly allow them. For example, I just want to allow ssh in the LAN, not worldwide. At OUTPUT you can be divided opinion because it does work, then I will do it only on servers with a fixed task.

anTTraXX
8 months ago

A general DROP would block any forwarding traffic, regardless of specific safety rules. What should inevitably lead to problems in the network.

Xandros0506
8 months ago
Reply to  DummeStudentin

Actually, it is not “just” the policy that intervenes when no other rule applies. The “only” is completely wrong with the place, because it is the policy that IMMER intervenes when there is no other rule. It’s like the junk container that runs into any crap you haven’t explicitly treated with another rule before.

So it is quite possible that there is also something that you need in the network, but because you don’t explicitly treat it with another rule (and you don’t have it on the screen!), then you shoot yourself into the Nirvana.

So that can be completely ok and appropriate, but it can also cause immense problems if you don’t think this policy is active.

Usually you leave all traffic first and then block what you absolutely do not want.
You want to block everything in a different way -> and then allow it again. Do you have to decide which path is easier to maintain in your application.

anTTraXX
8 months ago
Reply to  DummeStudentin

Well, you have to assume that the DAU does not know that much and therefore it is not necessary to seal the firewall completely.

Thomasg
8 months ago

This is about the forward chain, which is not required on a normal PC or server, only if the computer functions as a router or firewall. Therefore, a drop as default policy does not harm.

Apart from the fact that it has no effect as long as you do not explicitly provide the ip forwarding in the kernel by means of

sysctl net.ipv4.ip_forward=1

has activated.

And yes, the policy sets out whether you want to have black or whitelisting in the respective chain. Everyone has to decide what is more sensible for the respective application.

TheAmigos
8 months ago

Sorry, which device you mean