Basic commands of the telnet command line mode. Basic telnet commands and features of the remote access utility

Application layer protocol TELNET (from English. T.E. rmina LNET work) is a network protocol for implementing a text interface over the network. Name telnet We also received client programs for implementing this protocol for almost all existing operating systems. The Telnet protocol is one of the oldest network protocols, developed as a means of communication between remote terminals in test mode. Therefore, it does not provide data encryption and the use modern means authentication. The protocol is vulnerable to many network attacks and cannot be used as a means of managing network operating systems. Currently, for remote access The system uses the SSH (Secure SHell) network protocol, the creation of which focused specifically on security issues. The relative security of Telnet sessions is carried out only in a fully controlled network environment or using protection at the network level (various implementations of VPN - virtual private networks). However, TELNET is still used to manage specialized network devices (Switches, routers, etc.), as well as for network diagnostics, debugging and studying other text-oriented (telnet-like) protocols based on the TCP transport. Modern standard The Telnet protocol is described in RFC 854.

In modern operating systems of the Windows family, the utility telnet.exe by default, not installed. To install it you need to go to Control Panel - Programs and Features - Turn Windows features on or off and check the box for Telnet client. Or, in a command prompt running as an administrator, run the command:

pkgmgr /iu:"TelnetClient"

Format command line:

telnet [-a][-e Symbol][-f File][-l Name][-t Type][Host [Port]]

Command line options:

-l Login username remote system provided that the TELNET ENVIRON option is supported.

-a Automatic login attempt. Like the -l switch, but uses the current username under which you are logged in.

-e Service character for switching input mode in the telnet client window.

-f Client-side log file name. In the Russian-language help, this parameter is incorrectly interpreted as Login_File - “File name on the client side for logging into the system.”

-t Telnet terminal type. 4 types of terminals are supported: vt100, vt52, ansi and vtnt.

Knot The hostname or IP address of the remote computer to which you are connecting. Port Port number or service name. If the number is not specified, then the standard Telnet port 23\TCP is used

When launched without parameters, the utility goes into command input mode:

Welcome to the Microsoft Telnet Client

Microsoft Telnet>

When entering a character ? or help Help information is displayed:

Teams may be shortened. Supported commands are:

c-close- close the current connection

d-display- display operation parameters

o - open hostname [Port]- connect to the site (by default, Port = 23)

q - quit- exit telnet

set-set- set parameters ("set?" to display a list of them)

sen - send- send strings to the server

st - status- display information about the current state

u - unset- reset parameters ("unset ?" to display a list of them)

? /h - help- issue a certificate

Some of the commands allow you to get hints for use when entered with a question character:

Telnet> set ?- get a hint on using the mode setting command. Example of information displayed:

bsasdel- symbol BackSpace Delete

crlf- carriage return mode; causes CR & LF characters to be sent

delasbs- symbol Delete will be sent as a character BackSpace

escape x- where x is the symbol for switching to telnet terminal mode and back

localecho- enable local echo.

logfile x- where x is the log file. In Russian translation it is incorrectly interpreted as “Current client login file”

logging- recording the current session in the log. In Russian translation it is incorrectly interpreted as "executing a login"

mode x- where x=console is the console mode used to work with windowed applications (vi editor) and x=stream is the streaming mode used to work on the command line.

ntlm- enable NTLM authentication.

term x- type of emulated terminal. Where x is ansi, vt100, vt52, or vtnt.

To get a hint on how to cancel the installed parameters, use the command

Microsoft Telnet> unset?

bsasdel- symbol BackSpace will be sent as a character Delete

crlf- line feed mode; causes the CR character to be sent

delasbs- symbol Delete will be sent as a character Backspace

escape- the symbol for switching to telnet terminal mode and back is not set

localecho- disable local echo

logging- disable log recording. In the Russian-language version it is incorrectly interpreted as "disabling login"

ntlm- disable NTLM authentication.

Examples of commands in interactive mode:

open 192.168.0.1- connect to the Telnet server with an IP address 192.168.0.1

o zte-f660- connect to a Telnet server named zte-f660. Command abbreviation used o pen

set logfile C:\telnet.log- use as log file C:\telnet.log

set logging- record the current session to a log file.

display- display the parameters of the current session. Example of information displayed:

Mode switch symbol: "CTRL+]"

NTLM Authentication - Enabled

Local echo output - disabled

New Line Mode - Character ENTER will be shipped as CR&LF

Current mode: Streaming

TERMINAL MODE

Preferred ANSI Terminal Type

    In practice, the utility telnet.exe used as a diagnostic and debugging tool to connect not only to the Telnet server on TCP port 23, but also to any other TCP port, thereby allowing interaction with any command line-controlled application. So, for example, using the utility telnet you can connect to servers that support text (telnet-like) input of commands and data - SMTP, POP3, IMAP, etc. In addition, the utility can be used as a means of roughly checking the connectivity to any TCP port (checking whether a specific TCP port is listening).

telnet 192.168.1.1 8080- connect to host 192.168.1.1 on port 8080. In cases where the port is closed, the utility will report that connection is impossible. Moreover, to check the availability of a certain port, it is not even necessary that it is listened to by a service that supports text input, such as a VNC server. To disconnect from the remote server, you must enter the mode switching symbol (by default - CTRL+]).

The telnet.exe utility can be used, for example, to exchange with a mail server using the protocol POP3(Post Office Protocol ver. 3). This protocol is used by email client programs (Outlook, Outlook Express, The Bat, etc.) to receive email, stored in the user's mailbox. This is the simplest protocol based on text messaging. In order to study the interaction of the mail client with the mail server, you can implement a connection session using TELNET.

By default, the POP3 server listens for incoming connections via TCP on port 110 ("listens" on port tcp/110). Telnet command to connect to a server, for example pop.mail.ru

telnet pop.mail.ru 110

If the server is healthy, its invitation will appear in the telnet window

+OK mPOP POP3 v1.1

user [email protected]

After which, the server will prompt you to enter a password:

OK Password required for user [email protected]

You need to enter a password

pass VasinPass

The server will report the result of the password check:

You can request a list of letters with a directive list:

list

In response to this, the server will display a list and sizes of letters in the mailbox:

OK 10 messages (152527 octets)
1 48628       1 is the serial number, 48628 is the size
2 1829
3 2070
:

If necessary, you can view the headers of the letters. To do this, use the command top sequence number, space, number of lines from the message body

top 2 0

In response to this, you will see a letter header containing official information about the sender, date of sending, return address and some other data:

Received: from (HELO mx1.ks.pochta.ru) by node7-1.ks.pochta.ru with QIP.RU LMTP
for [email protected];
Fri, 08 Apr 2011 15:18:33 +0400
Received: from mx3.softkey.ru ()
: :

The directive is used to receive letters retr sequence number

retr 2 - receive a letter with sequence number 2

To delete a letter, use the directive dele sequence number For example, to remove the 2nd letter from the list received by the directive list:

If the deletion was successful, the server will display the following message:

OK message 2 deleted

Sometimes, the TELNET command can also be used to identify the service listening on the specified port, since many of them display either their banner or specific service information when connected. For example, the FTP server greeting: 220-FileZilla Server version 0.9.43 beta

220-written by Tim Kosse ( [email protected])

220 Please visit http://sourceforge.net/projects/filezilla/

And this is what the screen looks like when connecting to the RealVNC server:

RFB 003.008

Telnet is a network utility that allows you to connect to a remote port of any computer and establish an interactive communication channel, for example, to send commands or receive information. We can say that this is a universal browser in the terminal that can work with many network protocols.

This utility was very often used to remotely control a Linux computer, but then it was replaced by the secure SSH protocol. But telnet is still used, for example, for network testing, port checking, and also for communicating with various IoT devices and routers. In this article we will look at what telnet is, as well as how to use telnet to solve your problems.

What is Telnet?

As I said, this utility is designed to create an interactive connection between remote computers. It works using the TELNET protocol, but this protocol is supported by many services, so it can be used to manage them. The protocol is based on TCP, and allows you to send regular string commands to another device. It can be used not only for manual control but also for interaction between processes.

To work with this protocol we will use the telnet utility, it is very easy to use. Let's look at the telnet syntax:

$ telnet options host port

The host is the domain of the remote computer to connect to, and the port is the port on that computer. Now let's look at the main options:

  • -4 – force the use of ipv4 addresses;
  • -6 – force the use of ipv6 addresses;
  • -8 – use 8-bit encoding, for example, Unicode;
  • -E– disable support for Escape sequences;
  • -a– automatic login, takes the username from the USER environment variable;
  • -b– use a local socket;
  • -d– enable debugging mode;
  • -r– rlogin emulation mode;
  • -e– set the beginning character of the Escape sequence;
  • -l– user for authorization on the remote machine.

That's it for the telnet command to establish a connection. But connecting to a remote host is only half the battle. After establishing a connection, telnet can operate in two modes:

  • Line by line- This is the preferred mode, here the line of text is edited on the local computer and sent only when it is completely ready. Not all services always have this opportunity;
  • Character-by-character– all characters you type are sent to a remote server. It will be difficult to correct anything here if you make a mistake, because Backspace will also be sent as a symbol and a movement arrow too.

The use of telnet is to send special commands. Each service has its own commands, but the protocol has its own telnet commands that can be used in the telnet console.

  • CLOSE– close the connection to the server;
  • ENCRYPT– encrypt all transmitted data;
  • LOGOUT– exit and close the connection;
  • MODE– switch the mode, from lowercase to character or from character to lowercase;
  • STATUS– view connection status;
  • SEND– send one of the telnet special characters;
  • SET– set the parameter value;
  • OPEN– establish a connection via telnet with a remote host;
  • DISPLAY– display the special characters used;
  • SLC– change the special characters used.

We will not consider all the commands, since you are unlikely to need them, and if you do, you can easily find them in the official documentation.

How to use telnet?

Next we will look at how to use telnet to solve your problems. Usually, the utility is already installed on most systems, but if this is not the case, then you can install telnet from the official repositories, for example, in Ubuntu:

$ sudo apt install telnet


You don't have to use telnet for this; ping is available.

2. Port check

Using telnet we can check the availability of a port on a host, and this can already be very useful. To check the telnet port run:

$telnet localhost 123 $telnet localhost 22

$telnet localhost 123

$ telnet localhost 22


In the first case, we see that no one accepts the connection, but in the second, a message about a successful connection and a greeting from the SSH server are displayed.

3. Debugging

To enable debug mode and output more detailed information while running, use the -d option while connecting:

$ sudo telnet -d localhost 22

$ sudo telnet - d localhost 22

4. Telnet console

Using the telnet console too important point in the analysis of how to use telnet. In the main mode, you can execute commands on a remote server, but if you want to address the command specifically to telnet, for example, to configure its operation, you need to use a special character to open the console, usually the utility immediately tells you what this character is, for example, it is used by default “^[“:


To activate it, you need to press the key combination Ctrl+[, then you will enter the telnet input prompt.

To see all available commands, you can type ?. For example, you can view the connection status:

telnet>status

telnet > status


There are other interesting possibilities here. Such things can be done on any connection using the telnet utility.

5. View the telnet site

One common way to use telnet is to test a website from the console. Yes, you won’t get a beautiful web page, but you can manually collect requests and see all the data sent by the server.

$ telnet opennet.ru 80

$telnet opennet. ru 80


Then issue the command to the web server.

Telnet can be used as a command in the Windows operating system. In fact, this is not only an executable service, but also a network protocol or even firmware, which, using a text field, allows the user to “communicate” with a remote computer, sending the system a command to perform a particular action, as well as receiving a log of its execution.

The name of the protocol stands for Terminal network, which literally means terminal network.

What is Terminal network

Using the telnet command, despite its low functionality, you can perform quite a lot of tasks, such as:

  • checking the connection to the server using an open port;
  • connection to remote devices (modem, router or switch) to send a command (reboot, shutdown or receive logs);
  • updating the firmware of network equipment or mobile phone;
  • file transfer.

Many people believe that such a connection works, like most network services, on a client-server principle. However, this is not true. telnet is a completely two-way service with the same functionality and access levels.

Interestingly, the program itself includes a minimal set of functions, which contains only a connection option and an authentication process (verifying the authenticity of the username and password that is allowed access). All other options, both command and system, are called by the connected applications.

How to work with the shell?

To use the telnet command's functionality, you must use the command line. In the seventh Windows versions and above, the service is disabled by default and does not start automatically when the command is called. Therefore, you need to follow these steps to enable telnet:


How to manage the service?

Once you enter the Windows Terminal Management service, you need to know a few commands to be able to manage it. There are the following options for obtaining a list of control keys:


If you are familiar with the options, you can immediately connect to the desired resource with the required data. In this case, the server for the connection is “smatp.ya.ru” and the port is “25”.

Result:

The telnet command is very easy to use and quite convenient. However, the technology of its operation does not provide for safety at all. The shell runs under Windows in a completely unprotected mode and without encryption. Therefore, instead of this function, ssh has been used for quite some time.

According to the principle of organizing the connection, they are almost the same. But the ssh protocol was developed taking into account possible security technologies. In some cases more simple way the connection is quite sufficient, for example, when you need to connect to the equipment to load new firmware into it or restore the old one, as well as to change the system configuration.

If you use several protocols to connect at once, then it is faster, more convenient and safer to do this through special program, for example "Putty".

Not all computer users are aware of the presence of hidden services that allow various operations without using special software. In operating rooms Windows systems and Linux there is a Telnet service. This material will discuss in detail the purpose of the service, commands, capabilities and how to work with it correctly.

What is Telnet

Telnet is a means of communication that is established between terminal devices. An example of such a connection is quite simple: a personal computer and a server that supports a similar type of connection. Telnet is not any software, it is communication protocol. But it should be noted that there are some utilities that work via the “terminalnetwork” protocol.

In the recent past, Telnet was one of the main ways to connect to the network. Now the utility practically not used. Today, operating systems have more advanced protocols installed, excluding any additional actions from the user.

This communication protocol is used in some operations:

  • connection to a remote desktop;
  • examination ports for connectivity;
  • usage software that is only available on remote machines;
  • application system directories, which can only be opened using this type of protocol;
  • sending email without using additional software;
  • users using this protocol allows other users gain access to your personal computer.

Installation and launch

There is no need to download the utility; Telnet is built into Windows 7/8/10 by default.

Installation and startup instructions:

In order to start the client you need to open the command line:

We invite you to watch the video on installing Telnet in Windows:

Port check

Checking a network port to see if a personal computer can access it in Telnet:

  • in the window you need to enter the telnetip command;
  • what follows enterIP address computer, for example, 192.168.1.1. You can view the address in the settings of your network router;
  • At the end, enter the FTP port “21”. Thus the command will look like this: telnet 192.168.0.1 21;
  • after that it will appear error message if the port is unavailable or asking you to enter additional data if the port is open.

Telnet Commands

Utility commands are a way to interact with it. To display list of all commands, you must enter “help”. Next, we will look at the main commands in detail:

  • “open” - the request allows connect to a remote server;
  • "close" - process interruption connecting to a remote server;
  • "set" - setting server connection parameters;
  • "term" - the request is intended for terminal type indications;
  • "escape" - sets control character;
  • "mode" - choice operating mode;
  • "unset" - reset previously entered parameters;
  • "start" - launch servers;
  • "pause" - temporary stop server operation;
  • "continue" - continuation of work servers after a pause;
  • "stop" - complete work stoppage server.

Telnet on Linux

Like Windows, Telnet is built into operating system Linux. Previously it was used as standard protocol Telnet, now replaced by the more improved SSH. As with the previous OS, the utility in Linux is used to check ports, routers, etc.

Let's look at the main operating modes:

  • « line by line». This mode work is recommended. In this case, editing the request is carried out on the local PC and is sent to the server only when it is ready;
  • « character-by-character" Every character typed in the console window is sent to the remote server. You cannot edit the text here. When you delete a character using “Backspace”, it will also be sent to the server.

Basic commands in Linux:

  • “close” — interrupt the connection;
  • “encrypt” — enable encryption;
  • “logout”—turn off the utility and close the connection;
  • “mode” — selection of operating mode;
  • “status” — connection status;
  • “send” — sending a telnet request;
  • “set” — setting server parameters;
  • “open” — connection to a remote server;
  • “display” - display of special characters.
  • in the console window enter a request for server availability checks, for example, "telnet 192.168.1.243";
  • Next, let’s check access to the port by entering the request “telnet localhost 122” and “telnet localhost 21”. A message will appear on the console screen indicating whether any of the ports are accepting the connection;
  • example of remote control using telnet. To do this, enter the request “telnet localhost 23” in the main window. "23" is the default port. To produce remote control, you need to install “telnet-server” on your local computer. After this, a message will appear asking you to enter your login and password.

Disadvantages of Telnet

The main disadvantage of this protocol is the remote connection without using encryption. The only security point is the authorization of users in the telnet session. But nevertheless, the login and password are also transmitted in unencrypted form, so access to them can be obtained one way or another. It is strongly recommended not to transmit any important data over local networks.