Vous êtes sur la page 1sur 16

Telnet

REMOTE LOGIN
Users may want to run application programs at a remote site and create results that can be transferred to their local site. For example: Students may connect to their university computer Labs from their home to access application programs for doing homework assignments or projects. Best solution is a general purpose client server program that allows a user to access an application program on a remote computer. After logging on, a user can use services available on the remote computer and transfer the results back to the local computer. Typically Telnet uses TCP port 23.

TELNET
TELNET is an abbreviation for TErminaL NETwork. It is standard TCP/IP protocol for virtual terminal service as proposed by ISO. TELNET enables the establishment of connection to a remote system in such a way that, the local terminal appears to be a terminal at the remote system. TELNET is a general purpose Client-Server application program. Time Sharing Environment : It was designed at a time when most of the OSs, such as UNIX, were operating in timesharing environment. The interaction between the user and the computer occurs through a terminal, which is usually a combination of keyboard, monitor and mouse.

TELNET: LOGGING
Local Log-in: When a user logs into a local timesharing system, it is called as a local log-in. A user types at a terminal, running a terminal Emulator, the keystrokes are accepted by the terminal driver. The terminal driver passes the characters to the OS. Then the OS, in turn interprets the combination of characters and invokes the desired application program or utility.

TELNET: LOGGING
Remote Log-in : A user wants to access an application program located on a remote machine. Both, the TELNET Client and Server programs are used. The user sends a keystroke to a terminal driver, where the local OS accepts the characters but does not interpret them. The characters are sent to TELNET Client, which converts the characters to a universal character set called Network Virtual Terminal (NVT) characters and delivers them to the local TCP/IP stack. The text in NVT form, travels through the internet and arrives at the TCP/IP stack at the remote machine. Here the characters are delivered to the OS and passed to the TELNET server, which changes characters to the corresponding characters understandable by the remote computer.

TELNET: LOGGING

However, remote OS is designed to receive characters only from a terminal driver and not from a TELNET server. Hence, the OS uses a pseudo-terminal driver to receive the characters, which in turn emulates the characters coming from a terminal. The OS then passes the received characters to the appropriate application program.

NETWORK VIRTUAL TERMINAL (NVT)


We are dealing with heterogeneous systems and want to access any remote computer in the world. TELNET solves this problem by defining universal interface called as NVT character set. Via this interface, the client TELNET translates characters (Data/Commands) that come from local terminal into NVT form and delivers them to the network. The TELNET server translates Data and Commands from NVT form into the form acceptable by the remote computer. NVT uses 2 character sets one for Data and other for Control. Both are 8-bit. For Data: NVT uses 8-bit character set (7 out of which are same as ASCII) and highest order bit is 0. For Control: NVT uses 8-bit character set where the highest order bit is set to 1.

NETWORK VIRTUAL TERMINAL (NVT)

Data Character

Control Character

NVT Control Characters


Character EOF EOR SE NOP DM BRK IP AO AYT EC EL GA SB WILL WONT DO DONT IAC Decimal 236 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 Binary 11101100 11101111 11110000 11110001 11110010 11110011 11110100 11110101 11110110 11110111 11111000 11111001 11111010 11111011 11111100 11111101 11111110 11111111 Meaning End of file End of record Suboption end No operation Data mark Break Interrupt process Abort output Are you there? Erase character Erase line Go ahead Suboption begin Agreement to enable option Refusal to enable option Approval to option request Denial of option request Interpret (the next character) as control

Embedding
TELNET uses only one TCP/IP connection, the server uses well known port 23 and client uses an ephemeral port (short lived). The same connection is used for sending both data and control characters. TELNET embeds control characters in data stream and distinguishes data from control characters, by a special control character called Interpret As Control (IAC). For example: User wants Server to display a file file1 on remote server. cat file1 Suppose the filename has been mistyped as filea instead of file1, then the user uses the BackSpace ( ) key to correct this situation. cat filea<backspace>1 The Backspace character is translated into two remote characters (IAC , EC), which are embedded into the data and sent to the remote server as shown in the figure.

Options
TELNET lets the client-server negotiate options before or during the use of service. Options are extra features available to a user with more sophisticated terminal. Users with simpler terminals can use simpler features. Following table shows some common options.
Code 0 1 3 5 6 24 32 34 Option Binary Echo Suppress go ahead Status Timing mark Terminal type Terminal speed Line mode Meaning Interpret as 8-bit binary transmission. Echo the data received on one side to other. Suppress go ahead signals after data Request the status of TELNET. Define the timing marks. Set the terminal type. Set the terminal speed. Change to line mode.

Option Negotiation
To use any of the options mentioned in the previous table, first requires option negotiation between client and server. Four control characters are needed for this purpose.
Character Decimal Binary WILL WONT 251 252 11111011 11111100 Meaning 1. 2. 1. 2. 3. 1. 2. 1. 2. 3. Offering to enable. Accepting a request to enable. Rejecting a request to enable. Offering to disable. Accepting a request to disable. Approving an offer to enable. Requesting to enable. Disapproving an offer to enable. Approving an offer to disable. Requesting to disable.

DO DONT

253 254

11111101 11111110

Option Negotiation Example


The client wants the server to ECHO each character sent to the server. The request consists of 3 characters: IAC, DO and ECHO. The server informs the client by sending 3 character approval: IAC, WILL and ECHO.

Suboption Negotiation
Some options require additional information for example: To define the type or speed of a terminal, the negotiation includes a string or a number to define the type or speed. In either case, the 2 Suboption Characters indicated in following table, are needed for Suboption Negotiation.
Character SE SB Decimal 240 250 Binary 11110000 11111010 Meaning Suboption end Suboption begin

Suboption Negotiation Example


An example of Suboption negotiation: The client wants to negotiate the type of terminal.

Mode of Operation
Most TELNET implementations operate in 1 of 3 modes: The Default mode, Character Mode or Line mode. Default Mode: used if no other modes are invoked through option negotiation. - In this, the echoing is done by the client, user types a character and client echoes the character on the screen but does not send it until a whole line is completed. Character Mode : In this, each character typed is sent by client to the server. - The server normally echoes the character back to be displayed on client screen. - It also creates overhead for the network because 3 TCP segments must be sent for each character of data. Line Mode : A new mode called Line mode, Line editing (echoing, character erasing, line erasing and so on) is done by the client. The client then sends the whole line to the server.

Thank YOU