Application Layer
Domain Name System
Domain Name System (DNS) Problem Want to go to www.google.com, but don t know the IP address Solution DNS queries Name Servers to get correct IP address Essentially the Internet phonebook Tree structure
DNS Hierarchy net com gov edu org jp cn de google wsu mail uidaho www mail eecs www mail
DNS Terminology Domain subtree of domain space Zone server has responsibility over a zone Root Server has domain of entire tree DNS Generally delegates authority to other servers 13 total Primary Server stores information about its domain (sub tree) Maintain zone files
Resource Records Each domain a record called resource record Information returned to client for DNS request Record types A IP address AAAA IPv6 address NS Name server MX Mail server CNAME canonical name (alias/nickname)
Resolution Types Recursive Initial resolver responsible for finding correct response Iterative Client chases down own DNS response by querying additional servers Caching Names servers may cache results Speeds up response Length of time determined by Time to Live (TTL)
How do find randomsite s IP? Local Network Router Internet Router Router Router Router Router Router Destination Network www.randomsite.com
Recursive DNS Resolution Example Local Network 8 1 Local Name Server 2 3 5 4 Internet Root Name Server.Com Name Server 7 6 RandomSite.com Name Server RandomSite.com Network
Iterative DNS Resolution Example Local Network Local Name Server 1 2 3 5 6 7 8 4 Internet Root Name Server.Com Name Server RandomSite.com Name Server RandomSite.com Network
DNS Examples Dig Wireshark
HyperText Transfer Protocol
HyperText Transfer Protocol (HTTP) Used to support retrieval of web content/pages from web server Examples include HTML (Hypertext Markup language) files (.html) Javascript (.js) Media (.jpg,.gif,.swf) Style sheets (.css) Client-Server architecture Ports HTTP: TCP 80 HTTPS: TCP 443
HTTP Request 3 components HTTP verbs (GET, POST, HEAD, DELETE, PUT,.) HTTP version (e.g., HTTP/1.0, HTTP/1.1) Uniform Resource Locators (URL) Used to identify the location of some web resource on a server Example: http://www.eecs.wsu.edu/~ahahn/index.html Protocol Server Address Filename Maps to some web server file directory (e.g., /var/www)
HTTP Verb GET retrieve the URL from there server Also can be used to post data through GET index.html?varible1=value1&.. HTTP/1.1 Verb Page Variable More Version Variables POST submits data to the server Generally results in data being retrieved as well Verb Page Variable POST index.html HTTP/1.1 Content Length:. variable1=value1&. Variables Many infrequently used verbs HEAD, TRACE, PUT, DELETE..
HTTP Response Status Code 2xx Success 3xx Redirect 4xx - Client Error (e.g., 404 file not found) 5xx Server Error Content-type type of data returned Examples (text/html, image/gif) Content-Length- number of bytes
HTTP 1.0 HTTP 1.0 New TCP connection with each HTTP requests Page has many different objects Images, Javascript, Html documents.
HTTP 1.1 Persistent connections multiple requests within same Http request Reduces HTTP connection overhead
More HTTP Authentication: Digest vs Basic used to authenticate web requests No longer commonly used Caching Supports caching of response data to reduce bandwidth requirements Caching locations: browsers, web proxies Cookies HTTP naturally stateless Cookies enable stateful communication by storing variables on browsers Examples Session tokens random identifier used to correlate uniquely identify session after authentication Remember data from website visit (e.g., Amazon purchases)
Web Services Web Services System to system communication over HTTP HTTP traditionally web used to communicate Files/HTTP for human use Send XML/JSON formatted files Enables more more integrated dynamic websites Examples: Weather - http://graphical.weather.gov/xml/ Address Validation https://www.usps.com/business/web-tools-apis/addressinformation.htm Stock Prices - http://www.webservicex.net/stockquote.asmx Flights - http://services.faa.gov/docs/services/airport/ Two web services approaches SOAP/WSDL - Simple Object Access Protocols REST REpresentational State Transfer
REST vs SOAP SOAP specifies custom protocols for each applications Includes Message format or envelope Message exchange pattern Lots more Web Services Description Language (WSDL) - XML file describing the SOAP protocol Example: http://graphical.weather.gov/xml/dwmlgen/wsdl/ndfdxml.wsdl Strong standards for reliability, security, interoperability REST Simpler, based on WWW operations HTTP Verbs (e.g., GET/POST), Data accessed through URIs Good for create, read, update, and delete operations Example: http://services.faa.gov/airport/status/geg?format=xml
E-Mail (SMTP/IMAP/MIME)
E-Mail Depends on multiple protocols Message format protocols MIME Message transfer protocols SMTP, POP, IMAP Multiple systems Mail Transfer Agent (MTA) Mail Delivery Agent (MDA) Mail User Agent (MUA)
Simple Mail Transfer Protocols (SMTP) Mail Transfer Agent (MTA) Transfer messages between other MTAs (Mail Gateways) MTA will hold message for some period (days) until it can forward it successfully to next MTA Uses DNS MX record to determining MTA for target hosts Open relay MTA which will accept any mail, not just mail from MTA s organization SMTP Core protocol to communicate messages between MTAs TCP port 25 SMTP session used for each connection between MTAs ASCII based protocol can be typed manually at keyboard
SMTP Example HELO cs.princeton.edu 250 Hello daemon@mail.cs.princeton.edu [128.12.169.24] MAIL FROM: Bob@cs.princeton.edu 250 OK RCPT TO: Alice@cisco.com 250 OK DATA 354 Start mail input: end with <CRLF>.<CRLF> Blah blah blah etc. etc. etc. <CRLF>.<CRLF> 250 OK QUIT 221 Closing connections
MDA and MUA MDA delivers message from MTA to local mailbox Protocols Post Office Protocol (POP) Original mail retrieval protocol, limited features Internet Message Access Protocol Supports access from multiple MUAs Retrieve message parts Searching, folders, flags, etc MUA Email client (e.g., MS Outlook, Thunderbird) Receiving email from MDA over POP3/IMAP Send email to MTA over SMTP
Multipurpose Internet Mail Extensions MIME message specifying the format of email messages ASCII text format Two parts Header Specifies common addressing and other message specific fields Subject, Date, To, From, Received added for each mail gateway traversed Body can support multiple types of information Image/jpeg, text/plain, text/richtext, application/postscript, application/msword Example
MIME Example Return-Path: notadamhahn@gmail.com Received: from zmail2.eecs.wsu.edu (LHLO zmail2.eecs.wsu.edu) (69.166.54.80) by zms4.eecs.wsu.edu with LMTP; Sat, 18 Apr 2015 21:48:46-0700 (PDT) Received: from zmail2.eecs.wsu.edu (localhost [127.0.0.1]) by zmail2.eecs.wsu.edu (Postfix) with ESMTP id 246281209F3 for <ahahn@eecs.wsu.edu>; Sat, 18 Apr 2015 21:48:46-0700 (PDT) Received: from mx0a-0007b301.pphosted.com (mx0a-0007b301.pphosted.com [67.231.144.34]) by zmail2.eecs.wsu.edu (Postfix) with ESMTPS id 0E6BF120946 for <ahahn@eecs.wsu.edu>; Sat, 18 Apr 2015 21:48:46-0700 (PDT) Received: from pps.filterd (m0000529 [127.0.0.1]) by mx0a-0007b301.pphosted.com (8.14.5/8.14.5) with SMTP id t3j4jjot022609 for <ahahn@eecs.wsu.edu>; Sat, 18 Apr 2015 21:48:45-0700 Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com [209.85.218.54]) by mx0a-0007b301.pphosted.com with ESMTP id 1tuunru2kw-1 (version=tlsv1/sslv3 cipher=rc4-sha bits=128 verify=not) for <ahahn@eecs.wsu.edu>; Sat, 18 Apr 2015 21:48:45-0700 Received: by oign205 with SMTP id n205so102456123oig.2 for <ahahn@eecs.wsu.edu>; Sat, 18 Apr 2015 21:48:44-0700 (PDT) MIME-Version: 1.0 Received: by 10.76.83.35 with HTTP; Sat, 18 Apr 2015 21:48:43-0700 (PDT) Date: Sat, 18 Apr 2015 21:48:43-0700 Message-ID: CAACEVUXcnRjr37+sL9XZ7GUJxyFqKdbHR1F-69J7dedJL9kBmA@mail.gmail.com Subject: This is an example subject From: Adam Hahn notadamhahn@gmail.com To: ahahn@eecs.wsu.edu Content-Type: multipart/alternative; boundary=001a113dccec33338305140c87d3 --001a113dccec33338305140c87d3 Content-Type: text/plain; charset=utf-8 This is an example of a test email... --001a113dccec33338305140c87d3