Cisco Network Security Troubleshooting Handbook

telnet Command

As you know, Telnet is primarily used to log in to a specific device for configuration purposes. However, the telnet command also can check the status of a specific TCP port of an application to see if the application is working on that specific port. For instance, to find out if the mail server is alive and listening on port 25 for SMTP, use the telnet command with mail server IP address or the domain name along with the port number 25 as an argument, as follows:

D:\>telnet xxx.xyz.com 25
220 xxx.xyz.com ESMTP Sendmail ......

You can also check to see if the web server is alive by using Telnet to access the web server with port 80, and after that executing the get command. Example 2-1 shows output from a live web server with the telnet command on port 80:

Example 2-1. Shows the Output of Telnet Test for a Live Web Server

D:\>telnet www.xyz.com 80
HTTP/1.0 200 OK
Cache-Control: no-store
Pragma: no-cache
Cache-Control: no-cache
X-Bypass-Cache: Application and Content Networking System Software 4.2.9
Connection: Close

Connection to host lost.
D:\>
Just as with a mail server and web server, you can find out if a TCP-based application is running and listening on a specific TCP port with the telnet command in a similar fashion as shown earlier.