Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
iptables -P OUTPUT ACCEPT
iptables -P FORWARD 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 192.168.1.0/24 -o eth0 -j SNAT --to-source 2.4.5.6

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)?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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