Lecture No. 9

Download Report

Transcript Lecture No. 9

Application Layer
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 1
Application Tasks
• To supply services to the user
–
–
–
–
–
file transfer
World Wide Web browsing
mail
network management
network name services
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 2
Application Layer Protocols
•
•
•
•
•
•
FTP/TFTP
Telnet
HTTP
SMTP
SNMP
DNS
4/13/2016
Port 21/69
Port 23
Port 80
Port 25
Port 161
Port 53
© 2008 Raymond P. Jefferis III
Lect 10 - 3
FTP/TFTP
• FTP (File Transfer Protocol)
–
–
–
–
uses TCP for transfer of files and data
additional parameters must be supplied
user shielded from file system properties
can be used by terminal or program
• TFTP (Trivial File Transfer Protocol)
– similar to FTP but uses UDP
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 4
FTP Commands
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 5
FTP – Login (Two types)
• Supply server name
• Supply account (if not “anonymous”)
• Supply Password (user name if anonymous)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 6
FTP - Directory Operations
• Change Directory (cd)
• List directory (ls)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 7
FTP - File Transfer
• Set binary mode
• Put local file to server ftp directory
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 8
Telnet
•
•
•
•
•
Telnet is a remote terminal protocol
Remote logon permitted
User gets virtual terminal (emulation)
Uses a TCP connection protocol
Requires two arguments
– name of server
– protocol port number of server (commercial
software will use default)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 9
Telnet - Terminal Setup
• Define terminal
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 10
Telnet - Connect from Prompt
• Type Telnet serverName
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 11
Telnet - Connect via Program
• Type Telnet
• Specify server and terminal type
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 12
HTTP
• Hypertext Transfer Protocol
– used for World Wide Web (WWW) to retrieve
hypertext documents
– client/server mode
– transaction-oriented (connection broken after
document transmission is complete)
– uses TCP to connect client and server
(virtual “connection”)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 13
HTTP Message Format
• Request
– message type
– requested source
• Response
– response information
• General
– additional information
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 14
HTTP Header Information
• Connection (header field names)
• Date (date and time stamp)
• Keep-alive (sender connection timeout)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 15
HTTP Request Methods
•
•
•
•
•
Get (from specified URL)
Put (post to URL)
Patch (post differences to URL)
Copy, Move, Delete (URL info)
Link/Unlink (add or delete link in URL)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 16
HTTP Response Messages
• Status line
– HTTP Version
– Status Code
– Reason Phrase
• General response
• Entity body (optional)
– text, binary data, audio, images, video
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 17
SNMP/SNMPv2
• Simple Network Management Protocol
– network monitoring
– network management
• Basic actions
–
–
–
–
Get (request named objects - various datatypes)
Set (request alteration of named objects)
Notify (inform request)
Uses UDP for communications
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 18
SNMP Network Components
• Management stations
– restricted access
– inspect, display, and alter network data
• Managed nodes
– routers, gateways, bridges, switches, hubs, etc.
– computers, printers, etc.
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 19
SNMP Management Objectives
• Fault detection
• Equipment configuration
• Gathering statistics
– for accounting purposes
– for diagnostic purposes
• Network security
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 20
SNMP Model
• Objects
– written in ASN.1 syntax
– defined in Management Information Base
(MIB) - many types of objects pre-defined
• Agents
– programs in managed nodes
– supply requested information
– alter information when requested
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 21
ASN.1 Data types in SNMP
•
•
•
•
•
INTEGER
BIT STRING
OCTET STRING
NULL
OBJECT IDENTIFIER
Type code = 2
Type code = 3
Type code = 4
Type code = 5
Type code = 6
Syntax in use:
identifier type ::= value or (range) or {idn(valn), ...}
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 22
SNMP Data Transfer Format
• Header byte
– tag (2 bits)
– tag extension (1 bit)
– type code (5 bits)
• Length [bytes]
• Data bytes
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 23
Basic SNMP Objects
•
•
•
•
•
System - equipment description
Interfaces - with logged traffic
AT - address translation
IP - packet statistics
ICMP - message statistics
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 24
Basic SNMP Objects (Cont’d)
•
•
•
•
•
TCP - methods, parameters, statistics
UDP - statistics
EGP - gateway protocol statistics
Transmission - media-specific
SNMP - management traffic statistics
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 25
SNMP Message Types
(0)
(1)
(2)
(3)
(4)
4/13/2016
GetRequest - get variables
GetNextRequest - get next variable
GetResponse- get data
SetRequest - modify variable
Trap - agent trap message
© 2008 Raymond P. Jefferis III
Lect 10 - 26
SMTP
• Simple Mail Transfer Protocol
• Sent and received via Port 25 using TCP
• Envelope
– list of recipients
• Body
– message to be sent (7-bit ASCII)
• Outgoing messages are queued
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 27
SMTP Header
•
•
•
•
•
•
TO:
FROM: (REPLY TO:)
CC:
SUBJECT:
DATE:
ENCRYPTED:
4/13/2016
address
address
address
text
date
pointer
© 2008 Raymond P. Jefferis III
Lect 10 - 28
Some SMTP Commands
• HELO (send ID - sent by client)
• MAIL FROM (identify originator)
• RCPT TO (identify recipient)
• DATA (transfer message text)
• QUIT (close TCP connection)
(See text, p660 for example)
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 29
Some SMTP Replies
•
•
•
•
•
•
•
220
221
250
345
421
550
554
4/13/2016
“ready” - returned by server
“destination closing”
“okay” - transfer complete
“ready for mail” - start
“mail service unavailable”
“mailbox not found”
“mail transaction failed”
© 2008 Raymond P. Jefferis III
Lect 10 - 30
DNS
• To locate addresses in network domains
• Each host has resource records of format:
–
–
–
–
–
4/13/2016
DomainName
TimeToLive [seconds]
Class (IN for internet)
Type (see table)
Value (data type depends on Type field)
© 2008 Raymond P. Jefferis III
Lect 10 - 31
DNS (continued)
• Database is distributed and hierarchical
• Names that cannot be resolved in the host
are referred up the hierarchy of name
servers
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 32
Name Servers (Continued)
• There is usually a specified name server for
a network configuration
• A backup (second) name server is usually
specified
• UDP protocol is used for name server
queries and responses
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 33
DNS Record Types
TYPE
MEANING
VALUE
SOA
A
MX
NS
CNAME
PTR
HINFO
TXT
Start of authority
IP address of host
Mail exchange
Name server
Canonical name
Pointer
Host description
Text
Parameters
4 octets
Accepts mail
Server name
Domain name
IP address alias
ASCII CPU and OS
ASCII text
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 34
Example
dcs.engr.widener.edu,147.31.252.126,A,IN
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 35
End
4/13/2016
© 2008 Raymond P. Jefferis III
Lect 10 - 36