Usage of Telnet
Telnet serves numerous purposes, exemplified through practical scenarios. Let’s explore its usage through an example.
Example 1: Verifying Accessibility of an HTTP Server
Step 1: We can check the availability of any HTTP server by using the below command.
telnet www.google.com 80
This uses default port 80 to connect to Google’s Web Server:
Step 2: Now send an HTTP request by typing the below code in the terminal.
GET / HTTP/1.1
Host: www.google.com
Step 3: We will get the response back from the Server if the connection is successful and it will include the Date, Cache-Control, Accept-Ranges, Response code, etc, and possibly the content also of the webpage.
Here we got the Status Code of 200 and the content of the homepage of www.google.com.
Example 2: Telnet to Test Open Ports
We can test for the open ports on a remote server using telnet. We’ll check for port 80 on a remote server
Step 1: To test the open port you have to use the IP address or hostname with the port that you want to test.
Syntax:
telnet <remote_host> <port_number>
Command:
telnet 192.168.1.100 80
Output:
And if the Port is not open then you will get a connection refused response.
Example 3: Telnet to test a Mail Server
Step 1: Use the below syntax to use telnet to connect to the mail server.
Syntax:
telnet <mail_server_address> <port_number>
Command:
telnet localhost 25
Output:
Step 2: Now that the connection is successful, send the ehlo command. This command begins the SMTP session and introduces the client (you) to the server as example.com and gives back a list of supported features lists in response
Syntax:
ehlo example.com
Command:
ehlo testing.mail
Output:
Step 3: Now you can interact with the mail server by sending an email, checking the email queue, checking server status, troubleshoot issues, etc.
Step 4: When work is done you can exit it using the quit command.
quit
How to Install and Use Telnet on Ubuntu 22.04 LTS
In Ubuntu, client-server communication involves using Telnet, a network protocol that allows you to connect to remote servers and devices over a TCP/IP network. Telnet on Ubuntu 22.04 LTS enables you to establish text-based communication with servers for various purposes such as remote administration, troubleshooting, and testing network services. In this article, we will explore the installation and usage of Telenet on Ubuntu 22.04.