SoFunction
Updated on 2025-03-02

How to deal with telnet Connection Refused port not running

1. Brief description of telnet

telnet is generally used to test whether the destination port of the local machine is connected to the destination host. The telnet command is followed by the destination host's IP or domain name.

The format is as follows:

telnet ${domain name}|${IP} ${port}

Examples are as follows:

$ telnet  80
Trying 110.242.68.3...
Connected to .
Escape character is '^]'.
^]
telnet> quit
Connection closed.

In order to facilitate the explanation of the function of the telnet command, we can give a small example:

You are in Community A and your friend is in Community B. You want to find your friend, but you are not sure if your friend is at home, you can find someone to help you check it out in advance (telnet).

During the process of exploring the path, the following situations may be encountered:

  • The routes from Cell A to Cell B are blocked (the physical links of the two host networks are blocked);
  • There are roadblocks between cell A and cell B that cannot pass (the firewall does not open the relevant network);
  • My friend moved (the service of the destination host has not started);

These situations will cause you to not be able to see friends (cannot access the service and the network is not accessible).

2. Ideas for handling telnet Connection refused to be clear

According to our previous analysis, at work,Telnet is not just a network problem

Generally, the following two situations are

  • The firewall network is not enabled;
  • The service of the destination host has not started;

Troubleshooting the destination host service

The destination host service has not started, you can use the nc command to start and listen to the port

The command is as follows:

#Start nc monitoring, -l set to enable monitoring mode, -k enable support for multi-client simultaneous connection modenc -lk ${port}

After listening to the host service port, if the telnet still blocks, you need to contact your colleagues on the network to check it together!

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.