Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm new in CentOS and I'm trying to create a little script in Python, something like:

$ python -m SimpleHTTPServer

If I try to access port 8000 in my web browser, I don't get access, however if I turn off the firewall with:

$ system-config-firewall-tui

I'm able to access the service.

I just need to access port 3343 and 8880 but I don't want to disable the firewall.

share|improve this question
    
So it works with the firewall off, but not when it's on? –  slm Oct 21 '13 at 1:38
    
Exactly! I think i need to configure the firewall to access only to this ports, but i dont know how :( –  Kuait Oct 21 '13 at 1:40

2 Answers 2

up vote 1 down vote accepted

Try something like this:

$ iptables -A INPUT -p tcp --dport 3343 -j ACCEPT
$ iptables -A INPUT -p tcp --dport 8880 -j ACCEPT
share|improve this answer
    
if IPTables are not running you may need to run "system-config-securitylevel" first. And if you want them to be permanent save them by running "/sbin/service iptables save" –  Purinda Gunasekara Oct 21 '13 at 4:22
    
@PurindaGunasekara - getting ahead of ourselves. If these rules solve the issue then yes, we can make these permanent. –  slm Oct 21 '13 at 5:05

Just for anybody who needs, after make the change in iptables i reload the services with:

/etc/init.d/iptables restart

And

/etc/init.d/networking restart
share|improve this answer

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.