How to connect using telnet. 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 or modern authentication tools. 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. The current Telnet protocol standard is described in RFC 854.

In modern OS Windows family, 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 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 host name 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 - streaming mode used for working 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 communicate with mail server according to 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 mailbox user. This is the simplest protocol based on the exchange text messages. In order to study the interaction mail client with a 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 the header of the letter containing service 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

Any System Administrator enjoys system utility built into Windows – telnet.exe. This program allows you to connect to local and remote servers at the address and port specified in the launch parameters. A useful thing for checking the possibility of connecting to the server via port and executing commands. Also, this utility is often indicated in help various programs and services. However, it often turns out that telnet is not installed by default.

How to install telnet.exe via command line

The easiest way is with Administrator rights and execute the following command:

dism /online /Enable-Feature /FeatureName:TelnetClient

Press “Enter” and wait a little, the message “Operation completed successfully” should appear. This completes the installation.

Installing the Telnet client on Windows components

The second method is for those who do not want to use the command line or the first method did not work. Let's go to “Control Panel -> Programs and Features -> Turn Windows features on or off” and check the box for “Telnet Client”.

Installation may be required Windows disk. If the list of components is empty, then you need to correct one value in Windows registry. To do this, launch the registry editor with the command:

regedit

and follow the path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows

In the “CSDVersion” parameter you need to replace the value with 100 or 0 . Reboot.

Windows developers prudently built into the operating system a special telnet tool that allows you to manage remote servers from the command line. Up until Vista, it came in an activated state and did not require any additional settings, however, with the release of 7 from a similar all inclusive Microsoft company decided to refuse. As a result, each user has to configure Telnet in Windows 7 independently, which, however, is not as difficult as it seems at first glance.

Step #1: Connection

It is worth noting that in Windows 7 the telnet client program can be enabled 2 different ways: Using the command line or through the Windows Components utility. They are quite easy to work with, so no problems should arise.

In particular, to enable the telnet client through “Windows Components”, go to the “Start” menu, open “Control Panel”, click the “Programs and Features” tab and click the “Turn on or off...” option in the window that appears on the left:

Next, in the displayed list of components installed in Windows 7, find the “Telnet Client” and “Telnet Server” folders and check the boxes next to them. Then click OK and wait for the tool installation to complete:

It is equally easy to enable the utility using the command line. In this case, all we need is: open the “Command Prompt” in any known way (for example, by entering cmd in the search field of the “Search” menu and clicking on the program shortcut that appears), enter dism command/online /Enable-Feature /FeatureName:TelnetClient and press Enter:

As a result of such simple manipulations, the component will automatically be installed on your computer in Windows 7 and will be ready for use.

Step #2: Launch the utility

After the client installation is complete, all that remains is to launch it in Windows 7. To do this, you can use one of the following methods:

One way or another, the Microsoft Telnet client program should start as a result. To work in it, you can use, in particular, the following commands:

  • close – close the connection to the site;
  • display – show the parameters of the operation being performed;
  • quit – exit the program;
  • set – assign parameters;
  • send – send lines to the server;
  • status – display information about the current connection status;
  • unset – cancel the entered parameters;
  • open server address [port] – establish a connection to the selected site.
  • help – show help.

Usage telnet commands provides the ability to establish a communication channel with computers at a distance.

And the utility itself is almost a kind of browser emulator in the terminal, supporting several network protocols.

Previously, telnet was often used to manage PCs running the Linux operating system.

And now, using the same utility, they test the network, check ports, manage routers and other IoT devices.

Content:

Features of the utility

Although main task telnet is to create a connection between distant friend from a friend PC using the same protocol, using the utility you can manage other services.

For example, access POP3, HTTP, IRC or SMTP.

After all, these and some other services operate on the basis of transport TCP protocol, to work with which you can use a telnet client.

Telnet command syntax when connecting to to a remote computer looks like this: $ telnet (options) (host) (port).

The host is the domain of the computer to which the connection is made. Port – port on the computer from which access is being made. And the options could be as follows:

  • -4 and -6 provide forced use ipv4 and ipv6 addresses, respectively;
  • -8 makes it possible to use 8-bit encoding;
  • -E disables support for escape sequences;
  • -a automatically registers the user on the remote system;
  • -d enables debugging mode;
  • -p enables rlogin emulation;
  • -e sets the initial escape character;
  • -l authorizes the user in the system.

After the connection with the remote host is established telnet utility starts working in one of two modes – line-by-line or character-by-character.

The first option is the most preferable due to the ability to edit the text directly and send it only after the user has completely typed in all the information.

The disadvantage of this line-by-line mode is the lack of support for it by some services. While character-by-character can be used in any case.

However, when using it, all information is sent instantly.

And if the user makes a mistake, it will be impossible to correct it - after all, even spaces and Backspace are sent to the server in the form of characters.

You should know: When using the telnet protocol, there is no possibility of encrypting information transfer. All data is sent directly and can be intercepted by an unauthorized user. And it is not recommended to transmit them in this way - it is advisable to use the secure Secure Shell network protocol for this.

Basic commands

When working with the telnet protocol, the user enters the appropriate commands into the console. The most popular include the following:

  • OPEN (PC name) (port). Allows you to communicate with the computer whose name is specified in the command. If you do not specify a port, the utility will try to use the default number. Sometimes it is indicated instead of the PC name;
  • DISPLAY (argument). Command to display a full or partial set of telnet utility parameters;
  • CLOSE. Designed to close the telnet session and return the system to command mode;
  • QUIT. Command to end all open connections and exit telnet;

Rice. 2. Using the Quit command in the MS Telnet client.

  • MODE TYPE. Used to control one of two input mode options (character-by-character or line-by-line). In this case, a request is sent to the remote computer to switch to a certain mode, and, if it is supported by the service, the corresponding switching is provided;
  • STATUS. A command that displays the current utility status, name and exchange mode;
  • ? (team). Reports information about the corresponding command sequence. It is needed in cases where the user is going to use a command that is unfamiliar to him;
  • ! (team). Executes a command sequence on the local system;
  • SEND ARGUMENTS. Sends character arguments to the remote PC;
  • ESCAPE. Sends one of the escape characters such as comma, bracket, or caret (^);
  • SYNCH. Serves to send a synch sequence that allows you to cancel all commands typed but not yet sent. Used only in line-by-line mode;
  • BRK. Sending a break sequence when the Break key is pressed.

All of these commands are basic, although their total number is much larger. However, due to the rather rare use of this utility, the easiest way to find a complete list of them is by entering HELP in the terminal.

Ah, after displaying full list, get help information about each command sequence using the "?" command.

Although, for example, for a telnet client on Windows, the list may be shortened.

Telnet client built into Microsoft Windows Server 2008 and Windows 7, however, it is disabled by default. Those. when you first run the command from the command line telnet, the system will respond that such a command was not found. The convenience of the Telnet protocol is that it can be used to access various operating systems (Linux, Unix or Windows) and devices (modems, switches, routers). However, recently Microsoft experts have stopped favoring telnet; now if you need access to the command line of another computer running Windows, they recommend using Windows features Remote Desktop, it's much easier. On Windows Server 2008 it is also possible to use Remote function Shell (WinRS), which is considered more secure than telnet. By the way, in many cases I prefer to use telnet for remote control systems.

As noted above, Telnet client counts additional function in both operating systems, and can be easily installed:

On Windows Server 2008, you can install the Telnet client using mastersAddFeaturesWizard in Server Manager. On Windows 7, you can install the Telnet client using the option TurnWindowsFeaturesOnorOff on the control panel.

To install the Telnet client on Windows Server 2008, follow these steps:


5. On the Confirmation page, click Install.

6. After installation is complete, click on « Close«.

By the way, you can install the telnet client from the command line; to do this, you need to type the following command:

Servermanagercmd –I Telnet-Client

To install the Telnet client on Windows 7, follow these steps.