Fichas
Application Layer

Fichas del conjunto (68)
- 1APPLICATION LAYER>Where we see interactions with the network
>Every layer underneath is providing reliable services to protocols in this layer
>This layer contains: Session, Presentation, App Layer of OSI model - 2When creating network app:>Write programs that run on different end systems
>Communicate over networks i.e web server software communication with browser software
[DO NOT] need to write for network core devices as they do not run applications - 3Application Architecture [Client-Server]Server - a host that is 'always on'. Has fixed IP address and can serve as a large data centre + provide large amount of CPU power
Client - a host which communicates with server to request information. Never communicates directly with clients, always through hosts - 4Application Architecture [P2P]Exists no always on server - everyone is a peer and is equal. Hosts both provide and request information or services
AD:
-Scalability (if add new host, brings more capacity as well as demand)
-No fixed IP - 5App Protocols I>Type of messages exchanged: what you need to define e.g. request/response
>Message Syntax: what format accept as correct
>Message semantics: what is meaning of message at each field - 6App Protocols II>Rules for when/how processes and respond to messages
OPEN:
available to everyone and allows interoperability e.g. HTTP, SMTP
PROPRIETARY:
owned and developed by company e.g. Skype, Microsoft Outlook - 7What transport services does application need?UDP
Unreliable but can tolerate a level of data loss. Fast (due to low overhead) so it can maintain flow of communication. Sacrifices aspects such as error detection/correction for timely delivery.
Used commonly in: voice, video, DNS
TCP
Reliable. Every part of the transmission requires ACK to ensure data is correct before proceeding
Used commonly in: Email - 8ASPECTS of what app needsIntegrity - some apps require 100% reliability e.g. email, if packets for message lost, will scramble entire meaning.
Timing - some apps require timely delivery to be effective i.e. online gaming, need to keep everyone synchronised
Throughput - some apps require more throughput and some just take what they can get (elastic) e.g. file transfer is elastic
Security - encryption and data security is for nerds - 9ASPECTS of what app needs [Examples]File transfer: elastic with throughput, cannot tolerate loss, but not time sensitive
Text message: elastic with throughput, cannot tolerate loss, requires timely delivery (ms)
Real time vid: loss tolerant, 10bps-5mbps, timely delivery req. - 10Internet Apps and ProtocolsEmail uses SMTP (app layer), and TCP (transport layer)
Streaming multimedia uses HTTP (app) and UDP (transgender)
File Transfer uses FTP (app) and TCP (transpositional) - 11Carleton get memedCarleton is a big nerd big teets mcgee
- 12Securing TCPTCP and UDP have no security encryption, are in plain
SSL Secure Socket Layer:
TCP but encrypt and decrypts on both ends + data integrity and end-to-end authentication maintained [all implemented via libraries] - 13TelnetRemote login facility based on VTP [Virtual Terminal Protocol]
VTP and NVT [Network Virtual Terminal]
Both real terminal characteristics and a host's characteristics are mapped into NVT for data transfer - 14Remote Terminal Access with Network Virtual TerminalsVTP:= VTP transforms characteristics of real terminal into a standardised form called NVT
NVT:= this does not physically exist but has well defined characteristics
Connection between terminal and remote host is by using VTP - 15VTP Phases1) Connection management
2) Negotiation [agree on set of characteristics i.e what language to use]
3) Exchange control info
4) Data Transfer - 16NVT (in detail)Used between two terminals or processes - comm is in clear text
>Data is sent at half duplex, can only be terminal to process OR process -> terminal, not both
>Control signal sent anytime regardless of data direction
>Control data sent as telnet commands:
-Interrupt Process IP-244
-Break BRK-245
-Interpret as command IAC-255 - 17Telnet OptionsEither side can use options beyond capability of default NVT
-Negotiation allows one side to request an option:::
--->Other side may accept or rejcect
--->Negotiation anytime after connection established
--->Usually right after connection - 18Telnet Option Categories1) Change, enhance, refine NVT characteristics
2) Change transfer protocol
3) Allow other information to be defined/passed over connection - 19FTP File Transfer Protocol ITransfer file from host to host using port 21 utilising client-server model.
[Client initiates transfer to/from server which is remote host] - 20FTP File Transfer Protocol II {Seperate Control and Data Connections}Control connection is OUT OF BAND, meaning there is 1) one connection made via port 21 for establishing control info, and 2) a second SEPERATE connection made via port 20 for data transfer
Usually only one connection is established.
E.g.
File client contacts FTP server at port 21 to; client gets authorised and sends commands over control connection. Then server opens port 20 to actually send data when receive 'transfer' command - 21FTP Command/ResponsesUSER username
PASS password
LIST return list of all files in cur dir
RETR - retrieves a file
STOR - store file on remote host - 22FTP Codes331 = username OK, pass req.
125 - data connection already opened, transfer starting
425 - cant open data connection
452 - error writing file - 23Web and HTTP Hyper Text Transfer ProtocolObjects could be HTML file, JPEGs, audio files, etc.
A web page contains a base HTML file which contains references to many objects
Each object can be addressable by URL:
www.someschool.edu/someDept/pic.gif - 24HTTP Overview IHTTP is an application layer model for web
Uses Client-Server Model:
>>Client: browsers that request, receive and display web objects
>>Server: Sends objects in response to requests
Both do so via HTTP protocols - 25HTTP Overview IIUses TCP
>Client initiates TCP connection over port 80
>Server accepts TCP connection from client
>HTTP messages exchange info between HTTP client and web server
>Closed after finish connection
WAS ORIGINALLY STATELESS aka server maintains no info about what a client has been doing before - addressed via cookies - 26HTTP Connections [Non-Persistent]After every connection, will transfer one object over TCP connection and then close. If download multiple objects, requires multiple connections.
Aka if 10 images in one object, must make 11 connections - 27HTTP Connections [Non-Persistent] Example ISuppose enters www.someSchool.edu/someDepartment/home.index which contains 10 images references:
1) HTTP initiates TCP connection with web server at whateverthefuck.edu at port 80.
1b) Web server waits for connection at port 80 and notifies client when accepts
2) HTTP client sends server request message [contains URL] into TCP connection socket. Indicates that client wants some object someFucks /home.index.
3) Web server receives request message, forms response message with request object, and sends it through socket - 28HTTP Connections [Non-Persistent] Example II4) Web server closes TCP Connection
5) HTTP client receives response message containing HTML file, client parses file and finds 10 referenced JPEG reference objects
6) Repeat all previous steps for each JPEG object (SAD)
Response time: 2RTT + file transfer time (1 for TCP connection and 1 for HTTP connection) - 29HTTP Connections [Persistent]Multiple objects sent through a single TCP connection.
>Server leaves connection open after sending response. Subsequent HTTP messages sent over request
>As little as 1 RT used for all objects
Used for:
-Authorisation
-User session state
-Shopping cart (amazon) - 30HTTP Message Request[GET, POST, HEAD, commands part of request line i.e GET /index.html HTTP]
\r \n carriage return feed seperate each line - 31HTTP Message Request StructureMethod | URL | Version <- request Line
header field name | value <- header line
body
- 32HTTP Methods:POST: whatever info follows is what I want to put into input
GET: input is uploaded to URL field of request line
PUT: upload files in entity body to path specified in URL field
DELETE: delete files in URL - 33HTTP ResponseStatus line - protocol status code/phrase
header line
data requested
protocol status codes:
200 - request success OK
301 - moved permanently
400 - bad request
401 - not found
505 - HTTP not supported
- 34User-Server State CookiesCookies are a reliable mechanism for websites to remember stateful information (such as items in a shopping cart). This data is sent from the website and stored on the users computer.
Components:
>Header line of http response (from)
>Header line in http request (to server)
>cookie file kept on users host, managed by user's browser
>Back end database maintained by website
E.g. When susan visits e-commerce site for first time, when initial HTTP request arrives at site, it creates: unique ID, and entry in backend database for ID - 35Keeping State:HOW:
Protocol endpoints - maintain state at sender/receiver over multiple transactions
Cookies - http carries state so state can be retrieved - 36WEB CACHETemporary storage of web documents to reduce server lag.
>Satisfies client without involving origin server.
Purpose:
-Reduce lag for client request
-Reduce traffic on instruction access link
-Enables poor content providers to effectively delivery content - 37WEB CACHE How it worksUser browser sends all HTTP requests to cache instead of the web server. IF the request is in cache, requested object returned to browser in timely manner.
IF NOT in cache, request is passed from cache to origin server, and origin server returns desired object which is then cached - 38GET conditionPurpose: Don't send object if cache already has up-to-date cached version
Characteristics:
+no object transmission delay
+lower link util
Cache specifies date of cached copy of request. Server response contains no copy if cache is up to date. - 39Electronic MailThree components:
-user agent
-mail servers
-SMTP simple mail transfer protocol - 40USER AGENT>Mail reader or writer
>Used to compose, edit, and read mails
E.g Outlook, iphone mail client - 41MAIL SERVERWhat a user registers with - has mailbox (containing incoming user messages), message queue (of out going mail)
SMTP protocol between mail server send email msgs
CLIENT (email server sending msg)
SERVER (email server receiving) - 42SMTPGuides communication between the two entities; uses PERSISTENT CONNECTION
Uses TCP transfer via port 25 on either client or server - is direct transfer if from server to server
Transfer phases:
-Handshaking
-Message transfer
-Close
Commands/Responses:
commands: ASCII Text
response: status codes/phrases - 43Summary of Persistent v Non-PersistentP: Pass down everything in one connection. So if it is say, a video, connection will not end until entire video transferred
N-P: If request HTTP file embedded with 10 JPEG objects, then have to connection to get HTTP file, and close, then 10 more connection to get each JPEG. [Total: 11 connections] - 44How email is sent:1) Alice uses her user agent (e.g. phone) to compose message "BIG DICKS" which is addressed to Bob, at some place.
2) User agent sends mail to mail server which Alice is registered to, then put on outgoing queue.
3) Client side will open TCP connection with Bob's mail server.
4) Then SMTP client sends message over TCP connection. Bob's mail server places mail in his mail box.
5) Bob uses his fat fucking fingers to invoke his user agent and read the mail - 45SMTP SemanticsRequires message body to be in ASCII 7 code
Uses CRLF.CRLF to determine end of message body - 46HTTP v SMTPHTTP - PULL, each object is encapsulated in own message
SMTP - PUSH, multiple objects sent in multiple messages
Both have ascii commands and response/interaction codes - 47MAIL ACCESS PROTOCOLSHow does the mail that has already arrived at mail server end up on a users phone for instance?
VIA:
POP3
IMAP
HTTP
SMTP is just for delivery and storage (NOT ACCESS) - 48POP3 IWorks like post office - authorise self then download into user agent.
Two PHASES:
1) Authorisation
Client Commands: USR/PASS
Server Response: +OK -ERR
2) Transaction
list: list message numbers
retr: retrieve message by number
dele: delete mesg
quit - 49POP3 IITwo modes:
-Download and delete (say if you access on phone at work, if you try to access again on laptop at home, will be gone)
-Download and keep copy of message on diff client
DIS:
>Too many ways to access email and takes up too much space, too many copies of the same info.
>Stateless across sessions - 50IMAP>You can read it anywhere but there is only one copy on the server.
>Can organise messages into folders, maintain some sort of structure
>Keeps user state across sessions (if read msg on laptop at work, will stay as read when read on phone at home) - 51Domain Name Server DNSMask IP address so is more user friendly
>137.669.69 becomes hookers.com.edu.au
Network only understands IP addr, not symbols - and for user its easier to understand the symbols. DNS bridges gap between two by mapping one to the other. - 52Supports other applications [brother to all]>App calls procedure 'resolver' which resolves ip address for a remote host - pass in symbolic address
>Resolver queries local DNS server (want to talks to whackoff.org)
>App prog can then use IP address to communicate with remote host
>All DNS queries use UDP to communicate - 53Elements to DNSDomain Name Space
DNS space
Name Server
Resolvers - 54Domain Name SpaceDNS uses hierarchical domain based naming system to identify resources on the Interwebz.
At highest level, small number of domains that cover entire interNETS.
E.g. com, edu, gov, org [generic]
E.g. jap, us, au, nz [country specific]
>Domain names are also case insensitive
EDu = edu
>Component names can be up to 63 chars long, full path cannot exceed 255 chars - 55DNS DatabaseDNS based on hierarchical database containing RR's aka Resource Records
>Every domain has set of RRs
>RR contains {host name, IP address + other mumbo}
Actual format:
Domain_name | Time-to-live | Class | Type | Value
Example:
shitsNgigs.edu | 1D | IN | A | 132.69.69 - 56Resource Record TypesSOA | Start of Authority | Parameters for zone
A | IP addr for host | 32 bit int
MX | Mail Exchange | Priority domain
NS | Name Server | Name server of domain
TXT | Text | Uninterpreted ASCII
PTR | Pointer | Alias for an IP address - 57DNS Name Servers>Centralised /Distributed - must be divided into non overlapping zones
>Managed by one/many DNS servers (one primary, many secondary is typical case)
>Managing server doesn't have to belong to zone its managing - 58How does DNS query work? IDNS server receives type A resource record from a resolver "www.mittsAndClits.gov"
-If domain name being queried is being managed by server, then returns matched RR (authoritative record)
-If a matched RR doesn't exist on cache, returns cached RR (authoritative answer)
ELSE:
Recursive query - sends query to DNS server for top-level domain "edu" waits for answer then forwards back to client. - 59How does DNS query work? IIDNS Queries
Typical use recursive query method - but if record not found could also: generate queries on client's behalf, so DNS can choose to tell client the next server should try. - 60Inserting Records into DNS1) Example, new startup business called "Lady Parts"
2) Register name ladypartsgay.com at DNS registrar (yes actually called a registrar) - provides names, IP addresses of authoritative name server
3) Registrar inserts two RRs into .com TLD server:
{ladypartsgay.com, dns1.ladypartsgay.com, NS and dns1.ladypartsgay.com, 212.212.212.1,A} - 61P2P ArchitectureNo always on server
Everyone is a peer and systems directly communicate between one another
Overcomes client-server disadvantages of:
-Limited resources
-All of load being centred on server
-low scalability
-high maintenance costs - 62Advantages of P2P-Load distributed to everyone - everyone consumes or produces aka request a resource/service or provide a resource/service
-Scalability very high as no centred focus
-Requirements to maintain is very low - 63Formal Definition of P2PP2P is way of structuring distributed applications such that the individual nodes have symmetric roles. Rather than being divided into clients and servers with distinct responsibilities, a node may act as both client and a server.
- 64Example 1: NAPSTER>Primarily used for file sharing (audio files)
>Not a pure P2P network, but a hybrid system
>Is a centralised system so: has a single point of failure and thus limited fault tolerance.
>Has limited scalability.
Operates:
>Client sends server the query, server asks everyone to respond to client
>Client gets list of clients from server
>All clients send ID's of the data they own to the server, so when the requesting client asks for data, server responds with specific addresses - 65Example 2: GNUTELLAPure peer to peer, no routing intelligence required and has constrained broadcast.
---> Life time of packets typically set to 7
--->Packets have unique ids to detect loops
DIS: High potential for free riding - small group of users contribute most of content - 66What is free riding?File sharing networks rely on actually SHARING data. Free riding goes against that concept. Two types:
1) Downloading but not sharing anything
2) Not sharing any interesting data - 67Example 3: BitTorrent I>Files are divided into 256kb chunks and peers in torrents send or receive said file chunks
>How much you get depends on how much you want to contribute (thus overcoming free riding)
Tracker: tracks peers participating in torrent
Torrent: group of peers exchanging chunks of a file - 68Example 3: BitTorrent IIRequesting Chunks
At any time peers can have different subset of file chunks. Periodically, Alice asks each peer for a list of chunks they have. Alice requests pieces of missing chunks from peers first (as it is most rare)
Sending Chunks
Alice sends chunks to 4 peers currently sending her the chunks at the highest rate (which refreshes every so and so)
Información
- Descripción
- Fichas sobre Application Layer, creado por Eric Wojcik el 14/06/2018.
- Creado por
- Eric Wojcik
- Visitas
- 1
- Valoración