How to set up smartphones and PCs. Informational portal
  • home
  • Security
  • The telnet program is for. Methods for connecting to remote devices using the telnet command

The telnet program is for. Methods for connecting to remote devices using the telnet command

Suboption discussion

Some options require more information than just "enable" or "disable" (disable). For example, setting the terminal type: in order for the client to identify the terminal type, it must send ASCII string. To handle these options, suboptions discussion applies.

RFC 1091 defines the sub-options that need to be negotiated to set the terminal type. First, one side (usually the client) asks to enable the option by sending a 3-byte sequence

where 24 (decimal) is the terminal type option identifier. If the recipient (server) says YES, his response will look like

The server then sends

asking about the type of client terminal. SB is a command that reports the start of suboptions (suboption-begin). The next byte of 24 indicates that this is a sub-option of the terminal type. (SB always follows the number of the option to which the sub-options refer.) The next byte, equal to 1, means "send your terminal type". The suboption-end command must again be preceded by IAC, as well as before the SB command. The client responds with a command

in case its terminal type is ibmpc. The fourth byte equal to 0 means "I have the following type of terminal". The ("official" list of acceptable terminal types is in the Assigned Numbers RFC, but for Unix systems any type of terminal supported by the server is acceptable. These are usually terminals supported by the termcap or terminfo bases.) Terminal types specified in Telnet suboptions are written capital letters and are usually converted to small letters already by the server.

Telnet commands allow you to contact remote computer using the Telnet protocol. You can issue the telnet command without parameters to enter the Telnet context indicated on the Telnet command line (Microsoft Telnet>). At the Telnet command prompt, use Telnet commands to manage the computer that is running the Telnet client.

The Telnet client command line accepts the following commands.

Team Description
open Syntax: open hostname. Used to establish a connection with a host via the Telnet protocol
close The close command is used to close existing connection via Telnet protocol
display The display command is used to view the current settings of the Telnet client
send send command used to send commands to the Telnet server. The following commands are supported: ao Cancels the input command ayt Are you there? esc Sends the current control character ip Aborts the processing command synch Performs a Telnet synchronization operation brk Sends a break signal Any other commands other than the above are sent to the Telnet server as a string. For example, the sendabcd command will send the string abcd to this server, which will display the string in the Telnet session window
quit The quit command is used to exit the Telnet client
set The set command with one of the following arguments is used to configure the Telnet client in the current session. bsasdel Designates last character deletion as deletion codeset parameter Parameter available if set Japanese language. Used to set the code page in the parameter key, which can take one of the following values:
  • ShiftJIS
  • Japanese EUC
  • JIS Kanji
  • JIS Kanji (78)
  • DEC Kanji
  • NEC Kanji
You must assign the same code page on the remote computer. By default, the Telnet client uses bitmap fonts. Before you can access a remote computer that uses one of these code pages, you must configure the Telnet client to work with TrueType fonts to ensure correct display of crlf characters New linear mode, which defines the ENTER key as 0x0D, 0x0A delasbs Assigns delasbs to delete the last escape character symbol Switch from Telnet session mode to Telnet command mode. To return to session mode in command mode, press ENTER localecho Enables local display of commands logfile name Specifies the name of the file to which the Telnet log for this session is written. If the file path is not specified, it is created in current folder. Specifying a log file enables its logging logging Enables logging for this session mode (console | stream) Mode of operation ntlm Enables NTLM authentication term (ansi | vt100 | vt52 | vtnt) What type of terminal should the Telnet client emulate ? Displays help information for set commands
unset The unset command is used to disable options previously set with the set command
status The status command allows you to determine whether the computer running the Telnet client is connected
? or help Displays help information


PROTECTION QUESTIONS:

1. The principles underlying the interaction about the Telnet protocol (NVT, contractual options, symmetry)

2. How data representation form is negotiated in Unix systems

3. NVT (basic functions as defined in Telnet, buffered or unbuffered

4. Terminal management commands. A brief description of.

5. Synchronization in Telnet.

6. Command format. Example

7. Program-server (telnetd). Operation principle.

8. Client program (telnet). Modes of operation. Basic commands command line mode.

9. Explain with your own example the principle of contractual options/sub-options.

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 that supports several network protocols.

In the past, telnet was often used to control a Linux PC. And now, with the help of the same utility, they test the network, check ports, manage routers and other IoT devices.

Utility features

Despite the fact that main task telnet is to create a connection between distant friend from a PC friend using the protocol of the same name, with the help of 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, for which you can use the telnet client. Although it is not always recommended to do this due to a number of undesirable effects - for example, the insecurity of data transmission or their distortion.

Rice. 1. Enable the telnet utility in Windows.

The syntax for telnet commands when connecting to a remote computer is as follows: $ telnet (options) (host) (port).

The host is the domain of the computer to which you are connecting. Port - the port on the computer from which the access is being made. And the options can be:

  • -4 and -6 provide forced use ipv4 and ipv6 addresses, respectively;
  • -8 enables the use of 8-bit encoding;
  • -E disables support for escape sequences;
  • -a automatically logs the user into the remote system;
  • -d turns on debug mode;
  • -p enables rlogin emulations;
  • -e sets the initial control character;
  • -l authorizes the user in the system.

After a connection to a remote host is established, the telnet utility starts in one of two modes - line-by-line or character-by-character.

The first option is the most preferred because of the ability to edit text directly on local PC and sending it only after the user has fully typed all the information.

The disadvantage of this line-by-line mode is the lack of support for some services. While per-character can be applied in any case. However, when using it, all information is sent to remote PC 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 as characters.

Basic commands

Working with the telnet protocol, the user enters the appropriate commands in 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 don't specify a port, the utility will try to use the default number. Sometimes, instead of the PC name, it is indicated IP address;
  • DISPLAY (argument). Command to display full or partial set of telnet utility options;
  • CLOSE. Designed to close the telnet session and return the system to command mode;
  • QUIT. command to complete all open connections and output from telnet;


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

  • MODE TYPE. Used to control one of two input mode options (character or line). This sends a request to the remote computer to go to certain mode, and if supported by the service, appropriate switching is provided;
  • STATUS. Command that displays the current status of the utility, name remote PC and exchange mode;
  • ? (team). Reports information about the corresponding command sequence. It is needed in cases where the user is going to use an unfamiliar command;
  • ! (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 a comma, parenthesis, or the caret character (^);
  • SYNCH. Serves to send a synch sequence that allows you to cancel all typed, but not yet sent commands. Only used in line mode;
  • B.R.K. 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, a complete list of them is easiest to find by entering HELP in the terminal.

And after displaying complete list, get help information about each command sequence using the "?" command. Although, for example, for a telnet client in Windows List may be shortened.


Rice. 3. List of telnet commands in the Microsoft client.

findings

The need to use the commands of the telnet utility is now becoming less and less common. However, it is worth knowing some of them at least to get access to network equipment with their help. For example, to switches, routers or even to webcams.

Thus, even this relatively outdated and insecure protocol can be useful for ordinary users and especially for professionals. True, to work with it, you will need not only knowledge of the list of commands, but also some experience in working with command line.

telnet- This network utility which allows you to connect with remote port any computer and install interactive channel communication, for example, to send commands or receive information. It can be said that this universal browser in a 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, to test the network, check ports, and also to interact with various IoT devices and routers. In this article, we will look at what telnet is and how to use telnet to accomplish your tasks.

What is Telnet?

As I said, this utility is designed to create an interactive connection between remote computers. It works over the TELNET protocol, but this protocol is supported by many services, so it can be used to control them. The protocol works for TCP based, and allows you to send normal 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 simple to use. let's consider telnet syntax:

$ telnet options host port

Host is the domain of the remote computer to connect to, and 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;
  • -aautomatic login, takes the username from the USER environment variable;
  • -b– use local socket;
  • -d– enable debug mode;
  • -R– rlogin emulation mode;
  • -e– set the character for the beginning of the Escape sequence;
  • -l– user for authorization on a remote machine.

That's all for the telnet command to establish a connection. But connecting to a remote host is only half the battle. After installation telnet connections can work in two modes:

  • Line by line is the preferred mode, here the line of text is edited to local computer and is sent only when it is completely ready. Not always and not all services have such an opportunity;
  • per character– all characters you type are sent to the remote server. It will be difficult to fix 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 teams. 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 with the server;
  • ENCRYPT– encrypt all transmitted data;
  • LOGOUT– exit and close the connection;
  • MODE– switch the mode, from lower case to character or from character to lower case;
  • STATUS– view connection status;
  • SEND- send one of special characters telnet;
  • SET– set the parameter value;
  • OPEN– establish a connection via telnet with a remote host;
  • DISPLAY– display used special characters;
  • SLC– change the used special characters.

We will not cover 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


To do this, it is not necessary to use telnet, there is ping.

2. Port check

C telnet we can check the availability of the port on the node, and this can already be very useful. To check 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, while in the second, a message is displayed about the successful connection and the SSH server greeting.

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 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 must use a special character to open the console, usually the utility immediately tells you what kind of character it is, for example, the default is "^[":


To activate it, you need to press the combination Ctrl keys+[, then you will be prompted for telnet.

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

telnet>status

telnet > status


There are others here interesting opportunities. These things can be done on any connection using the telnet utility.

5. View telnet site

One of the common ways telnet usage- This is testing the site from the console. Yes, you will not get a beautiful web page, but you can manually collect requests and see all the data transmitted by the server.

$ telnet opennet.ru 80

$ telnet opennet . en 80


Then issue a command to the web server.

Few computer users today are aware of the existence of various special protocols on a computer that allow, without using GUI and third party programs fulfill various activities. Therefore, the desire to learn how to use the TELNET service immediately arises when they learn about the corresponding protocol.

Next, a little theory will be presented about what TELNET is, for which many people strive to master it: the capabilities of the service, as well as a list of basic commands that allow these capabilities to be implemented on Windows.

TELNET is a means of communication that establishes a transport connection between terminal devices, clients, that is, your computer, and someone else's machine, server, that supports this connection standard. This is not a special program, but only network protocol, but also the word TELNET (terminalnetwork) refers to various utilities that also use this protocol. Today, Telnet is present almost everywhere, all operating systems, one way or another, use it, in

TELNET implements a text interface that is different from the usual user graphic themes that all commands must be entered manually.

What does all this give us?

Previously, this service was one of the few ways to connect to the network, but over time it has lost its relevance. Today there are much more convenient programs, which do all the work for the user, and do not force him to memorize various commands in order to perform the simplest steps. However, some things can be done with Telnet even now.

Network connections

With Telnet you can:

  • connect to remote computers;
  • check the port for access;
  • use applications that are only available on remote machines;
  • use various directories that can only be accessed in this way;
  • to send emails without use special programs(clients);
  • understand the essence of the work of many protocols used today, and derive some benefit from this;
  • provide other users with access to data located on your computer.

Starting to use

launch

Running TELNET on Windows 7 and on any other Windows is quite simple. To do this, you first need the client, if it is not already installed:

  • Go to Control Panel.

  • Select "Programs".
  • Select the "Turn Windows features on or off" tab.

  • Find the Telnet client and put a marker in front of it if it is not already installed.

Then click "OK" and wait a minute while the client is installed.

The launch of the terminal is carried out in Windows through the command line, if you do not have any installed special utilities to work with Telnet. But since you are reading this article, it means that you are just starting to get acquainted with this topic, and for a start it would be nice to learn the basics of command line management.

  1. Run command prompt as administrator.
  2. Enter "telnet".

The command line reloads, and now the TELNET command line will open, in which we will work.

Checking the port

One of the simplest things to do in TELNET is to check the port. You can check the port to see if it can be accessed from your computer. To do this, do the following:

In the command line opened by the method above, enter: telnetip address port number

For example, if your IP address is 192.168.0.1 and port number is 21 ( FTP port), then enter:

telnet 192.168.0.1 21

If the command gives an error message, then the port is not available. If appears empty window or a request to enter additional data, then the port is open. For Windows, this way to check the port can be quite convenient.

Teams

TELNET commands form the basis of using the terminal. With their help, you can control a computer that uses this protocol, if access is allowed for you, as well as perform various other actions. As mentioned above, on Windows they are entered at the command line of the Telnet application.

In order to see the main list of commands, enter in the line help and press "Enter". Basic commands:

  1. open- connection to a remote server. You must enter this command along with the managed server name and port number, for example: open redmond 44. If parameters are not specified, then local server and default port.
  2. close- disconnection from remote server. Similar parameters are used.
  3. set- remote server setting, used with the name of the managed server. Together with set the following commands are used:
    1. - is used to specify a terminal of the specified type.
    2. - sets the control character.
    3. - sets the mode of operation.
  4. Unset [option]- disables the previously set parameter.
  5. Start- starts the Telnet server.
  6. Pause- Pauses the server.
  7. Continue- resumes work.
  8. Stop- stops the server.

TELNET is one of the oldest protocols, but it is still used today. This means that you can start using it for your own purposes. To do this, you just need to learn the syntax and list of commands and start practicing. You can learn a lot of new things, and at the same time start looking at the Internet and at the previously familiar online activities in a completely different way.

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

The name of the protocol is deciphered as 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);
  • firmware update (firmware) network equipment or mobile phone;
  • file transfer.

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

Interestingly, the program itself includes minimum set functions, which contains only the connection option and the authentication process (authenticating the username and password that is allowed access). All other options, both command and system, are called by plug-in applications.

How to work with shell?

To use the functions of the telnet command, you need to use the command line. In the seventh version, it is disabled 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?

After you enter the management service Windows terminal, you need to know a few commands to be able to control. 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 right resource with the required information. In this case, the connection server is "smatp.ya.ru" and the port is "25".

Outcome:

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

By the principle of organizing the connection, they are almost the same. But ssh protocol was developed taking into account possible technologies protection. In some cases, more easy way connection is enough, for example, when you need to connect to equipment in order to download new firmware or restore the old one, as well as to change the system configuration.

Top Related Articles