Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 127.0.0.1:8001         0.0.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
add comment

2 Answers

up vote 1 down vote accepted

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

[Edit]

Oh. See in your netstat output the 127.0.0.1:8001? 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
add comment

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

iptables-save

OR

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
add comment

Your Answer

 
discard

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.