2 Replies Latest reply: Aug 26, 2012 9:51 AM by Tommyreynolds-Oracle RSS

    Open ports test with telnet - connection problem

    Luk004
      Hi
      I try to test open ports with telnet client. Unfortunately I get error:

      [root@localhost ~]# telnet 127.0.0.1
      Trying 127.0.0.1...
      telnet: connect to address 127.0.0.1: Connection refused

      For 1500 port:

      [root@localhost ~]# telnet 127.0.0.1 1500
      Trying 127.0.0.1...
      telnet: connect to address 127.0.0.1: Connection refused
      [root@localhost ~]#

      My /etc/hosts file:

      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

      I flushed iptables, and I have UP LOOPBACK RUNNING but it doesn't help.

      How could I fix it to connect and test ports?

      Thanks a lot for replies.
      Regards

      Edited by: Luk004 on 2012-08-24 01:52
        • 1. Re: Open ports test with telnet - connection problem
          Dude!
          Telnet was not designed to be a port testing tool. To query a specific port on a local machine:

          lsof -i tcp:22
          lsof -i -n -P
          netstat -nap

          For more sophisticated tasks and checking other machines install "nmap".

          If you suspect a problem with your firewall do not flush or delete the tables, instead simply disable the firewall for the duration of your testing, e.g.

          service iptables stop
          service iptables start
          • 2. Re: Open ports test with telnet - connection problem
            Tommyreynolds-Oracle
            Well, do you have any listeners on those ports? Do this:
            # /bin/netstat -ln
            and check if the port number you want to connect to is listed.

            It is best to check for port connectivity using the netcat nc(1) utility. Use netcat instead of telnet(1) because netcat will return a different message for each failure reason; telnet(1) just says the equivalent of "It's broken."

            So, instead of this:
            $ telnet host port
            do this:
            # /usr/bin/nc host port
            Be sure to try this as root, if you can; with some ports it matters.