分享
Chapter7+the+application+layer.ppt
下载文档

ID:3489030

大小:11.64MB

页数:149页

格式:PPT

时间:2024-05-09

收藏 分享赚钱
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,汇文网负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
网站客服:3074922707
Chapter7 the application layer
Chapter 7 The Application Layer,College of Computer Science Chongqing University,Contents,7.1 DNS 7.2 E-Mail 7.3 FTP 7.4 the World Wide Web 7.5 Multimedia,7.1 DNS-The Domain Name System,IP Addresses are great for computersIP address includes information used for routing.IP addresses are tough for humans to remember.IP addresses are impossible to guess.ever guessed at the name of a WWW site?,Why Hostnames,server,Before there was DNS.,.there was the HOSTS fileBefore DNS(until 1985),the name-to-IP address was done by downloading a single file(hosts.txt)from a central server with FTP.Names in hosts.txt are not structured.The hosts.txt file still works on most operating systems.It can be used to define local names.,12306 host,C:WINDOWSsystem32driversetchosts,Resolver and name server,An application program on a host accesses the domain system through a DNS client,called the resolverResolver contacts DNS server,called name server DNS server returns IP address to resolver which passes the IP address to applicationReverse lookups are also possible,i.e.,find the hostname given an IP address,Design principle of DNS,The naming system on which DNS is based is a hierarchical and logical tree structure called the domain namespace.An organization obtains authority for parts of the name space,and can add additional layers of the hierarchyNames of hosts can be assigned without regard of location on a link layer network,IP network or autonomous system In practice,allocation of the domain names generally follows the allocation of IP address,e.g.,All hosts with network prefix 128.143/16 have domain name suffix virginia.eduAll hosts on network 128.143.136/24 are in the Computer Science Department of the University of Virginia,7.1 Domain Name Space,CQU DNSIP,202.202.1.3(202.202.0.35)202.202.0.36(202.202.0.26)202.202.1.41(202.202.1.42)202.202.5.145(222.198.128.35),DNS hierarchy can be represented by a tree Root and top-level domains are administered by an Internet central name registration authority(ICANN)The tree can have only 128 levels:level 0(root)to level 127.Below top-level domain,administration of name space is delegated to organizationsEach organization can delegate further,DNS Name hierarchy,7.1 Domain Name Space,7.1 Domain Name Space,Each node in the DNS tree represents a DNS nameEach branch below a node is a DNS domain.DNS domain can contain hosts or other domains(subdomains)Example:DNS domains are.,edu,virginia.edu,cs.virginia.edu,7.1 Domain Name Space,7.1.1 Domain Name Space,A domain is a subtree of the worldwide naming tree.,7.1.1 Domain Name Space,Hosts and DNS domains are named based on their position in the domain treeEvery node in the DNS domain tree can be identified by a unique Fully Qualified Domain Name(FQDN).The FQDN gives the position in the DNS tree.A FQDN consists of labels(“cs”,“virginia”,”edu”)separated by a period(“.”)There can be a period(“.”)at the end.Each label can be up to 63 characters longFQDN contains characters,numerals,and dash character(“-”)FQDNs are not case-sensitive,7.1.2 Top-Level Domains,Conceptually,the top-level names permit two independent naming hierarchies:geographicorganizational,An organization can choose which way it wants to be known.In the US we mostly see the organizational structuree.g uab.edunot uab.al.usOther countries often use the geographic hierarchye.g.bham.ac.uk for the University of Birmingham(England).,For the geographic scheme each country has a two-letter codee.g.us for United States Beneath this top level there are second-level domains for each state,e.g.al.us,edu,gov,com,net,org,mil,Countries each have a top level domain(2 letter domain name).cn,uk,ca,jpNew top level domains include:.aero.biz.coop.info.name.pro,7.1.2 Top-Level Domains,Distributed DatabaseThe organization that owns a domain name is responsible for running a DNS server that can provide the mapping between hostnames within the domain to IP addresses.So-some machine run by RPI is responsible for everything within the rpi.edu domain.,7.1.3 Distribution of Name Space,The information contained in the domain name space must be stored.it is very inefficient and also unreliable to have just one computer store such a huge amount of information.,7.1.3 Distribution of Name Space,The resolution of the hierarchical name space is done by a hierarchy of name serversEach server is responsible(authoritative)for a contiguous portion of the DNS namespace,called a zone.Zone is a part of the subtreeDNS server answers queries about hosts in its zone,7.1.3 Distribution of Name Space,Each zone is anchored at a specific domain node,but zones are not domains.A DNS domain is a branch of the namespaceA zone is a portion of the DNS namespace generally stored in a file(It could consists of multiple nodes),rpi.eduDNS DB,rpi.eduDNS DB,There is one primary server for a domain,and typically a number of secondary servers containing replicated databases.,rpi.eduDNS DB,Authoritative,rpi.eduDNS DB,Replicas,rpi.edu DNS server,7.1.3 Distribution of Name Space,The root name servers know how to find the authoritative name servers for all top-level zones.There are only 13 root name serversRoot servers are critical for the proper functioning of name resolution,Root name servers,7.1.3 Distribution of Name Space,CN域名遭史上最大规模攻击,Addresses of root servers,A.ROOT-SERVERS.EDU.(formerly NS.INTERNIC.NET)10.0.2.32A.ROOT-SERVERS.NET.(formerly NS1.ISI.EDU)198.41.0.4B.ROOT-SERVERS.NET.(formerly C.PSI.NET)128.9.0.107C.ROOT-SERVERS.NET.(TERP.UMD.EDU)192.33.4.12D.ROOT-SERVERS.NET.(NS.NASA.GOV)128.8.10.90E.ROOT-SERVERS.NET.(NS.ISC.ORG)192.203.23F.ROOT-SERVERS.NET.(NS.NIC.DDN.MIL)192.5.5.241G.ROOT-SERVERS.NET.(AOS.ARL.ARMY.MIL)192.112.36.4H.ROOT-SERVERS.NET.(NIC.NORDU.NET)128.63.2.53I.ROOT-SERVERS.NET.(at NSI(InterNIC)192.36.148.17J.ROOT-SERVERS.NET.(operated by RIPE NCC)198.41.0.10K.ROOT-SERVERS.NET.(at ISI(IANA)193.0.14.129 L.ROOT-SERVERS.NET.(operated by WIDE,Japan)198.32.64M.ROOT-SERVERS.NET.202.12.27.33,7.1.3 Distribution of Name Space,7.1.4 Resolution,There are two types of queries:Recursive queries递归Iterative(non-recursive)queries迭代The type of query is determined by a bit in the DNS queryRecursive query:When the name server of a host cannot resolve a query,the server issues a query to resolve the queryIterative queries:When the name server of a host cannot resolve a query,it sends a referral to another server to the resolver,Recursive resolution,7.1.4 Resolution,Iterative resolution,7.1.4 Resolution,7.1.4 Resolution,Caching,To reduce DNS traffic,name servers caches information on domain name/IP address mappingsWhen an entry for a query is in the cache,the server does not contact other serversNote:If an entry is sent from a cache,the reply from the server is marked as“unauthoritative”,7.1.4 Resolution,Resource Records,The database records of the distributed data base are called resource records(RR)Resource records are stored in configuration files(zone files)at name servers.Left Resource records for a zone:,7.1.4 Resource Records Of DNS,A resource record is a five-tuple.,7.1.4 Resource Records Of DNS,A portion of a possible DNS database for cs.vu.nl.,7.1.4 Resolution,Max.age of cached data in seconds,*Start of authority(SOA)record.Means:“This name server is authoritative for the zoneM”*PC is the name server*is the email address of the person in charge,Name server(NS)record.One entry for each authoritative name server,Address(A)records.One entry for each hostaddress,Resource Records,7.1.5 DNS Messages,DNS has two types of messages query and response.Both types have the same format.The query message consists of a header and question records;the response message consists of a header,question records,answer records,authoritative records,and additional records.,7.1.5 DNS Messages,Header format,Flags field,7.1.5 DNS Messages,Header format,Flags field,QR:Query=0,Response=1AA:Authoritative AnswerTC:response truncated(512 bytes)RD:recursion desiredRA:recursion availablercode:return code,7.1.5 DNS Messages,Values of rCode,Recursion,A request can indicate that recursion is desired-this tells the server to find out the answer(possibly by contacting other servers).If recursion is not requested-the response may be a list of other name servers to contact.,7.1.5 DNS Messages,Question Format,Name:domain name(or IP address)Query type(A,NS,MX,)Query class(1 for IP),7.1.5 DNS Messages,Response Resource Record,Domain NameResponse type Class(IP)Time to live(in seconds)Length of resource data Resource data,7.1.5 DNS Messages,UDP&TCP,Both UDP and TCP are used:TCP for transfers of entire database to secondary servers(replication).UDP for lookupsIf more than 512 bytes in response-requestor resubmits request using TCP.,7.1.5 DNS Messages,Contents,7.1 DNS 7.2 E-Mail 7.3 FTP 7.4 the World Wide Web 7.5 Multimedia,7.2.1 Architecture,To explain the architecture of e-mail,we give four scenarios.We begin with the simplest situation and add complexity as we proceed.The fourth scenario is the most common in the exchange of e-mail.,First scenario,When the sender and the receiver of an e-mail are on the same mail server,we need only two user agents.,7.2.1 Architecture,Second scenario,When the sender and the receiver of an e-mail are on different mail servers,we need two UAs and a pair of MTAs(client and server).,7.2.1 Architecture,Third scenario,When the sender is connected to the mail server via a LAN or a WAN,we need two UAs and two pairs of MTAs(client and server).,7.2.1 Architecture,Fourth scenario,When both sender and receiver are connected to the mail server via a LAN or a WAN,we need two UAs,two pairs of MTAs(client and server),and a pair of MAAs(client and server).This is the most common situation today.,7.2.1 Architecture,7.2.2 Format of an email,RFC 822 header fields related to message transport.,7.2.2 Format of an email,E-mail address,7.2.2 Format of an email,The first component of an electronic mail system is the user agent(UA).It provides service to the user to make the process of sending and receiving a message easier.Some examples of command-driven user agents are mail,pine,and elm.Some examples of GUI-based user agents are Eudora,Outlook,And Netscape.,7.2.3 User Agent,The actual mail transfer is done through message transfer agents(MTAs).To send mail,a system must have the client MTA to receive mail,a system must have a server MTA.The protocol that defines the MTA client and server in the Internet is called Simple Mail Transfer Protocol(SMTP).,7.2.4 Message Transfer Agent,Commands and responses,SMTP uses TCP/IP port 25.,7.2.4 Message Transfer Agent,7.2.4 Message Transfer Agent,Connection establishment,7.2.4 Message Transfer Agent,Message transfer,7.2.4 Message Transfer Agent,Connection termination,7.2.4 Message Transfer Agent,POP3 IMAP4,7.2.5 Message Access Agent,POP,Short for Post Office Protocol,a protocol used to retrieve e-mail from a mail server.Most e-mail applications(sometimes called an e-mail client)use the POP protocol,although some can use the newer IMAP(Internet Message Access Protocol).There are two versions of POP.The first,called POP2,became a standard in the mid-80s and requires SMTP to send messages.The newer version,POP3,can be used with or without SMTP.POP3 uses TCP/IP port 110.,7.2.5 Message Access Agent,Pop3,7.2.5 Message Access Agent,IMAP,Internet Message Access Protocol.It is a method of accessing electronic mail messages that are kept on a possibly shared mail server.In other words,it permits a client email program to access remote message stores as if they were local.For example,email stored on an IMAP server can be manipulated from a desktop computer at home,a workstation at the office,and a notebook computer while travelling,without the need to transfer messages or files back and forth between these computers.IMAP uses TCP/IP port 143.,7.2.5 Message Access Agent,POP3 vs IMAP,With IMAP,all your mail stays on the server in multiple folders,some of which you have created.This enables you to connect to any computer and see all your mail and mail folders.In general,IMAP is great if you have a dedicated connection to the Internet or you like to check your mail from various locations.With POP3 you only have one folder,the Inbox folder.When you open your mailbox,new mail is moved from the host server and saved on your computer.If you want to be able to see your old mail messages,you have to go back to the computer where you last opened your mail.With POP3 leave mail on server only your email messages are on the server,but with IMAP your email folders are also on the server.,7.2.5 Message Access Agent,Electronic mail has a simple structure.Its simplicity,however,comes with a price.It can send messages only in NVT 7-bit ASCII format.In other words,it has some limitations.Multipurpose Internet Mail Extensions(MIME)is a supplementary protocol that allows non-ASCII data to be sent through e-mail.MIME transforms non-ASCII data at the sender site to NVT ASCII data and delivers it to the client MTA to be sent through the Internet.The message at the receiving site is transformed back to the original data.,7.2.6 MIME Multipurpose Internet Mail Extensions,MIME header,7.2.6 MIME Multipurpose Internet Mail Extensions,RFC 822 headers added by MIME,7.2.6 MIME Multipurpose Internet Mail Extensions,The MIME types and subtypes defined in RFC 2045,7.2.6 MIME Multipurpose Internet Mail Extensions,Base64 encoding converts 3 octets into 4 encoded characters.The Base64 index table:,7.2.6 MIME Multipurpose Internet Mail Extensions,E-mail is such a common application that some websites today provide this service to anyone who accesses the site.Three common sites are Hotmail,Yahoo,and Google.The idea is very simple.Let us go through two cases:,7.2.7 Web-Based Mail,Case 1,7.2.7 Web-Based Mail,Case 2,7.2.7 Web-Based Mail,Contents,7.1 DNS 7.2 E-Mail 7.3 FTP 7.4 the World Wide Web 7.5 Multimedia,7.3 FTP-File Transfer Protocol,File Transfer Protocol(FTP)is the standard mechanism provided by TCP/IP for copying a file from one host to another.some problems must be dealt with first.two systems may use different file name conventions.Two systems may have different ways to represent text and data.Two systems may have different directory structures.All of these problems have been solved by FTP in a very simple and elegant approach.,7.3.1 Architecture,FTP uses the services of TCP.It needs two TCP connections.The well-known port 21 is used for the control connection the well-known port 20 for the data connection.,7.3.1 Architecture,Opening the control connection,7.3.1 Architecture,Creating the data connection,7.3.1 Architecture,Using the control connection,7.3.1 Architecture,Using the data connection,7.3.1 Architecture,Command processing,7.3.2 Commands,7.3.2 Commands,7.3.2 Commands,7.3.2 Commands,

此文档下载收益归作者所有

下载文档
你可能关注的文档
收起
展开