TELNET - University of Technology, Iraq

26
TELNET Lec.8

Transcript of TELNET - University of Technology, Iraq

TELNET

Lec.8

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-2

Some Standard TCP/IP Applications

From: “Computer Networking with Internet Protocols and Technology” by W. Stallings, Prentice Hall, 2004

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-3

TELNET (TErminal NETwork) is a general purpose client-server program that lets user access any application on a remote computer. It establishes a connection to a remote system, such that the local terminal appears to be a terminal at the remote system.

Telnet uses TCP through well known port 23

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-4

Local login

Combination of keyboard,monitor and mouse

Time sharing environment

Local OS accepts, then interprets the characters

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-5Remote login

Pseudoterminal

driver

OS accepts characters but doesn't interpret them. Instead it sends them to the TELNET client

TELNET client transforms the characters to NVT form(Network Virtual Terminal characters), and sends them to local TCP/IP stack.

Text travels in NVT form

Pseudoterminal “pretends” that the characters are coming from a terminal (the application is not aware that the inputs are coming from a remote terminal.)

TELNET server transforms the characters back to the form understandable by the OS

Heterogeneousplatforms

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-6

Network Virtual TerminalThe problem is that different OS interpret character combinations differently (e.g. DOS EOF = Ctrl-z , UNIX EOF = Ctrl-d)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-7

Format of data characters:

Network Virtual Terminal (cont.)

Format of data control characters:

7-bit US ASCII characters (printable or nonprintable)

NVT characters

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-8NVT Character Set (remote control characters)

Interpret next byte as command255IAC

Denial of option request254DON'T (option code)

Approval to option request253DO (option code)

Refusal to perform the option.252WON'T (option code)

Agreement to enable option251WILL (option code)

Indicates that what follows is sub negotiation of the indicated option.250SB

The GA signal249Go ahead

The function EL.248Erase Line

The function EC.247Erase character

The function AYT246Are You There

The function AO245Abort output

The function IP244Interrupt Process

NVT character BRK (indicates that the BREAK key is pressed1)243Break

The data stream portion of a Synch. (DM)242Data Mark

No operation241NOP

End of sub negotiation parameters.240SE

MEANINGCODENAME

Controlling the server

Option negotiation

1) The BRAK key is not encoded in ASCII character set. It has a local meaning.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-9EmbeddingTELNET uses TCP, consequently it is sending a stream of characters across the network. In order to use the same connection for data and control characters, the control characters have to be embedded into the stream. Each control sequence must be preceded by IAC(oxff). In other words, the format of TELNET commands is <IAC, xx> or <IAC, xx, yy>, where xx is one of the NVT characters, while yy is an option code (see later).

For example misspelled command “cat file1” would look like this:

Erase charactercommand

Interpret next byte as command

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-10

Terminals can have various degrees of sophistication. Options are used to enable extra terminal features.

TELNET OPTIONS

Request the status of TELNETStatus5

Change to line mode Line mode34

Set the terminal speedTerminal speed32

Set the terminal typeTerminal type24

Define the timing marksTiming mark6

Suppress go ahead signals after dataSuppress go ahead3

Echo the data receivedEcho1

Use 8-bit binary transmissionBinary0

MeaningOptionCode

For example

For example usage of EBCDIC instead of ASCII

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-11ASCII (American Standard Code for Information Interchange)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-12EBCDIC(Extended Binary Coded Decimal Interchange Code, IBM)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-13EBCDIC (Cont.)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-14

Options need to be negotiated. The negotiation can start from either the client or the server (symmetry).

Format of option negotiation command:

<IAC> <{WILL|WON’T|DO|DON’T}> <option code>

Option Negotiation

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-15

Offer to enable

Option Negotiation (cont.)

Request to enable

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-16

Offer to disable

Option Negotiation (cont.)

Request to disable

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-17

Echo option example

Option Negotiation (cont.)

When in echo mode, each character sent and echoed requires three TCP segments: the character, ACK+character echo, ACK of character echo.

Echo option allows the server to echo data on the client’s screen, i.e. every character sent by server will be echoed back to the client and then displayed. In this case the client’s terminal won’t echo the characters as typed by the user, but will wait for the echo from the server.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-18Suboption negotiation

Some options require additional piece of information. For example terminal type or speed need an additional number, terminal type or terminal speed.

End of suboption

Beginning of suboption

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-19

Controlling the Server

Characters used to control the server from the client:

IP, AO, AYT, EC, EL

Example of interrupting an application:

Like Ctrl-c has been typed from this terminal

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-20

Out-of-band signalingIn special situation the control characters must be sent out of order to the server.

Example: Remote application enters an infinite loop. TCP at the server side has full buffer and has sent to receiver the zero window size (no more traffic accepted). Therefore an urgent segment has to be sent in order to override the regular flow-control mechanism (TCP must accept urgent segments).

Switch the receiving TCP from urgent to normal mode

TCP segment header has URG flag set. The urgent pointer points to here.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-21Escape Character

If we want that a character be interpreted by the client instead of the server, we have to use the escape character ( Ctrl-] ). This means that the command is meant for the client

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-22MODE OF OPERATION

TELNET operates in one of the following modes:

Default mode

Character mode

Line mode

Echoing done by the client.Characters sent after the whole line is completed. Client waits for GA from the server before accepts the new line from the user.Half-duplex operation(obsolete mode)

Line editing (echoing, character erasing, line erasing) is done by the client. Completed line is then sent to the server. Full-duplex, no GA command waited from the server.

Characters echoed by the server. Delays possible (satellite). Increase traffic (3 segments sent for each character).

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-23Example of default mode

Wait for GA

ACKs are not shown

in this figure

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-24Example of character mode

Client switches tocharacter mode

Client is in default mode

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-25USER INTERFACEIn order to be user friendly, TELNET has a command-line user interface

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

19-26