The Telnet protocol is often thought of as simply providing a facility for remote logins to computer via the Internet. This was its original purpose although it can be used for many other purposes. It is best understood in the context of a user with a simple terminal using the local telnet program (known as the client program) to run a login session on a remote computer where his communications needs are handled by a telnet server program. It should be emphasized that the telnet server can pass on the data it has received from the client to many other types of process including a remote login server. It is described in RFC854 and was first published in 1983.
Commands
The telnet protocol also specifies various commands that control the method and various details of the interaction between the client and server. These commands are incorporated within the data stream. The commands are distinguished by the use of various characters with the most significant bit set. Commands are always introduced by a character with the decimal code 255 known as an Interpret as command (IAC) character. The complete set of special characters isName | Decimal Code | Meaning |
SE | 240 | End of subnegotiation parameters. |
NOP | 241 | No operation |
DM | 242 | Data mark. Indicates the position of a Synch event within the data stream. This should always be accompanied by a TCP urgent notification. |
BRK | 243 | Break. Indicates that the "break" or "attention" key was hit. |
IP | 244 | Suspend, interrupt or abort the process to which the NVT is connected. |
AO | 245 | Abort output. Allows the current process to run to completion but do not send its output to the user. |
AYT | 246 | Are you there. Send back to the NVT some visible evidence that the AYT was received. |
EC | 247 | Erase character. The receiver should delete the last preceding undeleted character from the data stream. |
EL | 248 | Erase line. Delete characters from the data stream back to but not including the previous CRLF. |
GA | 249 | Go ahead. Used, under certain circumstances, to tell the other end that it can transmit. |
SB | 250 | Subnegotiation of the indicated option follows. |
WILL | 251 | Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. |
WONT | 252 | Indicates the refusal to perform, or continue performing, the indicated option. |
DO | 253 | Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. |
DONT | 254 | Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. |
IAC | 255 | Interpret as command |
Sender Sent | Receiver Responds | Implication |
WILL | DO | The sender would like to use a certain facility if the receiver can handle it. Option is now in effect |
WILL | DONT | Receiver says it cannot support the option. Option is not in effect. |
DO | WILL | The sender says it can handle traffic from the sender if the sender wishes to use a certain option. Option is now in effect. |
DO | WONT | Receiver says it cannot support the option. Option is not in effect. |
WONT | DONT | Option disabled. DONT is only valid response. |
DONT | WONT | Option disabled. WONT is only valid response. |
For example if the sender wants the other end to suppress go-ahead it would send the byte sequence 255(IAC), 251(WILL), 3The final byte of the three byte sequence identifies the required action. For some of the negotiable options values need to be communicated once support of the option has been agreed. This is done using
The Telnet Protocol
Telnet Negotiable Options Many of those listed are self-evident, but some call for more comments.
- Suppress Go Ahead
The original telnet implementation defaulted to "half duplex" operation. This means that data traffic could only go in one direction at a time and specific action is required to indicate the end of traffic in one direction and that traffic may now start in the other direction. [This similar to the use of "roger" and "over" by amateur and CB radio operators.] The specific action is the inclusion of a GA character in the data stream.Modern links normally allow bi-directional operation and the "suppress go ahead" option is enabled.
- Echo
The echo option is enabled, usually by the server, to indicate that the server will echo every character it receives. A combination of "suppress go ahead" and "echo" is called character at a time mode meaning that each character is separately transmitted and echoed. There is an understanding known as kludge line mode which means that if either "suppress go ahead" or "echo" is enabled but not both then telnet operates in line at a time mode meaning that complete lines are assembled at each end and transmitted in one "go".
- Linemode
- remote flow control
This option controls where the special flow control effects of Ctrl-S/Ctrl-Q are implemented. Telnet control functions The telnet protocol includes a number of control functions. These are initiated in response to conditions detected by the client (usually certain special keys or key combinations) or server. The detected condition causes a special character to be incorporated in the data stream.
- Interrupt Process
This is used by the client to cause the suspension or termination of the server process. Typically the user types Ctrl-C on the keyboard. An IP (244) character is included in the data stream.
- Abort Output
This is used to suppress the transmission of remote process output. An AO (238) character is included in the data stream.
- Are You There
This is used to trigger a visible response from the other end to confirm the operation of the link and the remote process. An AYT (246) character is incorporated in the data stream.
- Erase character
Sent to the display to tell it to delete the immediately preceding character from the display. An EC (247) character is incorporated in the data stream.
- Erase line
- Data Mark
Some control functions such as AO and IP require immediate action and this may cause difficulties if data is held in buffers awaiting input requests from a (possibly misbehaving) remote process. To overcome this problem a DM (242) character is sent in a TCP Urgent segment, this tells the receiver to examine the data stream for "interesting" characters such as IP, AO and AYT. This is known as the telnet synch mechanism.A DM not in a TCP Urgent segment has no effect.
The telnet commandOn most Unix systems a telnet session can be initiated using the telnet command. telnet <remote host> but if the user just types telnet then various options and subcommands are available which can be used to study the behavior of the session.
Here's an exmaple of a telnet session from scitsc to ccub
bash$ telnet
telnet> toggle options
Will show option processing.
telnet> open ccub
Trying 63.14.239.165 ...
Connected to laynetworks.com.
Escape character is '^]'.
SENT do SUPPRESS GO AHEAD
SENT will TERMINAL TYPE (reply)
RCVD do TERMINAL TYPE (don't reply)
RCVD will SUPPRESS GO AHEAD (don't reply)
RCVD will ECHO (reply)
SENT do ECHO (reply)
RCVD do ECHO (reply)
SENT wont ECHO (reply)
UNIX(r) System V Release 4.0 (ccub)
RCVD dont ECHO (don't reply)
login: Login timed out after 60 seconds
Connection closed by foreign host.
No comments:
Post a Comment