telnet Connection refused Port failure processing

1. Brief introduction of telnet

Telnet is generally used to test whether the network connection between the machine and the destination port of the destination host is unreachable. The telnet command is followed by the IP or domain name of the destination host. The format is as follows:

telnet ${域名}${IP} ${port}

Examples are as follows:

$ telnet www.baidu.com 80
Trying 110.242.68.3...
Connected to www.a.shifen.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

In order to easily explain the function of the telnet command, we can give a small example: you are in community A, your friend is in community B, you want to find your friend, but you are not sure whether the friend is at home, you can find someone to help you Check it out (telnet) ahead of time. During the pathfinding process, the following situations may be encountered:

  • The road from cell A to cell B is blocked (the physical link of the two host networks is blocked);
  • There is a roadblock between community A and community B that cannot pass through (the firewall has not opened the relevant network);
  • The friend moved (the service of the destination host is not started);

These situations will cause you to be unable to see friends (no access to services, no network connection).

Two, telnet Connection refused no way to deal with ideas

According to our previous analysis, at work, telnet failure is not just a network problem , and generally corresponds to the last two situations above:

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

Check destination host service

If the destination host service is not started, you can use the nc command to start and monitor the port. The command is as follows:

#启动nc监听,-l设置开启监听模式,-k开启支持多客户端同时连接模式,-p指定监听端口
nc -lkp ${port}

After the service port of the destination host is monitored, if telnet still fails, you need to contact your network colleagues to check together!

Guess you like

Origin blog.csdn.net/u012949658/article/details/128648254