8 Telnet 20150414
8 Telnet 20150414
BUPT/QMUL
2015-04-14
Refer to Chapter 24, Textbook
Agenda
A brief introduction to TELNET
Concept of remote/virtual terminal
TELNET operations
TELNET protocol
TELNET options negotiation
Other remote access technologies
2
A Brief Introduction to TELNET
3
Brief Introduction To TELNET
Use of TELNET: BBS
What is TELNET?
History
Major Ideas
4
BBS: Bulletin Board System
A computer system running software that
allows users to connect and log in to the
system using a terminal program.
Once logged in, a user can perform functions
such as
uploading and downloading software and data;
reading news and bulletins;
and exchanging messages with other users, either
through Email or in public message boards.
5
Traditional BBS example:
6
Example of BBS Today(1)
7
Example of BBS Today(2)
telnet BBS of BYR
9
What Is TELNET? (1)
A protocol used to establish a dumb terminal session
to another computer on the Internet
An important Internet application for remote access
TELNET
RFC 854
10
What Is TELNET? (2)
Definition in RFC854
The purpose of the TELNET Protocol is to provide a
general, bi-directional, byte oriented
communications facility.
Its primary goal is to allow a standard method of
interfacing terminal devices and terminal-oriented
processes to each other.
It is envisioned that the protocol may also be used
for terminal-terminal communication ("linking") and
process-process communication (distributed
computation).
11
TELNET vs. telnet
TELNET is a protocol that provides “a
general, bi-directional, eight-bit byte
oriented communications facility”
telnet is a program that supports the
TELNET protocol over TCP
Many application protocols are built
upon the TELNET protocol
12
The History Of Telnet
Telnet is simple
Total pages of RFC 854 is 15
HTTP (we will see later) is 176 pages
13
Major Ideas Of TELNET
The concept of a NVT (Network Virtual
Terminal)
Providing a standard interface to remote systems
The principle of negotiated options
Enabling Telnet to evolve to meet new demands
without endless new versions of basic protocol
A symmetric view of terminals and processes
Allowing an arbitrary program to become a client
14
Network Virtual Terminal
Command/Data
Server
Process
Standard language
NVT NVT
15
Concept Of Remote / Virtual Terminal
16
Remote Terminal Access
Early motivation for networks was remote access to
interactive systems
17
Telnet Operation Environment On Early Internet
18
Problem
Lack of common language between the terminal and
the remote host
TCP connection
?
across Internet
User’s
keyboard TELNET TELNET Server’s
?
& display Client Server system
19
Network Virtual Terminal
The approach to solve the problem of lack of a
common language was to define a common language
Virtual terminal protocol (VTP)
Transform local characteristics into standardized form
Network virtual terminal (NVT)
Imaginary device
Well defined set of characteristics
Both sides generate data and control signals in native
language but translates them to NVT form
The sending side translates native data and control signals
into NVT form before sending out
the receiving side gets the NVT data and signals and
translates into its native form
20
NVT Operation
Accommodating heterogeneity
Converting client system Converting NVT format
format into NVT format into server system format
TCP connection
across Internet
User’s
keyboard TELNET TELNET Server’s
& display Client Server system
23
TELNET Operations
Connection management
Connection request, establish and terminate
Negotiation
To determine mutually agreeable set of characteristics and
options
Exchange of control information (e.g. end of line), commands
and transfer of data between two correspondents
A typical telnet session is exchange of data between terminal
and host
Multiple rounds
Not only for accessing remote accounts; was also used for
interactive system
Try “telnet bbs.byr.cn”
24
TELNET Protocol
25
Related RFCs
Basic protocol
RFC854: Telnet Protocol Specification
Options
RFC855: Telnet Option Specifications
RFC856: Telnet Binary Transmission
RFC857: Telnet Echo Option
RFC858: Telnet Suppress Go Ahead Option
RFC859: Telnet Status Option
…
26
Some Features
TCP connection: directed toward port 23 of
the server being asked to perform a service
Data and control multiplexed over the same
connection
NVT - representation of a generic terminal
Negotiated options - provides a standard
language for communication of terminal
control functions
27
TELNET Protocol
Transmission of data
Standard representation of control
functions
28
Transmission Of Data (1)
Data path from the user’s keyboard to the remote system
29
Transmission Of Data (2)
Data sent half-duplex
Terminal-to-process, newline signifies end of user input
Process-to-terminal, control signal Go Ahead(GA) is used
Underlying TCP full duplex
Control signals sent any time regardless of current data
direction
Data sent as stream of 8-bit bytes
No other formatting
Control signals and other non-data information sent
as Telnet commands
Byte strings embedded in data stream
User control signals, commands between Telnet processes
as part of protocol and option negotiation and
subnegotiation 30
Control Functions (1)
TELNET includes support for a series of
control functions commonly supported
by servers
This provides a uniform mechanism for
communication of (the supported)
control functions
You can imagine them as some extra
virtual keys in the NVT keyboard
31
Control Functions (2)
Interrupt Process (IP)
Suspend/interrupt/abort/terminate process
Abort Output (AO)
allow a process, which is generating output, to run to
completion but without sending the output to the user's
terminal
Are You There (AYT)
check to see if system is still running
Erase Character (EC)
delete last character sent
typically used to edit keyboard input
Erase Line (EL)
delete all input in current line
typically used to edit keyboard input
32
Control Functions (3) – delivery
Decimal
Command Description
Codes
IAC 255 Interpret next octet as command
DONT 254 Denial of request to perform specific option
DO 253 Approval to allow specific option
WONT 252 Refusal to perform specific option
WILL 251 Agreement to perform specific option
SB 250 Start of option subnegotiation
GA 249 Go ahead
EL 248 Erase line
EC 247 Erase character
AYT 246 Are you there
AO 245 Abort output
IP 244 Interrupt process
BRK 243 Break
DMARK 242 Data mark
NOP 241 No operation
SE 240 End of subnegotiation
EOR 239 End of record 33
Control Functions (4) – IAC
TELNET command structure
at least a two byte sequence: the IAC (Interpret as
Command) escape character followed by the code for the
command
The IAC code is 255
If a 255 is sent as data - it must be followed by another 255
Looking for a command
Each receiver must look at each byte that arrives and look
for an IAC
If IAC is found and the next byte is “IAC” - a single data byte
(value 255) is presented to the application/ terminal
If IAC is followed by any other code - the TELNET layer
interprets this as a command
34
Control Functions (5)
– DO, DONT, WILL, WONT
Used for options negotiation
Examples
35
TELNET Options Negotiation
36
Motivations
All NVTs support a minimal set of capabilities
Some terminals have more capabilites than
the minimal set
The two endpoints negotiate a set of
mutually acceptable options (character set,
echo mode, etc)
The set of options is not part of the TELNET
protocol, so that new terminal features can
be incorporated without changing the TELNET
protocol
37
Option Examples
echo modes
Keyboard input be echoed on the terminal side or
not
Line mode vs. character mode
One line or one character per transmission
character set (EBCDIC vs. ASCII)
EBCDIC - Extended Binary-Coded Decimal
Interchange Code
ASCII - American Standard Code for Information
Interchange
38
Options Negotiation
Each option is assigned a byte value
The DO, DONT, WILL, and WONT commands
are used to negotiate options
Options negotiation is symmetric
Steps must be taken to avoid option
processing loops
Subnegotiations are used when more
information is needed, such as when
negotiating terminal type, window size, etc
39
Example:
Negotiation of Echo Option
Client Server
ECHO DO IAC
40
TELNET Options List (1)
41
TELNET Options List (2)
42
A Telnet Session Example (1)
C:\Documents and Settings\Administrator> telnet 192.168.1.253
Red Hat Enterprise Linux AS release 4 <Nahant Update 1>
Kernel 2.6.9-11.Elsmp on an i686
Login: shiyan
Password:
Last login: Sun Nov 11 17:48:30 from 192.168.1.168
[shiyan@localhost ~]$
43
Some options negotiated firstly
44
Suboption about the terminal type
ANSI / DEC / IBM3270 / …
45
Some prompt information
given by the server
Data and control multiplexed over the same connection
46
When I typed in login ID “shiyan”
Character ‘s’ sent
to server
47
When I pressed ENTER
CR LF
13 10
0d 0a
48
Summary (1) – usages of telnet
Use Internet accounts you may have on
remote computers
you need an account (login ID) and password on
the remote computer to permit access
Use free services accessible with telnet, e.g.
library catalogues
databases
BBS (Bulletin Board System)
Router/switch configuration
49
Summary (2) – Disadvantages of telnet
Poor user interface
Based on dumb terminal
Text-only display
Monochrome
One color for text, one for background
Have to type command-line commands
Often have complex syntax
Not very secure, SSH made enhancement
TELNET does not encrypt any data sent over
the connection (including passwords) 50
Other Remote Access Technologies
51
Other Remote Access Technologies
52
SSH (1) – brief information
Secure Shell
Command line terminal connection tool
All traffic encrypted
Both ends authenticate themselves to the other end
Ability to carry and encrypt non-terminal traffic
Private key kept on client, public key stored on server
Now, it is an IETF standard
RFC4251, The Secure Shell (SSH) Protocol
Architecture
53
SSH (2) – two enhancements of telnet
54
SSH (3) – three major mechanisms
A transport layer protocol that provides sever
authentication, data confidentiality, and data integrity
with perfect forward secrecy
55
SSH (4) – tools
PuTTy
56
57
Other Ways Of Remote Access
Except telnet, there are other ways
rlogin family utility
VNC (Virtual network computing)
RDP (Remote Desktop Protocol)
Comparison with Telnet
58
Helpful URLs
RFCs
http://www.ietf.org/
Useful utilities
http://winfiles.search.com/search?cat=316&tag=ex.sa.fd.srch.wf&q
=TELNET
About telnet
http://en.wikipedia.org/wiki/Telnet
http://baike.baidu.com/view/44255.htm
About SSH
http://www.ssh.com
http://www.openssh.org
About realVNC
http://www.realvnc.com/
59
Abbreviations of Week 6-9
BBS Bulletin Board System
BOOTP BOOTstrap Protocol
DHCP Dynamic Host Configuration Protocol
DNS Domain Name System
FQDN Fully Qualified Domain Name
IAC Interpret As Command
MSC Message Sequence Chart
NVT Network Virtual Terminal
SSH Secure SHell
STD State Transition Diagram
TLD Top Level Domain
TLV Type-Length-Value
TTL Time To Live
60