INTERNET TECHNOLOGIES
Week 11 Application Layer Paradigm
1
• Provides services to the user
• Communication provided using a logical connection
• Two application layers assume that there is an imaginary direct connection through which they can send and receive messages.
2
Logical connection at application layer
3
• Most communication networks were originally designed to provide one specific service
• Eg phone network originally designed to provide voice service - allow people all over world to talk to each other
• Later used for other services
• Fax - enabled by adding extra hardware at both ends.
4
• Internet also provides services to users around world
• TCP/IP layers allow more flexibility
• Protocols can be added and removed
• Need to ensure that upper and lower layers can cope with these changes
• Application layer at top
• Easier to add new protocols
• Initially only a few protocols used
• Now there are too many to count (and growing).
5
• Standard Application Layer Protocols
• Defined by Internet Authorities
• FTP, Telnet, HTTP
• Non Standard Application Layer Protocols
• New protocols (proprietary) can be created
• Don’t need approval to use privately
• Must interact with lower layers correctly.
6
• To use Internet, need two application programs to interact with each other:
• One running on a computer somewhere in world
• Another running on computer somewhere else
• Need to send messages to each other through
Internet infrastructure
• Two paradigms have been developed
• Client-server paradigm
• Peer-to-peer paradigm (discussed last week).
7
Figure 25.2: Example of a client-server paradigm
8
Figure 25.3: Example of a peer-topeer paradigm
9
• Communication at application layer between two running application programs (processes)
• Client
• Running program initialises communication by sending request
• Server
• Another application program that waits for request from client.
10
• Programs normally written in languages with predefined sets of instructions
• Process to be able to communicate with another process
• Need set of instructions to tell lowest four layers of
TCP/IP suite to:
• Open connection
• Send and receive data from other end
• Close connection
• This instruction called:
• Application Programming Interface (API).
11
• Many communications APIs exist:
• Transport Layer Interface (TLI)
• STREAM
• Sockets Interface (more common).
12
13
Sockets used like other sources & sinks
• Started in early 1980s as part of Unix
• Applications send/receive data to/from sockets
(similar to write/read to terminal or file).
14
Figure 25.6: Use of sockets in processto-process communication
• As far as Application layer is concerned:
• Communications between client process and server process is via two sockets
• Transfer of information between sockets is handles by Operating System and TCP/IP protocols
15
• Socket addresses (2) required for communications
• Need IP address
• Finds host
• Need Port number
• Finds application on host
16
• Pair of Application processes provide services to users - humans or programs
• Need to use services provided by transport layer for communications
• 3 common transport layer protocols in TCP/IP suite:
• UDP - User Datagram Protocol
• TCP - Transmission Control Protocol
• SCTP - Stream Control Transmission Protocol
• Most standard applications use services of one.
17
• An iterative server processes one client request at a time
• Receives a request, processes it, and sends response to requestor before handling another request
• When server handles request from client, requests from other clients (even same client) need to be queued at the server site and wait for server to be ready
• Received and queued requests are handled in first-in, first-out (FIFO) fashion
• Server socket created and remains available
• Client socket created and destroyed for each interaction.
18
Figure 25.8: Sockets for UDP communication
19
• Iterative communication using TCP is not common
• Relatively simple type of communication
• TCP Connection oriented
• Uses two different sockets
• Connection establishment
• Data transfer.
20
Figure 25.10: Sockets used in TCP communication
2
Create
5
Create
21
• Idea of Web first proposed by Tim Berners-Lee in
1989 at CERN (European Organization for Nuclear
Research - "Conseil Européen pour la Recherche
Nucléaire")
• Allowed several researchers at different locations throughout Europe to access each others’ research
• Commercial Web started in early 1990s.
22
• Assume need to retrieve a scientific document that contains one reference to another text file and one reference to a large image
• The main document and the image are stored in two separate files in the same site (file A and file B)
• A referenced text file stored on another site (file C)
• Three different files, need three transactions to see whole document.
23
24
• Web Browser usually has three main parts
• Controller
• Client protocols
• Interpreters
25
• Protocol
• http, https, ftp etc
• Host
• IP address or hostname
• Eg 137.166.4.30 or www.csu.edu.au
• Port
• Port number (16 bit integer)
• 80 default for http
• 443 default for https etc
• Path
• Directory path of files on server.
26
• Format of URL
• protocol:// host :port /path
• http://www.csu.edu.au:80/faculty/business/scm
• Only need :port number if not default
• Don’t need http:// unless other protocol needed
• Often don’t need www (some cases mandatory).
27
• HyperText Transfer Protocol (HTTP) used to define how client-server programs can be written to retrieve web pages from Web
• HTTP client sends request
• HTTP server returns response
• Server uses port number 80
• Client uses temporary port number
• HTTP uses services of TCP
• ie connection-oriented and reliable protocol.
28
• Nonpersistent connection
• Need a TCP connection for each link (even on same server)
• Eg Client needs to access file that contains 1 link to image
• Text file and image located on same server
• Need two connections
• TCP requires at least three handshake messages to establish each connection
• Request sent with third one
• After connection established object transferred
• After receiving object
• Another three handshake messages needed to terminate connection.
29
30
• Persistent connection
• Only one connection establishment and connection termination is used
• Request for image sent separately.
31
32
Figure 26.5: Formats of the request and response messages
33
34
35
Table 26.3: Response Header Names
36
• Retrieve a document
• Request - Use GET method to retrieve image /usr/bin/image1
• Request line
• Shows method ( GET ), URL, HTTP version (1.1)
• Header
• 2 lines - client can accept images in GIF or JPEG format
• Request does not have a body
• Response message - status line & four lines of header
• Header lines define date, server, content encoding (MIME version), length of document
• Body of document follows header.
37
38
• Client wants to send a web page to be posted on server
• Use PUT method
• Request line shows the method ( PUT ), URL, HTTP version
• Header has four lines.
• Request body contains web page to be posted
• Response message contains the status line and four header lines
• Created document (CGI document) included as body.
39
40
• File Transfer Protocol (FTP) - standard protocol provided by TCP/IP for copying files between hosts
• Although transferring files from one system to another seems simple and straightforward, some problems must be dealt with first.
41
Control connection
Data connection
42
• Two connections in FTP have different lifetimes
• Control connection connected during entire interactive FTP session
• Data connection opened and closed for each file transfer activity
• Opens each time commands involve transferring files
• Closes when file transfer completed.
43
• FTP uses same approach as TELNET for control communications (uses port 21)
• Uses NVT (Network Virtual Terminal) ASCII character set (same as TELNET)
• Communication achieved through commands and responses
• Simple method adequate for control connections since one command (or response) sent at a time
• Each line terminated with a two-character (carriage return and line feed) end-of-line token.
44
45
Table 26.4 : Some FTP commands
(continued)
46
47
Data connection uses well-known port 20 at server site
Creation of data connection different from control connection
1. Client, not server, issues passive open using an ephemeral port
2. Using PORT command, client sends this port number to server
3. Server receives port number and issues active open using well-known port 20 and the received ephemeral port number.
48
• Using FTP for retrieving a file
• One file to be transferred
• Control connection remains open all the time
• Data connection opened and closed repeatedly
• Assume file transferred in six sections
• After all records transferred, server control process announces file transfer completed.
• Client control process issues QUIT command
• Service connection then closed.
49
50
• An actual FTP session that lists the directories
51
• FTP protocol designed when security not a big issue
• FTP usually requires password
• Sent in plaintext (unencrypted)
• Can be intercepted & used by an attacker
• Data transfer connection also transfers data in plaintext, also insecure
• Can add Secure Socket Layer between FTP application layer and the TCP layer
• Then FTP is called SSL-FTP (or SFTP).
52
• Designed to help other application programs
• Internet needs directory system to map name to address
• Analogous to directories in telephone network.
53
54
• To be unambiguous, names assigned to machines must be carefully selected from a name space with complete control over the binding between the names and IP addresses
• ie names must be unique since addresses are unique
• A name space that maps each address to a unique name can be organised in two ways
• Flat
• Hierarchical.
55
56
Fig 26.30: Domain names and labels
57
58
Fig 26.32: Hierarchy of name servers
59
60
• DNS protocol can be used on different platforms
• Internet - domain name space (tree) originally divided into three different sections:
• Generic domains
• Country domains
• Inverse domains
• Due to rapid growth of Internet, extremely difficult to keep track of inverse domains, which could be used to find the name of a host when given the IP address
• Inverse domains now deprecated (see RFC3425 ).
61
62
63
64
• Mapping name to IP address name-address resolution
• DNS - client-server application
• If host needs to map address to name OR name to address - call DNS client resolver
• Resolver accesses closest DNS server
• If server has information
• Info sent to resolver
• Else
• Refers resolver to other servers OR asks other servers to provide information.
65
7
6
4 1
8
66
1
8
6
2
4
3
5
7
67
• Each time a server receives query for name not in its domain
• Searches its database for server IP address
• Reduction of this search time would increase efficiency
• DNS handles this with a mechanism called caching
• Common sites remain in cache for faster search.
68
• Zone information associated with server implemented as set of resource records
• ie name server stores database of resource records
• Resource record a 5-tuple structure:
69
70
• To retrieve information about hosts, DNS uses two types of messages
• Query
• Response
• Both have same format.
71
72
• In Unix/Linux/Mac and Windows
• nslookup utility used to retrieve address/name
• Retrieve address when domain name given:
$ nslookup www.csu.edu.au
Name: www.csu.edu.au
Address: 137.166.4.30
73
• How are new domains added to DNS?
• Through Registrar
• Commercial entity accredited by ICANN
• Verifies requested domain name unique
• Then enters in DNS database.
74
• When DNS designed, many address changes were not expected
• Eg adding new host, removing host, changing IP address change must be made to DNS master file
• Manual updating
• To difficult with current size of Internet
• Dynamic Domain Name System (DDNS)
• DHCP used to send new info to primary DNS
• Secondary DNS informed of change
• Actively – info pushed to secondary
• Passively – wait for secondary query.
75
• DNS important in Internet infrastructure
• Provides crucial services to Internet users
• Applications such as Web access or e-mail heavily dependent on proper operation of DNS
• DNSSEC (DNS Security) used to authenticate and check integrity of DNS messages
• Slowly being deployed throughout
• Needs tools on Clients and Servers.
76
• Typo squatting
• Registering domain names similar to existing brands
• Distributed Denial of Service attacks (DDoS)
• Particularly vulnerable - a logical choke point on the network
• DNS Amplification Attacks
• DDoS attack for DNS with insecure "recursive" configurations
• Registrar Hijacking
• Identity theft, gaining control over a domain name
• Cache poisoning
• Bad data passed to DNS resolver's cache
77
End
78