Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 trying to drop all access to 8180 (TCP) port except for one IP.

The drop:

iptables -A INPUT -p tcp --dport 8180 -j DROP

The exception:

iptables -A INPUT -s -p tcp --dport 8180 -j ACCEPT

Where is the IP that is allowed to access the specific port.

What's wrong?

share|improve this question

Make sure your ACCEPT rule is above your DROP rule in your rules file, otherwise the packet will be dropped before it has the chance to be accepted.

share|improve this answer
Yes, that can be a problem also but it wasn't mine. I actually fixed it by specifying the destination and the interface. – Bogdan May 17 '09 at 15:17

Just going to add, you probably want to have a default-deny rule in place. In that case you won't need the drop for that port and can simply specify what you do want to allow, i.e. access to port 8180 from

share|improve this answer

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.