This is what I have specified as a default rule in my iptables firewall script:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X

iptables -P INPUT ACCEPT

I have many interfaces and many networks and NATing where traffic should get forwarded, so I have made FORWARD ACCEPT as default rule. And next I have this:

iptables -t nat -A POSTROUTING -s -o eth0 -j SNAT --to-source

And at the end I have this:

iptables -A INPUT -i eth0 -j DROP

This DROP rule should drop only packets directed to the gateway host. Whatever traffic that comes in via eth0 to be forwared should not get affected.

My question is, if I have a INPUT DROP rule for an interface, whether it will affect the FORWARD chains on the same interface (or the global FORWARD ACCEPT chain)?


There should not be any problem because INPUT chain rule is applied when "Packet is going to be delivered locally. Local delivery is controlled by the “local-delivery” routing table: ip route show table local" and FORWARD chain is applied on packets that have been routed and so the packets that are not for local delivery will traverse this chain.

So your INPUT chain rule should not affect the FORWARD chain rule.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.