Why I can't I telnet to a specific port?

20,204

Solution 1

java is listening in 127.0.0.1, that is localhost.

You can't connect from outside, unless you do some kind of forwarding, using ssh for instance.

Edit:

from external hosts,

if unix/linux

ssh -L 1234:127.0.0.1:7778 runtime
  • then from that external host, telnet 127.0.0.1 1234 (ssh will forward you)

if windows, use putty or bitwise to forward local port 1234 to 7778 on host holding runtime.

Solution 2

The address 127.0.0.1 is the loopback address.

As you have the 127.0.0.1:7788 in the "Local Address" of netstat output, this means that the connection is only listening for connections originating from this computer only on the loopback interface. No other computers on the network can reach your loopback address directly hence the telnet is failing from other computers.

Share:
20,204

Related videos on Youtube

Nadya Nux
Author by

Nadya Nux

Updated on September 18, 2022

Comments

  • Nadya Nux
    Nadya Nux over 1 year

    the port 7778 is in listen,

    netstat -tulpn
    tcp        0      0 127.0.0.1:7778   0.0.0.0:*        LISTEN      22776/java
    

    but I can't telnet that port from remote machine while I can telnet other port by using this command

    telnet 192.168.1.100 port_number
    
    • zhongfu
      zhongfu about 9 years
      What do you mean "remote machine"? A machine outside your LAN, or a machine in your LAN?
    • Nadya Nux
      Nadya Nux about 9 years
      I mean in the same LAN
    • kubacapek
      kubacapek about 9 years
      I am pretty sure its because you are only listening on ip address 127.0.0.1 so only on loopback. You cant connect to that from anywhere.
    • zhongfu
      zhongfu about 9 years
      You said you couldn't "telnet that port" (7778) from the other machine, but what follows that suggests that you could do that. Could you explain what you're doing that doesn't work?
    • Nadya Nux
      Nadya Nux about 9 years
      i edit my question, i meant that i can telnet other ports from remote machine
    • Archemar
      Archemar about 9 years
      this looks like a XY problem, was java runtime meant to be use from external hosts ? is yes, you should configure it.
    • Nadya Nux
      Nadya Nux about 9 years
      yes it will be used from external hosts, this was my question in comment bellow, how to configure java to listen on IP address instead of localhost to be able to use it from remote machines.
    • heemayl
      heemayl about 9 years
      Please refrain from asking any X-Y question
    • Nadya Nux
      Nadya Nux about 9 years
      @heemayl : first time heard about XY question, because i still new here
  • Nadya Nux
    Nadya Nux about 9 years
    yes I can only telnet that port from localhost but i can't telnet it from remote host, so howto change it? i mean to use the address it instead of localhost and make it accessible by other machines?
  • Nadya Nux
    Nadya Nux about 9 years
    there is no way to force java to listen in IP address?
  • Archemar
    Archemar about 9 years
    You can alway rewrite the part of code that listen(), then recompile. Or ask your Oracle support.