The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do i enable a port in linux

Discussion in 'General Discussion' started by linuxmelz, Apr 25, 2005.

  1. linuxmelz

    linuxmelz Registered

    Joined:
    Dec 20, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Dear friend..


    Could you please advice me a way to open a port in linux. I donot have a apf sotware or any such thing.. Can we do it with any predefined tools that comes with linux OS itself.

    Any help would be greatly appreciated..

    Thanking one and all in advance for all of your views and suggestions..

    Yours friendly,
    Linuxmelz ;)
     
    #1 linuxmelz, Apr 25, 2005
    Last edited: Apr 25, 2005
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    If you don't have any firewall running on your server then all ports should be open, or thereabouts.

    What port do you need access to and what are you trying to achieve?
     
  3. linuxmelz

    linuxmelz Registered

    Joined:
    Dec 20, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    Thank you for writing in my friend..

    A client wants to enable a port at 12375 port, for his chat software.. how do i do it.. also i think netstat -lpn dosn't show the port to be open..

    Any help or views are warmly welcomed..

    Regards,
    Linuxmelz ;)
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    I believe that netstat -lpn will list only the currently active/open ports. Therefore if port 12375 is not being used by anything, it would not be listed.

    As I said, if you don't have a firewall enabled, all ports should be open. It is not the case that ports are by default inaccessible and that you have to make them accessible in some way, but the exact opposite - unless you do something to prevent the use of a port it will be usable.

    Assuming that there is a chat server you need to install, and that it is designed to listen on port 12375, once installed it should do, unless it is not working correctly.
     
  5. brentp

    brentp Well-Known Member

    Joined:
    Mar 11, 2004
    Messages:
    324
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Ayr, North Queensland, Australia
    well, make sure its open via iptabes, then get them to start their chat software which should bind to the port.

    Regards,
    Brent
     
  6. linuxmelz

    linuxmelz Registered

    Joined:
    Dec 20, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    Dear friend,

    It would be appreciated if you could please tell me how do i open a port using ip-tables. Every ones view/sugesstions are hearty welcomed.

    Regards,
    Linumelz ;)
     
  7. JamesCTotalWeb

    JamesCTotalWeb Well-Known Member

    Joined:
    Mar 20, 2005
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Well assuming the protocol is tcp you can just run this command from the command line.

    iptables -A INPUT -p tcp --dport 12375 -j ACCEPT

    iptables -A OUTPUT -p tcp --dport 12375 -j ACCEPT

    you can also add them to your iptables-config file then restart iptables

    /etc/init.d/iptables restart

    Here is a good place to learn about iptables

    http://www.siliconvalleyccie.com/linux-hn/iptables-intro.htm

    remember use this at your own risk if ya break it ya pay for it ........ lol
     
  8. Kerstin

    Kerstin Well-Known Member

    Joined:
    Apr 9, 2005
    Messages:
    136
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Berlin
    Iptables -? should show the allocates ;) ports. [0 to 65535] :confused:

    The commands

    iptables -A INPUT -p tcp --dport 12375 -j ACCEPT
    iptables -A OUTPUT -p tcp --dport 12375 -j ACCEPT
    /etc/init.d/iptables restart

    allocate a port, but a port must be used by a accurate application and protocol.
    You must known the correct TCP (UDP) port, used by the protocol.
     
  9. petedickson

    petedickson Member

    Joined:
    Jun 16, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    The above post solved my problem of opening port 81 - thanks!

    However, I've been unable to figure out how to keep the port open! I have to SSH into my box every day and run /etc/init.d/iptables restart (I don't need to enter the INPUT and OUTPUT commands again, though).

    FYI, my /etc/sysconfig/iptables-config looks like:

    # Additional iptables modules (nat helper)
    # Default: -empty-
    #IPTABLES_MODULES="ip_nat_ftp"

    # Save current firewall rules on stop.
    # Value: yes|no, default: no
    #IPTABLES_SAVE_ON_STOP="no"

    # Save current firewall rules on restart.
    # Value: yes|no, default: no
    #IPTABLES_SAVE_ON_RESTART="no"

    # Save (and restore) rule counter.
    # Value: yes|no, default: no
    #IPTABLES_SAVE_COUNTER="no"

    # Numeric status output
    # Value: yes|no, default: no
    #IPTABLES_STATUS_NUMERIC="no"


    Any help, greatly appreciated.

    cheers

    Pete Dickson
    Birmingham, UK
     
  10. petedickson

    petedickson Member

    Joined:
    Jun 16, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Can anyone help with my follow up question, posted above?

    Many thanks.

    Pete Dickson
    Birmingham, UK
     
  11. shashank

    shashank Well-Known Member
    PartnerNOC

    Joined:
    Apr 12, 2003
    Messages:
    159
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    You should issue iptables-save after you have all the rules applied. I find it strange you have to login everyday and restart it. May be you can put a cron for it if there is a problem.
     
  12. nickb

    nickb Well-Known Member

    Joined:
    Feb 25, 2005
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Do you have service iptables enabled in chkconfig??? if not, enable it to start it at system startup or place /etc/init.d/iptables start in your /etc/rc.local.
     
  13. petedickson

    petedickson Member

    Joined:
    Jun 16, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Aren't these files for when the server reboots?

    The server is staying up. It just seems to forget about port 81!

    Just type the command iptables-save?

    Thanks for your help.

    Pete Dickson
    Birmingham, UK
     
  14. nickb

    nickb Well-Known Member

    Joined:
    Feb 25, 2005
    Messages:
    347
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    I suggest you to Install APF..its a nice tool and will take care of all of your ports and iptable configurations. Search the forum and you will get nice info bout installation and configuration of APF.
     
  15. Smart-Guyz

    Smart-Guyz Registered

    Joined:
    Aug 27, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    If i insert a Core Config (sample 127.0.0.1) I get this message (for cPGSD):

    There seems to have been a problem: "Unable to create socket, perhaps the remote end is unreachable ?: Failed to open Private Key "

    I've tryed to do the things above, but the port 20100 still is'nt open, can some one help me solve this problem?
     
Loading...

Share This Page