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.

  • 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 :( – Marco Herrarte Oct 21 '13 at 1:40

Try something like this:

$ iptables -A INPUT -p tcp --dport 3343 -j ACCEPT
$ iptables -A INPUT -p tcp --dport 8880 -j ACCEPT
  • 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


/etc/init.d/networking restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.