Open a port CentOS

7,363

Try something like this:

$ iptables -A INPUT -p tcp --dport 3343 -j ACCEPT
$ iptables -A INPUT -p tcp --dport 8880 -j ACCEPT
Share:
7,363

Related videos on Youtube

Marco Herrarte
Author by

Marco Herrarte

DevOps, CloudOps, IT passionate

Updated on September 18, 2022

Comments

  • Marco Herrarte
    Marco Herrarte almost 2 years

    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.

    • slm
      slm over 10 years
      So it works with the firewall off, but not when it's on?
    • Marco Herrarte
      Marco Herrarte over 10 years
      Exactly! I think i need to configure the firewall to access only to this ports, but i dont know how :(
  • Alohahaha
    Alohahaha over 10 years
    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"
  • slm
    slm over 10 years
    @PurindaGunasekara - getting ahead of ourselves. If these rules solve the issue then yes, we can make these permanent.