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 am using the following iptables rule to try allowing access to port 8080 from one IP address:

iptables -A INPUT -s -p tcp -m tcp --dport 8080 -j ACCEPT

However, this rule isn't working. If I remove the -s part, then it works, but it allows anyone access to port 8080 (not desired).

When I run iptables -L after applying the rule above, I get the following (which mystifies me - why won't it just display the actual IP in the source?):

root@wso-solr:/etc# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere            tcp dpt:http-alt 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
DROP       all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

I'm wondering if this might be some sort of dns oddity that causes iptables to see the wrong IP address/DNS entry for my particular server (it returns the for source instead of the IP address...).

share|improve this question
use --numeric or -n for numeric output of addresses and ports – Adam Sep 21 '10 at 16:54
You'll likely find it better to change the default policy to DROP (iptables -P INPUT DROP) than have it as accept with the last rule dropping all traffic. Less likely to trip you up in the future. – Sirex Jan 18 '11 at 12:54
up vote 1 down vote accepted

Looks like I was using the wrong IP address. My hosting provider identified the true IP of the server upon which my VPS was residing. I entered that, and everything worked like magic!

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.