Mahalingam Ramkumar Mississippi State University, MS

Transcription

Domain Name SystemE-mailWWWApplication LayerMahalingam RamkumarMississippi State University, MSSeptember 15, 2014RamkumarAL

Domain Name SystemE-mailWWWOutline1Domain Name SystemDNS RecordsDNS Components2E-mailMessage TransferFetching Emails3WWWRamkumarAL

Domain Name SystemE-mailWWWApplicationsWe will focus on 3 applicationsDNSEmailWWWRamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDomain Name slpc24RamkumarALusnloce.vucsflitsfluit

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDomain Name SpaceDNS Root at the top of the inverted treeTop level domains — generic (gTLD) and country-code(ccTLD)New TLDs added rarelyNames below TLDs can be purchased (if available)DNS is a distributed database of DNS recordsA database for every zoneRamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDomain Name ServiceDNS (domain name service) provides domain-name to IPlook-upNaming according to organizational boundaries - not physicalIP addresses depend on physical location (issued by a ISP)DNS is an application — uses UDP as the transport layerDNS servers queried by DNS clients.RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS Zonename under the control of an entitymsstate.edu is a zoneOwner of zone msstate.edu authorized to create any nameending with “msstate.edu.”Can also delegate some names to other entitiesFor example, cse.msstate.edu has been delegatedA delegated name becomes a zoneRoot delegated gTLD edu. gTLD edu delegated msstate.edu.msstate.edu delegated cse.msstate.eduneed not delegate all names (for example, eng.msstate.edu isnot delegated, and so is still under the control of msstate.edu.RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS DatabaseZone owner responsible for creating the zone databaseZone database (or zone file, or, zone master file) is a list ofDNS recordsEach record indicates name, type, and valueThere can be multiple records for the same name and type.DNS servers host the databasetypically every zone has one or more zone DNS serversRamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS QueriesDNS servers can be queried by specifying a name and typeFor example, name disney.cse.msstate.edu, type A (A is foraddress)The response is a value corresponding to the name and typePossibly multiple values if multiple records exist for the samename and type.Query: name cse.msstate.edu, type AResponse: name cse.msstate.edu, type A,value 130.18.208.80RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS LookupEvery zone provides it’s parent information regarding how toreach the zone server.cse.msstate.edu provides information regarding name serversfor cse.msstate.edu to parent zone msstate.eduConsequentlyroot zone knows how to reach it’s child eduedu knows how to reach it’s child zone msstate.edumsstate.edu knows it’s child zone cse.msstate.edu, etc.RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsRecursive and Iterative QueriesQueries could be recursive or non-recursiveQuery by Q for name disney.cse.msstate.edu, type ARecursive:Q root edu msstate.edu cse.msstate.edu msstate.edu edu root QIterative:QQQQ root ; Root Q response is direction to reach edu)edu direction to reach msstate.edu)msstate.edu direction to reach cse.msstate.educse.msstate.edu final (authoritative) answer to queryPros and Cons?RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS Resource RecordEach resource record is a five-tupleDomain NameTTL - how stable the record isClass - For Internet, it is INType - Many types (next slide)Value - Value corresponding to the typeRamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsType Field in Resource RecordsSOA (start of authority) - details regarding primary source ofinfo, contact addresses, serial number, flags and time-outsA (Address) - 32 bit IP address - there could be more thatone A record (multiple IPs)MX (Mail Exchange) - Mail server for this domainNS (Name Server)CNAME - aliases(eg disney.cse.msstate.edu 43560 IN CNAMEdisney.cs.msstate.edu)PTR - allows for reverse-lookupHINFO - additional info about the machineTXT - Whatever else you want to add!RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsSample DNS Database EntryRamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS ComponentsDomain Registrars: sell domain namesZone authority/owner: Creates DNS records pertaining to azone — all records entered in a zone master fileAuthoritative DNS servers (zone servers): Servers run by theauthority. Serves DNS records from the zone master file(s)Root name servers are authoritative for root domain. A gTLDname server is authoritative for the gTLD.Local DNS servers: typically operated by ISPs (performsiterative queries, caches responses)Stub resolvers: in every host (queries the local DNS server)dig (DNS query tool. Download, install and play with it).RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsAuthoritative Name Serversroot servers: A.ROOT-SERVERS.NET,B.ROOT-SERVERS.NET, · · · M.ROOT-SERVERS.NETedu name servers: a.gtld-servers.net., c.gtld-servers.net, .msstate.edu: ns1.msstate.edu, trantor.umd.edu,ns2.msstate.edu.cnn.com: twdns-01.ns.aol.com, twdns-02.ns.aol.com, .RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS Query and ResponseApplication (for example, browser) requires IP address ofgroklaw.netApplication makes a call to a stub resolver:gethostbyname(groklaw.net)Stub resolver checks in its cache.If A-type record for groklaw.net is found, gethostbyname()returns with the recordElse sends query to a local DNS server (LDNS)If LDNS has the answer in it’s cache it responds to stubresolver’s query.RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS Query and ResponseIf not found in cache, LDNS maskes iterative queriesLDNS sends a query “groklaw.net A” to a root serverRoot server sends a response with info regarding ANSs for netLDNS sends the query “groklaw.net A” to a net name server,and receives info regarding ANSs for groklaw.netLDNS sends a query “groklaw.net A” to the ANS and receivesthe desired response.LDNS (caches answer and) sends the response to the stubresolver, gethostbyname(groklaw.net) returns (recall hostentstructure returned by gethostbyname())RamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsDNS Query/Response FormatBoth query and response have the same formatFive mkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS ComponentsdigWindows: http://members.shaw.ca/nicholas.fong/dig/dig NS (query for root name servers)dig edu NSdig msstate.edu Adig msstate.edu NSRamkumarAL

Domain Name SystemE-mailWWWDNS RecordsDNS Componentsdig groklaw.netQUESTION SECTION:groklaw.net IN AANSWER SECTION:groklaw.net. 85090 IN A 152.46.7.105AUTHORITY:groklaw.net. 171431 IN NS ns.unc.edu.groklaw.net. 171431 IN NS ns2.unc.edu.ADDITIONAL:ns.unc.edu. 86335 IN A 152.2.21.1ns2.unc.edu. 86315 IN A 152.2.253.100RamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsE-MailRamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsBasic ComponentsMail clients and serversTwo types of clients and servers (sending and receiving)SMTP (simple mail transfer protocol) servers for sending mailIMAP/POP3 servers for making received mails accessible toclientsSMTP servers accept emails from sending clientsReceiving clients fetch email from IMAP/POP3 serversWeb based email services are also popular.RFC 822 specifies email formats (for sending to SMTPservers)RamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsRFC 822 HeaderRamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsRFC 822 Header - Other FieldsRamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsMIME ExtensionsOnly printable characters are permitted in RFC 822 format.MIME - for Content description and encodingContent transfer encoding — usually base-64 encoding.RamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsRFC 822 Header MIME ExtensionsRamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsMIME TypesRamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsSMTP - Simple Message Transfer ProtocolTCP, port 25Supported commandsHELPHELOMAIL FROMRCPT TODATARamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsSMTP RestrictionsMax Message length - 64 KBRecursive mailing listsESMTP (Extended SMTP)New command EHLO - if not accepted, defaults to SMTP.RamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsSending an EmailTo send an Email to xyz@somewhere.comWhat is the mail server for somewhere.com?Make a DNS query for (somewhere.com, MX )e.g.,“somewhere.com, 82345, IN, MX, mail.something.net”Make DNS query for (mail.something.net, A) to determine IPaddress of mail servere.g. response ,“mail.something.net,3245, IN, A, 132.6.7.234 ”Connect to SMTP server (port 25) at IP address 132.6.7.234.use “RCPT TO: xyz” to check if xyz is a valid address in thedomain somewhere.comsend Email in RFC 822 format.RamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsFetching EmailsPOP3IMAPWebmailRamkumarAL

Domain Name SystemE-mailWWWMessage TransferFetching EmailsMail Transfer ctionUseragentUser'sPC

Domain Name SystemE-mailWWWMessage TransferFetching EmailsPOP3 / IMAPPOP - Post Office Protocol - RFC 1939POP3 commands - USER, PASS, LIST, RETR, DELE, QUITIMAP - Internet Message Access Protocol - RFC 2060Complex, partial message downloadsMS Exchange server, GroupWise, SimbraRamkumarAL

Domain Name SystemE-mailWWWWWWRamkumarAL

Domain Name SystemE-mailWWWA Good TutorialHTTP Made Really Easyhttp://www.jmarshall.com/easy/HTTP/RamkumarAL

Domain Name SystemE-mailWWWGETTo fetch a page from cse.msstate.edu perform DNS query todetermine IP address.Connect to port 80 and send a HTTP query.GET / HTTP/1.1\r\nHost: cse.msstate.edu\r\nUser-Agent: eep-Alive: 300\r\nConnection: keep-alive\r\n\r\nFirst two lines are mandatory in every request.Why is second line (Host:) mandatory? — Multiple websites maybe hosted in a single machine (same IP and port).RamkumarAL

Domain Name SystemE-mailWWWHeader in HTTP ResponseHTTP/1.1 200 OKDate:Server:ApacheX-Powered-By:PHP / OpenSSLKeep-Alive:timeout 15Connection: marAL

Domain Name SystemE-mailWWWHTTP Status codesRamkumarAL

Domain Name SystemE-mailWWWHTTP Request MethodsRamkumarAL

Domain Name SystemE-mailWWWHTTP HeadersRamkumarAL

Domain Name SystemE-mailWWWURLs - Uniform Resource LocatorsRamkumarAL

Domain Name SystemE-mailWWWStatic vs Dynamic HTMLScripting LanguagesServer-side scripting - CGI, perl, PHP, PythonClient-side scripting - JavascriptOther client side approaches - Applets, ActiveXRamkumarAL

The response is a value corresponding to the name and type . Simple Message Transfer Protocol TCP, port 25 Supported commands HELP HELO MAIL FROM RCPT TO DATA Ramkumar AL. Domain Name System . HTTP Status codes Ramkumar AL. Domain Name System E-mail WWW HTTP Request Methods Ramkumar AL. Domain Name System