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 have run this command

'iptables -A INPUT -p tcp -m tcp --dport 8001 -j ACCEPT'

how do I apply this rule permanantly? i did run 'iptables-save', but it seemed not working

Thanks a lot

I have this from 'netstat -an'

tcp        0      0*               LISTEN      2021/ppstream

and this by 'iptables -L '

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:8001

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

but i still can not connect to this port, i am totally lost.

share|improve this question
up vote 1 down vote accepted

Make sure that the corresponding iptables-load is running on boot.


Oh. See in your netstat output the That means the program is only listening on localhost. The firewall isn't at fault here. You need to frob the program's config into listening on your IP, or even better on every interface.

share|improve this answer
Thanks a lot, that(program config) was the problem. It is good now! – Weiwei Sep 17 '10 at 4:23

After running the rules you want to save within your iptables you can run the command:



iptables-save > /etc/iptables.rules

which will save the rules to your current rules file if you have'nt changed it from the default.

You should also take a look at How To - Saving iptables from the ubunu wiki.

share|improve this answer
thanks, i did iptables-save but i could not connect to this port from other computer, something else i need to look into? – Weiwei Sep 17 '10 at 0:29
well i dont know what you want to do but usually it would be sudo iptables -A INPUT -p tcp --dport 8001 -j ACCEPT to simple allow connections to port 8001 but since i dont know what other rules you have, you can possible have another rule that may be affecting this one. – Guapo Sep 17 '10 at 0:54

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.