Telnet is an application that is used to connect to a remote host’s command line terminal interface. Network and system administrators use this application to administer network devices. Although telnet has become obsolete for remote administration purposes this application is still widely used to verify connectivity to remote services that are based on TCP. In a client-server architecture, you can use telnet to make sure that no firewalls in between are blocking incoming connections to the server.
The telnet command syntax is the following: telnet host port
For example, if you want to test connectivity to a remote service using port 9000 on any host, you’ll have to type: tenlet <<IP/hostname>> 9000
If the service is running with no firewalls in-between blocking incoming connections, the telnet command will return the following prompt:
Let’s see what happens when a firewall in between is rejecting connections:
In this case, telnet is returning the message “Connection refused” to communicate to the user that a firewall is blocking connections to the specified TCP port on the remote host. In this scenario, telnet is failing. It could be because of any of the below reasons
1) A network or host firewall is dropping incoming connections.
2) The remote is down.
3) Network connectivity between the client and server is unavailable for some reason.
4) The service on the client may not be running on the specific port.
In this case, further troubleshooting is required, such as verifying with a traceroute from the client side where the connection is interrupted or getting in touch with the administrator of the remote host to ask whether the remote service is running and allowed by any firewall in between.