Skip to main content
This article describes how to use the telnet program to troubleshoot network applications.

About telnet

For many years, the telnet program was the program of choice for connecting to a remote server. However, it sends data unencrypted, and SSH (Secure Shell) has almost completely replaced telnet as the preferred method for connecting to remote servers. However, telnet is still valuable as a troubleshooting tool. You can use telnet to test TCP connections to a remote server on any port. Once telnet establishes a connection, you can send raw commands to do additional testing.

Enabling telnet

Linux includes the telnet client by default. Windows 10 includes telnet as part of the Windows Subsystem for Linux. Telnet can also be installed on Windows 10 and older versions of Windows by following these instructions. Macintosh OS X included telnet by default until recently. If your version does not include telnet, it can be installed following these instructions.
Don’t want to install software? Try our articles on network troubleshooting using curl or using
PowerShell and tnc. Just about every computer will have one of these three programs installed.

Using telnet to troubleshoot

To use telnet to troubleshoot a network application, you need to know at least two things:
  • The remote server name or IP address.
  • The port number for the network application you want to test.
If you are only testing basic connectivity to a particular network application, that is all you need to know. If you want to do more in-depth testing, however, you will need to know specific commands for the protocol you want to test (for example, HTTP or SMTP). To open a connection to a remote server, open a terminal window on your computer, and then type telnet IP/host port, where IP/host represents the IP address or hostname of the server, and port represents the TCP port number. For example, to connect to example.com on port 80, type the following command:
For a complete list of assigned TCP port numbers, please visit
http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers.
When you try to establish a connection to a remote server, one of two things happens:
  • The server accepts the connection. If this happens, telnet may display some text from the server, or simply await further input.
  • The server rejects the connection. If this happens, you receive a message such as Connection refused or Connect failed.
The following sections demonstrate how to do basic telnet troubleshooting with some common network applications.

Troubleshooting web servers

Web server testing is probably the most common scenario for telnet troubleshooting. With telnet, you can open a connection to a remote server on port 80, and then send HTTP commands. For example, the following text shows an exchange between telnet and a remote web server:
In this exchange, telnet opens a connection to example.com on port 80. The user receives confirmation that there is a connection to the server, and then sends an HTTP command and request header. The HTTP response confirms that the server is accepting connections and responding to requests.

Troubleshooting mail (SMTP) servers

To test an SMTP server, use telnet to connect to port 25.
If you are testing connectivity to a hosting.com mail server, you can also use port 2525 or 587. Some ISPs block port 25 to help reduce spam on their networks.
The following text shows a sample exchange between telnet and a remote mail server:
The SMTP responses show that the server is running and accepting requests.

Troubleshooting FTP

To test an FTP server, use telnet to connect to port 21. The following text shows a sample exchange between telnet and a remote FTP server:
The FTP server responds, indicating that it is active and running. SSH uses encrypted connections. However, you can still use telnet to verify that the service is running on a server. The following text shows a sample exchange between telnet and a remote SSH server on port 22:
The server returns a response indicating the current OpenSSH version.
Make sure you use the correct SSH port number for your account. For example, some hosting accounts use a different port for SSH, such as 7822.