Скачать презентацию The TELNET Protocol Mozafar Bag Mohammadi 1 Скачать презентацию The TELNET Protocol Mozafar Bag Mohammadi 1

a9b2df75a2b3230cc5b110f9deed2aa1.ppt

  • Количество слайдов: 26

The TELNET Protocol Mozafar Bag Mohammadi 1 The TELNET Protocol Mozafar Bag Mohammadi 1

Telnet l l l Telnet is generally considered the first network application. (late 1960 Telnet l l l Telnet is generally considered the first network application. (late 1960 s) Uses a client/server model to define a standard way in which to interact with a remote system. The telnet protocol is the basis for many protocols l FTP, HTTP, SMTP, NTTP just to name a few. l They don’t open a telnet connection, just use the protocol. 2

TELNET vs. telnet l TELNET is a protocol that provides “a general, bi-directional, eight-bit TELNET vs. telnet l TELNET is a protocol that provides “a general, bi-directional, eight-bit byte oriented communications facility”. l telnet is a program that supports the TELNET protocol over TCP. 3

The TELNET Protocol l l TCP connection data and control over the same connection. The TELNET Protocol l l TCP connection data and control over the same connection. Network Virtual Terminal negotiated options 4

Network Virtual Terminal l All communications uses a standard terminal called NVT l l Network Virtual Terminal l All communications uses a standard terminal called NVT l l The client takes input, translates into NVT sends it to the server, which translates to the representation that the computer uses. Special Telnet commands are interspersed with the data to perform the functions needed to for the operation of the protocol 5

Network Virtual Terminal Server Process NVT TCP 6 Network Virtual Terminal Server Process NVT TCP 6

Telnet 7 Telnet 7

NVT ASCII Control Codes l Three mandatory codes l 0, Null l l 10, NVT ASCII Control Codes l Three mandatory codes l 0, Null l l 10, Line Feed l l No operation, no effect on output Moves printer to the next line, keep same print position 13, Carriage Return l Moves the printer to the left margin of the current line 8

NVT ASCII Control Codes(2) l Optional Codes l l 7, Bell 8, Back Space NVT ASCII Control Codes(2) l Optional Codes l l 7, Bell 8, Back Space l l l 9, Horizontal tab 11, Vertical Tab l l Move the print position one character to the left devices negotiate to agree on tab stops 12, Form Feed l next page or clear the screen and put cursor at the top 9

NVT ASCII Control Codes(3) l End of line marker l l Since different computers NVT ASCII Control Codes(3) l End of line marker l l Since different computers use different standards for the end of line marker, CR+LF is defined as the end of line marker. 10

Negotiated Options l l l All NVTs support a minimal set of capabilities. Some Negotiated Options l l l All NVTs support a minimal set of capabilities. Some terminals have more capabilities than the minimal set. The 2 endpoints negotiate a set of mutually acceptable options (character set, echo mode, etc). 11

Negotiated Options l l The protocol for requesting optional features is well defined and Negotiated Options l l The protocol for requesting optional features is well defined and includes rules for eliminating possible negotiation “loops”. The set of options is not part of the TELNET protocol, so that new terminal features can be incorporated without changing the TELNET protocol. 12

Option examples l Line mode vs. character mode l echo modes l character set Option examples l Line mode vs. character mode l echo modes l character set (EBCDIC vs. ASCII) 13

Control Functions l TELNET includes support for a series of control functions commonly supported Control Functions l TELNET includes support for a series of control functions commonly supported by servers. l This provides a uniform mechanism for communication of (the supported) control functions. 14

Control Functions l Interrupt Process (IP) l l Abort Output (AO) l l suspend/abort Control Functions l Interrupt Process (IP) l l Abort Output (AO) l l suspend/abort process can complete, but send no more output to user’s terminal. Are You There (AYT) l check to see if system is still running. 15

More Control Functions l Erase Character (EC) l l l delete last character sent More Control Functions l Erase Character (EC) l l l delete last character sent typically used to edit keyboard input. Erase Line (EL) l delete all input in current line. 16

Command Structure l l All TELNET commands and data flow through the same TCP Command Structure l l All TELNET commands and data flow through the same TCP connection. Commands start with a special character called the “Interpret as Command” escape character (IAC). The IAC code is 255. If a 255 is sent as data - it must be followed by another 255. 17

Looking for Commands l l l Each receiver must look at each byte that Looking for Commands l l l Each receiver must look at each byte that arrives and look for IAC. If IAC is found and the next byte is IAC - a single byte is presented to the application/terminal (a 255). If IAC is followed by any other code - the TELNET layer interprets this as a command. 18

commands l WILL option (to Enable an option) l Response is either l l commands l WILL option (to Enable an option) l Response is either l l l DO option, indicate agreement and enable option DONT option, initiator must not use the option. WONT option (to disable option) l Response must be l DONT option, option is disabled. 19

Command Codes l l l IP AO AYT EC EL 243 244 245 246 Command Codes l l l IP AO AYT EC EL 243 244 245 246 247 WILL n WON’T n DON’T n IAC n 251 252 253 254 255 20

Telnet Options l When a option needs more parameters l l Example: negotiate the Telnet Options l When a option needs more parameters l l Example: negotiate the terminal type l l l Use SB (subnegotiation) and SE (end subnegotiation )command (IAC is interpret as command) IAC WILL Terminal-type IAC DO Terminal-type IAC SB terminal-type SEND IAC SE IAC SB TERINAL-TYPE IS IAC SE 21

Playing with TELNET l l You can use the telnet program to play with Playing with TELNET l l You can use the telnet program to play with the TELNET protocol. telnet is a generic TCP client. l l l Sends whatever you type to the TCP socket. Prints whatever comes back through the TCP socket. Useful for testing TCP servers (ASCII based protocols). 22

Some TCP Servers you can play with l Many Unix systems have these servers Some TCP Servers you can play with l Many Unix systems have these servers running (by default): l l echo discard daytime chargen port 7 port 9 port 13 port 19 23

telnet hostname port > telnet rcs. rpi. edu 7 Trying 128. 113. 33. . telnet hostname port > telnet rcs. rpi. edu 7 Trying 128. 113. 33. . . Connected to cortez. sss. rpi. edu (128. 113. 33). Escape character is '^]'. Hi dave stop it ^] telnet> quit Connection closed. 24

telnet vs. TCP l Not all TCP servers talk TELNET (most don't) l You telnet vs. TCP l Not all TCP servers talk TELNET (most don't) l You can use the telnet program to play with these servers, but the fancy commands won't do anything. l type ^], then "help" for a list of fancy TELNET stuff you can do in telnet. 25

RFCs l l l The first RFC specifically defining Telnet was RFC 97, First RFCs l l l The first RFC specifically defining Telnet was RFC 97, First Cut at a Proposed Telnet Protocol, published in February 1971. Telnet Protocol Specification, was published as RFC 854 in May 1983. Telnet Option Specifications, RFC 855 26