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.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.
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:
- 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.
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: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.
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: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.