I have a unique situation. Let's say my webserver ( e.g. is connected to eth0 of my firewall (gw A local network ( is also connected to eth1 ( of my firewall. Now I want to allow traffic from web server initialized from internal network. How should I use iptables command to do this? Is there a --state option that specifies INITIALIZED state?

  • Just use RELATED/ESTABLISHED. – Chris Down Oct 4 '14 at 3:07
  • @ChrisDown ok, so there is no actual INITIALIZED state? RELATED/ESTABLISHED should cover the INITIALIZED state, right? – SSF Oct 4 '14 at 3:12
  • @TylerMaginnis that's actually a nice tool, thanks. – SSF Oct 4 '14 at 3:15

You can try adding the following rules to your iptables firewall:

$ sudo iptables -A INPUT -p tcp --dport 80 -s -m state \
$ sudo iptables -A OUTPUT -p tcp --sport 80 -d -m state \
     --state ESTABLISHED -j ACCEPT

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.