Network Daemons  «Prev 

Telnet Client Servers

We have already seen telnet at work several times. Telnet clients and servers are standard equipment on UNIX machines, and telnet makes working on a remote machine easy. One less well known feature of telnet clients is that they may be used to contact services other than telnet servers; thus, telnet may be used to “talk” to many different types of servers. We will illustrate this idea later.
The well-known port number for telnet is 23.

The Telnet protocol:

The Telnet client program performs two important functions
  1. interacting with the user terminal on the local host and
  2. exchanging messages with the Telnet server.
The client connects to port 23 on the remote machine, which is the port number reserved for Telnet servers. The TCP connection persists for the duration of the login session. The client and the server maintain the connection, even when the user interrupts the transfer of data, for example by hitting cntl-C. Since Telnet is designed to work over two hosts on different platforms, the protocol assumes that the two hosts run a (NVT)Network Virtual Terminal . The TCP connection is set up across these two NVT terminals. The NVT is a very simple character device with a keyboard and a printer where data typed by the user on the keyboard is translated by the client software into NVT format and sent via its NVT terminal to the server, and data received in NVT format from the server is translated by the client into the local machine format and output to the printer. The NVT terminals on the two hosts exchange data in the 7-bit U.S. variant of the ASCII format, with each character sent as an octet with the first bit set to 2 character sequence CR (carriage return) followed by an LF (linefeed). Each Telnet control message starts with the special octet (Interpret as Command (IAC) octet of all 1s) to ensure that the recipient interprets the subsequent octets as a command. Otherwise, each octet is interpreted as data (e.g., a user keystroke). Sending control messages on the same connection as the data is referred to as inband signaling. The initial control messages between the client and the server are used to exchange information about their capabilities (Telnet option negotiation). For example, the client may indicate the type and speed of its terminal, and whether data is to be sent one character or one line at atime. After the capabilities exchange, the server instructs the client to sen da login identiier and password. Once the authentication completes, the user interacts directly with the remote machine. The client application relays user keystrokes to the server, and the server relays the output back to the client, using inband signaling, with the interpretation that commands follow the IAC octet of all ones.

TCP/IP Illustration

Remote Login Telnet

Telnet cannot rely on the conventional data stream alone to carry such control sequences between client and server. Consider the an interaction of the user with the remote server optlab.disperssednet.com. The user is writing into a file on this remote machine, and suppose the TCP connection set up on the remote server (during the Telnet session) is misbehaving. As a result, none of the user's subsequent keystrokes are read, and echoed on the local screen. Now, Kartik wants to terminate writing into this file. He does this by typing cntl-C on his keyboard, which relays the control sequence IAC IP to the remote machine. Suppose also that receiving hosts' TCP buyers are full, and it cannot receive any further information from the sender (it discloses this over the TCP connection by advertising a window size of zero). So to ensure that the user's cntl-C command gets through, Telnet uses an out of band signal. So, in this case, the Telnet client sets a TCP segment with the URG tag bit set to 1. This TCP segment bypasses low control and reaches the server immediately. The server discards all data until it sends the control sequence cntl-C following the IAC octet, and the user's session with the file on the remote machine is terminated. However, the Telnet session on the server is not terminated, and the server is back to its normal operation.

Network Protocol used on Internet

Telnet is a network protocol used on the Internet or local area networks to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is interspersed in-band with Telnet control information in an 8-bit byte oriented data connection over the Transmission Control Protocol (TCP).
Telnet was developed in 1969 beginning with RFC 15, extended in RFC 854, and standardized as Internet Engineering Task Force (IETF) Internet Standard STD 8, one of the first Internet standards. Historically, Telnet provided access to a command-line interface (usually, of an operating system) on a remote host. Most network equipment and operating systems with a TCP/IP stack support a Telnet service for remote configuration (including systems based on Windows NT). Because of security issues with Telnet, its use for this purpose has waned in favor of SSH.
The term telnet may also refer to the software that implements the client part of the protocol.
Telnet client applications are available for virtually all computer platforms. Telnet is also used as a verb. To telnet means to establish a connection with the Telnet protocol, either with command line client or with a programmatic interface. For example, a common directive might be: "To change your password, telnet to the server, log in and run the passwd command." Most often, a user will be telnetting to a Unix-like server system or a network device (such as a router) and obtain a login prompt to a command line text interface or a character-based full-screen manager.