Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm learning how to use iptables on ubuntu server.

Can you please explain to me what "Allowing Established Sessions" means and why should I include it in rules?

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

I understand concept of allowing specific ports and blocking others

sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT

block all

sudo iptables -A INPUT -j DROP

But I don't get the concept of allowing established session.



share|improve this question
up vote 2 down vote accepted

Some protocols are more complex than "send a single packet as a request, receive a single packet in response". ESTABLISHED handles transactions that are in process on a single port (e.g. HTTP keepalive), and RELATED handles new transactions on a different port that are related to an existing transaction.

share|improve this answer
makes sense. ty – Sandro Dzneladze Jul 5 '12 at 18:49
Does it mean with this rule sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT iptables will accept ESTABLISHED,RELATED traffic no matter which ports are being used. correct? – user454083 Sep 27 '15 at 16:08

With just the last 2 rules you will not be able to use any client on the computer as any response will be dropped. Furthermore use of the SSH server will be unreliable as related ICMP packet too big errors will be dropped.

share|improve this answer

You must log in to answer this question.

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