Server Fault is a question and answer site for system and network administrators. 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

Is it possible to implement a simple code lock triggered by connecting ports with iptables? So for example a visitor need to connect ports 1001,1009,1008,1004 in this order to get access to port 80. Any other port hit out of order in the range 1000-1009 would reset the lock.

share|improve this question
up vote 6 down vote accepted

This strategy is known as "port-knocking" and there are numerous implementations.

See this link for a large list, pretty linux-centric:

And the Wikipedia entry:

Here's an iptables-only version (which I personally find revolting):

share|improve this answer
ok, as it seems iptables alone can not provide this. If this holds, I will accept this answer. – dronus Feb 20 '14 at 3:37
Edited to include iptables-only example. – quadruplebucky Feb 20 '14 at 3:58
Fantastic! Will check this out. – dronus Feb 20 '14 at 10:55

Your Answer


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.