Está en la página 1de 10

Computer Networking a Top-Down Approach Featuring the Internet

Chapter 2 Application Layer


Network applications are the raisons dtre of a computer network. A network application is the reason the network exists. If there is no application, no need to provide the network protocol to support him. In this chapter, the first study including the application layer protocol, client / server model, processes, network applications such as transport layer interface, the basic concepts, and learning, including Web, email, DNS and P2P file-sharing and other network applications; Finally, we will learn web application development, a simple client / server applications. 2.1 Principles of Network Applications How to create Web applications? Web application development is the core of the preparation of client systems running on different programs and implements the interaction between applications using the Internet to communicate. For example, Web-based applications, including the need to communicate with each other two parts, one running on the Host on the browser, the other is running on the Web Server Host Web Server process. Developments of network applications, developers need to create more than one Host to run the software on, but without create on the run in Network-core software. Internet is a network application to provide a communications infrastructure. Network core devices, including switches and routers, and did not realize the transport layer and above the layer functions. The greatest advantage of facilitating the deployment of applications, or you needs to create network applications in the network core devices, so that almost impossible. 1. Application architectures Development of network applications, need to decide what kind of application architecture, the application framework. Note, the application of different structure and network architecture. From the application developer's perspective, the network architecture is fixed and the application to provide specific services. The application structure, application developers decided by the network, its function is to determine the application on the client system in a different form of organization. The current structure of commonly used applications, including: client / server, P2P, Hybrid of C / S and P2P three. 1.1 Client-Server architecture There is a client-server model, always-on host; called server (server) is called the client to provide services for multiple Hosts that sent the request of clients to respond. Server generally has a permanent, well-known address. Client can intermittently start / connections. Client / Server system management benefits are easy, the problem is the system bottleneck Server easily become a bottleneck. 1.2 Pure P2P architecture P2P, none of the C / S at the center of the Server, all the Host of equal status, called Peers, so this system is also called Peer to Peer. P2P is not to be always on the server, and peer could be replaced at any time their IP. Pure P2P Gnutella is a good example. The greatest benefit is the P2P system scalability (scalability) strong. Since each peer is both a Server and Client, with the growing number of Peer system, the system's processing power is stronger. P2P problem is manageable, because the system is completely decentralized, non-centered, and extremely difficult to manage. 1.3 Hybrid of client-server and P2P Napster in early 1999 by a 18-year-old Northeastern University student Shawn Fanning developed by the exchange of MP3 music, software and computer industries were set off in P2P computing technologies (Peer-To-Peer Computing) of the wave. However, in December 1999, Napster was the traditional music industry then rebound to copyright infringement and damages caused by the recording industry sued the
By Dr. Mohammad Ali 1

ground, music industry representatives, including Sony (Sony), Arts EMI (EMI), Warner (Warner), Universal (Universal), Bertelsmann (BMG), and the American recording industry Association (Recording Industry Association of America), in July 2000, District Court Judge Marilyn Patel of the sanctions, the making of the Napster injunction to suspend Napster's service. In December 1999, including Warner, BMG, one hundred Dai, Sony, Universal, including the five major record companies sued Napster for copyright infringement record companies. ? Napster feature is that it addresses itself only MP3 files, directories and indexes, all of the songs are actually stored in the user's personal computer. 2. Processes communicating As mentioned earlier, the network application is running on a different Host program and with the communication between networks. Here we are discussing is how to achieve different communication problems between the Host application. Operating system is actually a process to communicate, and process refers to the host running a program. In the same host in the communication between different processes by the operating system is responsible for defining the IPC; such as: windows message mechanism; pipeline; semaphore; shared storage area and so on. Processes in different host communication between the content of our study is, inter-process communication via message passing to achieve. 2. 1 Client and Server Process Web application composition process by the pairs of these processes to send messages to each other through the network (message). Usually a pair of mutual communication process, a process called a Server; the other is called the Client process. 2.2 Sockets Most applications include more of the communication process by sending a message between each other to communicate. Message passing between processes need to rely on the underlying network to complete the process to send a message to the network, receiving messages from the network are achieved through the Socket. Socket transport layer is the application layer and the interface between, also known as API (Application Programming Interface, Application Programming Interface). Process as a house, Socket house like the door. The development of network applications, developers can layer on the side of the Socket in the application full control, but only in the transport layer on the side of the Socket to a certain degree of control, including the choice of transport protocol, to determine some of the transport layer parameters, such as the maximum buffer, the maximum segment length and so on. The early 1980s, the U.S. government's Advanced Research Projects agency (ARPA) to the University of California, Berkeley, has provided funding to enable them to achieve the UNIX operating system TCP / IP protocol. In this project, researchers for the TCP / IP network communications developed an API (application programming interface). This API is called Socket interface (socket). Today, SOCKET interface is a TCP / IP network of the most common API, but also on the INTERNET for the most common application development API. The early 1990s, the other by Microsoft co-developed a set of several companies under WINDOWS common network programming interface, which Windows Sockets specifications. It is important Berkeley Sockets expansion, mainly to increase the number of asynchronous functions, and adds features to meet the Windows message-driven asynchronous network events selection mechanism. WINDOWSSOCKETS specification is an open, multi-protocol support for network programming under Windows interface. Version 1.0 from 1991 to 1995 2.0.8 version, through continuous improvement and Intel, Microsoft, Sun, SGI, Informix, Novell and other companies with the full support of Windows network programming has become the de facto standard. At present, the practical applications of the WINDOWSSOKCETS norms are 1.1 and 2.0. The most important difference between the 1.1 versions only supports TCP / IP protocol, and version 2.0 can support multiple protocols. Version 2.0 has a good backward compatibility, any use of version 1.1 of the source code, binary files, and applications without modification to the 2.0 specification to use. 2.3 Addressing processes Process addressing: the process of the message sender when sending a message to the process with the purpose of the message identifier. Therefore, the process needs to be prepared.
By Dr. Mohammad Ali 2

Each Host Internet has a unique IP address, because each host may run more than one process; use the IP address as the identifier of the process is not sufficient. Process identifiers need to include two effects: 1, where the only run to determine the Process Host, use the IP address can be achieved. 2, the only running on to determine the Host Process. Port Number can be used to achieve. Each message contains the port number used to identify the application process to receive messages. 3. App-layer protocol Host with each other through message passing between the communication between communicating parties in order to be able to understand the meaning of the message, the message needs to be structured, need to define the meaning of the message, need to define when to send the message, etc. What the agreement. This is the agreement of three elements: syntax, semantics, and synchronization. Therefore, the application layer protocol is responsible for defining the following: 1, the message type. 2, the message syntax: the structure of the message. 3, the message semantics: the meaning of the message. 4, when and how to send messages, and respond to the message. 4. What transport service does an app need? Application process and the transport layer socket is the interface between the client applications will send a message through the socket to the transport layer, the receiver using socket transport layer message to the application process. According to the network architecture, communication between the applications depends on the underlying transport layer services. Transport layer provides a variety of services, protocols, there are many, the application should be selected according to their needs when the service or transport layer protocol. Overall, we will demand the application is divided into three areas: bandwidth, data loss rate, delay. 5. Internet services The Internet, there are two transport layer protocols, TCP and UDP, the development application should first select one. TCP provides services: 1, connection-oriented services: client and server processes in a formal transfer of data, you must establish a connection. After connection is established, the socket client and server processes exist between Connections. TCP connection is full-duplex (full duplex), that client and server processes can simultaneously send data. Using connection-oriented services, applications knot Beam connections must be removed. 2, reliable transport services: TCP provides a reliable, accessible transport services in sequence. The data source can certainly send sequence arrives, there will not be lost. 3, Congestion control: TCP congestion control is not necessarily provided for the inter-process communication provides a number of benefits for the entire Internet is a greater significance. The basic principle is that the network is congested or blocked the suppression of the data source to send. TCP provides congestion control for the entire network is a good thing, but for some applications, however, created The damage, especially audio and video applications, congestion control, these applications may be less than the transmission speed of the minimum required bandwidth, thus causing harm to the quality, and these should be Use of packet loss may be less sensitive. Therefore, these real-time applications more suitable for use UDP, not TCP. TCP problems: 1, cannot guarantee minimum bandwidth: Due to congestion control, the application of any rate there is no way to send data, the rate may be sent to a lower rate to send data; 2, there is no delay to ensure that: TCP application data to ensure the final destination in sequence, but the delay experienced by packets is no way to make any guarantee. WWW sometimes called World Wide Wait. UDP Services provided: UDP is a connectionless, lightweight transport protocol, providing most health services model. Not connected, it should be intuitively more efficient than TCP.

By Dr. Mohammad Ali

1, no reliable data transmission: Data Push into the sender after the UDP Socket, UDP does not guarantee that data will eventually reach the receiver, even if the arrival sequence is not guaranteed to arrive; 2, there is no congestion control mechanism: the sender can order any rate to send data to the network, regardless of network congestion conditions. But the data may be sent from reaching the final recipient, production Health and packet loss. As the real-time applications in general can hold a certain percentage of packet loss within, so, UDP is a better relative to TCP transport layer protocol. 2.2 The Web and HTTP Early Internet (ARPANET) mainly for the military, education and scientific research fields, not for the public to understand this situation until after the 1991 WWW appear to be completely changed. WWW is the Internet to the public, making the Internet has become the world's largest, most influential data network. WWW and E-mail together, profoundly changed the way we live and work. Therefore, WWW and Email and become early Killer-Application. With telephone, radio and other communication technologies different, WWW to provide a On-demand service, the user can decide what time to view what. In addition, WWW's ease of use, strong, almost no learning can learn to use search engines to surf between different sites for a variety of information. Web is the core of HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol). HTTP implementation consists of two parts, namely client and server, the exchange between HTTP Message. As mentioned earlier talking about the contents of the application layer protocol, as mentioned, HTTP main provisions of the message structure and message of the client and server exchange method. Web page contains one or more objects, the object can be a basic HTML file, JPEG image, Java Applet, Audio / Video and so on. Base URL of the HTML document through an object to reference them. 1. Overview of HTTP HTTP protocol, the main provisions of the browser how to send the Server a request to a Web page and the Server how to transfer the requested page to the Browser Message structure and message delivery, as shown. HTTP using a transport layer of the TCP protocol for data transmission. 1) Browser first establishes a TCP connection with the Server 2) After the connection is established, browser and server on to / from the Socket to send / receive HTTP messages. With the TCP reliable data transfer, HTTP knows the message will definitely reach the other side, this is the agreement the benefits of layering. HTTP is a stateless (stateless) protocol; server does not save any state information to any client. If the server in a very short period of time from the browser receives two requests for an object, server will send the two responses. 2. HTTP connections HTTP uses TCP connections including Nonpersistent and Persistent types. By default, HTTP the browser and server use persistent connections, but may also be configured to use non persistent connections. 1, non-persistent connections: to establish a TCP connection, browser and the server through this connection only transmits a request message and a respond message 2, persistent connection: establish a TCP connection, browser and the server through this connection to transfer multiple request messages and respond more news 2.1 Non-Persistent HTTP: Response time modeling RTT (Round Trip Time, round-trip time): refers to the browser sends a small packet from the beginning to the server to answer a little time to respond the message location. RTT, including: packet propagation delay, queuing delay, processing delay, propagation delay and some other. Note, here to calculate total time TCP connection is established using the piggyback (incidentally confirmed), that is, establishing a TCP connection handshake with the third request message sent from the Client together the. Back-of-the-envelope estimation: a rough estimate, not precisely derived.
By Dr. Mohammad Ali 4

2.2 Persistent HTTP connection Ongoing work of HTTP, there are two types: 1, no assembly line method of continuous connection: that is not parallel persistent connections, that is only a request to respond the current message is sent after receiving a request under 2, continuous line to connect the way: When the browser in the analysis of base HTML file, met on the issue of a referenced object request message, send the request message regardless of the respond before the message is reached. The default is to work HTTP/1.1 Persistent with pipelining. 3 HTTP Message format: 3.1 request HTTP protocol specification (RFC2616) message format for HTPP defined, the message there are two types, namely Request and Respond message. 1, HTTP message is encoded as ASCII 2, HTTP message contains multiple lines, between lines with a Carriage Return + Line Feed Split 3, the first line is called the request line, the other below the line is called Head line: 1) Request line: There are three fields: method field, URL field, and Version fields. Method can be GET, POST and HEAD, usually as a GET. When an object request to the Server Browser usually use GET, the object to the requested URL identifier. Field gives the version number used by the HTTP protocol version number. 2) Head line: Host line: specify where the object is requested Host Address / Domain Name: Because you can use the Browse Proxy, Host line is necessary. Connection line: If the value is close indicates Server in sending the requested object and close the TCP connection, that connection nonpersistent of; If the Keep-Alive Server using Persistent mode is instructed. User-agent: Browser instructions to send the request message type. Mozilla is Netscape Navigator browser start the internal name, derived from Mosaic and Godzilla Composed of two words, meaning Mosaic Terminator. Take advantage of this Head Line, Server Browser can provide the type of personalized service. Accept-language: Customers are more willing to receive the specified Object language version. 3.1 Method types supported HTTP/1.0 only supports including GET, POST and HEAD, including three Method. In addition to these three method HTTP/1.1, the PUT and DELETE added two methods: 1, PUT method: the request entity body of the message object contains more than upload to the server specified by a URL where to go, usually used in Web publishing applications. 2. DELETE: Remove Server from the URL specified in the file / object. 3.2 HTTP Response Message Response message includes three parts: 1, status line: including version, status code, corresponding status information and other three domains. 2, headlines: 1) Connection line: close refers to the Server in sending the requested object will close the TCP connection keep-alive means sending the requested Server in the Object remain after a TCP connection 2) Data Bank: Server time creating respond message 3) Server line: Server basic information 4) Last-Modified: the sending object is created or last modified time, and the Web Cache 5) Content-Length: The length of the sending object, in units of byte 6) Content-type: the type of object being sent. 3, entity body: contains the requested object Respond to support the HTTP protocol there are many, many news Head Line 4 User-server Interaction: cookies HTTP is a stateless protocol, which is conducive to the design and implementation of highperformance Web server. However, sometimes Server hopes to identify the user and, based on user identity
By Dr. Mohammad Ali 5

to provide personalized services, or restrict access to users, hence the use of technology to the Cookie. The use of Cookie, Server can track user actions. Cookie defined as follows: Cookie is stored on a Web server on the user's hard drive section of the text; Cookie allows a Web site stored on a user's computer to retrieve information and followed it. Pieces of information to 'name / value' of the (name-value pairs) in the form of storage. Keeping state Client first visit to a Web Server, send the usual, the Request message does not contain a cookie; Server for the client to create a cookie, in the response message using Set-cookie line to return to the client, and record in their own back-end database; Client Server records in the file returned Cookie, in the subsequent request message sent to Server contains the Cookie line. The main purpose of the use of Cookie tracking users, including user authorization, online shopping, product / advertising recommendations, user session state, etc. Cookie is convenient, but also triggered a relatively strong opposition to an invasion of privacy. Cookie may contain more personal information, including user names, passwords, surfing habits and other very personal information that access by third parties may be used for commercial purposes after, resulting in a violation of personal privacy. Such as the HTML page banner ads, may be images, animations, etc., need to use browser Request message from the server to read the company's advertising, advertising company may be a large number of sites provide this service, so the advertising company may use the data to user access to different sites to get used to / track information, and information involving personal privacy. 5 Web Caching Web Cache (Web Cache), also called a proxy server, and located between the client and server to replace the Server responds to Client's Request. Client's Browser can be configured to use a proxy server to the Server Request message is sent to all first shift Proxy Server. At this point, Browser and Proxy Server to establish a TCP connection rather than the Server. When the Proxy Server has the requested object, Proxy Server Response Client; When Proxy Server is no object when requested, Proxy Server to request the original Server Object, forwarded to the Client at the same time, a local by Cache. Web Cache is both a Server, is Client. Upon receipt of Client's request, and the object being requested, to the Client sends a response, this time with a Server functionality; If the requested object, the original Server needs to send a Request message, then Web Cache is the Client. Server Web Cache closer than the Client, even if only from the delay will also reduce service response time; Web Cache installation locally, you can effectively reduce the access link through the Traffic (traffic). Suppose, a user unit 100, each user access www.sina.com.cn. If Web Cache, the flow through the access link is 100; using Proxy, Proxy, when the first user does not access the response object, Proxy request to www.sina.com.cn, when another user requests has been saved Proxy www.sina.com.cn page, you no longer need to request from the www.sina.com.cn, the flow through the access link becomes 1, the other 99 units of flow in the internal network. 2.3 File Transfer ProtocolFTP FTP: the file transfer protocol In a typical FTP session, the user to use FTP to download files from a remote host or upload files to the remote host. As shown, the user via FTP User Agent to interact with FTP. Users need to provide the address of the remote host; FTP Client to establish a TCP connection with the remote host; Users and other authorized User Name and Password for the Server to verify the information; Validated, the user can download files from Server to Server or upload files. FTP: separate control, data connections Like FTP and HTTP is the File Transfer Protocol, runs on top of TCP. But has a very clear distinction between the two: 1, FTP Control, and Data using two connections to complete the file transfer. 1), Control Connection: Client and Server used to send control information between, such as user ID, password, command, etc. 2), Data Connection: the actual file transfer is done through the Data Connection.
By Dr. Mohammad Ali 6

2, FTP in, Control connection Persistent, and is Non-Persistent Data connection, and can only transfer a file. FTP is a stateful protocol, that is, for each FTP Server to maintain session information, including the current directory, and account number. Because Server need to maintain state, an FTP server supports received a limited number of concurrent users. Use a separate FTP Control connection to transmit control information of the method is called Out of Band (band mechanism), and HTTP connection using a control information and data sharing in a way is called In Band (in-band mechanism). Out-of-band using the benefits of control and data information transfer as much as possible independently of each other. The establishment of data connections in two ways: 1, PASV (passive mode): Server informs client data ports open on their own information, passively waiting for customers to connect 2, PORT (active): The client tells the server to open the data port on their own information, the server actively connected client. 2.4 Electronic Mail in the Internet Introduction 2, Mail server: e-mail server is the core of the system. Email account is the user's Mail Server in a Mailbox, mailbox stores to the user's information. In addition, to maintain a mail server outgoing mail queue to temporarily store the mail is not sent. 3, SMTP: Simple Mail Transfer Protocol, e-mail application-layer protocol. SMTP uses TCP at the sender's and recipient's Mail Server Mail Server to establish a connection between the transmission e-mails. SMTP is also based on Client / Server structure, each mail server acting as both a Client and Server roles. Send mail Server is called the SMTP Client, Mail Server to receive mail called SMTP Server. 1. SMTP [RFC 2821] SMTP Mail Server in between sending and receiving e-mail using SMTP transport, SMTP is the Internet's first application layer protocol and is therefore left with some archaic features such as message body and message header with 7-bit ASCII encoding. Such a code for the communication link bandwidth shortage in the online early is reasonable, but for now email support for multimedia messages, video messages, especially the use of binary 7-bit ASCII encoding is very unfavorable. 1. SMTP operation SMTP protocol at the sender and the recipient Mail Server Mail Server TCP connection established between the ends, generally without resorting to the middle of the Mail Server. If the receiving Mail Server does not start correctly, the mail message in Mail server of the sender waiting queue, rather than waiting in the middle of a mail server. Sample SMTP interaction SMTP transmission of a message as follows: 1, Client SMTP Server SMTP establish the Port: 25 TCP connections; 2, Client SMTP Server SMTP between the application and the level of Handshaking operation, Client Server describes the message to the sender and the recipient's email address; 3, the reliable transmission over TCP all messages sent to the Server 4, close the TCP connection SMTP uses persistent TCP connection. 3.1 Mail message format E-mail message format in the header line is part of the message, and the SMTP handshake command is part of the agreement. Constructed by the user e-mail message format, and delivers the message to your own mail server. Mail server to extract relevant information from the mail, use SMTP handshake command associated with the receiving mail server to establish a TCP connection to transfer messages. 3.2 multimedia extensions for non ASCII data E-mail messages using SMTP requires 7-bit ASCII encoding, if the transmission of multimedia data via e-mail, or binary data, this restriction problem. Therefore, in order to transmit multimedia information in
By Dr. Mohammad Ali 7

the mail, the sender needs to include in the message header in the other's head. MIME multimedia messages in two important mail headers are: 1, Content-Type: User Agent receiving this message contains the type of information, such as image / jpeg, etc., so that the recipient calls the appropriate procedures for processing; 2, Content-Transfer-Encoding: notify the recipient of a message has been encoded with the way the ASCII code for the receiver to decode the message. Base64 is currently the most widely used code; it will encode the binary data of letters and numbers. Because the number of letters and numbers less than 256, so it is the 3 bytes of binary data into 4 bytes of the letters and numbers. Base64 encoding is designed to put an arbitrary sequence of 8-bit byte cannot easily be described as a form of direct recognition. Base64 encoding requires the three 8-bit bytes (3 * 8 = 24) into four 6-bit bytes (4 * 6 = 24), followed by six in front of each fill two 0, the formation of 8-bit the form of a byte (i.e. three bytes to four bytes, high byte two of these four are 0), the new value of each byte in the form [0,63] between the total 64 different encoding, use base64 alphabet to find the value of this byte, each byte is encoded as the corresponding character. Why use Base64 encoding? The main problem of the designer to consider include: 1. is encrypted? 2. Encryption algorithm complexity and efficiency 3. How to deal with transmission? Encryption is yes, but the purpose of encryption is not very safe to send Email. This encryption key is the "anti-anti-villain is not a gentleman." That is to glance do not see the contents of the can. For this purpose the complexity of the encryption algorithm and efficiency will not be too big and too low. And on a similar reason, MIME protocol and other protocols used to send Email address is how to send and receive Email, and not how to safely send and receive Email. Therefore, the complexity of the algorithm is smaller, higher efficiency, or because the Send Email and resource-intensive, way to go on a little crooked. ? In addition, because the Email transmission process, due to historical reasons, Email only allowed to send ASCII characters, that is an 8-bit byte of the lower 7 bits. So, if you send a letter with a non-ASCII characters (ie, the highest bit is 1 byte) of the Email through the "history problem" gateway may be a problem. Gateway will be the highest position to 0! Therefore, in order to send a normal Email, this problem must be considered! Based on the above some of the main reasons resulting Base64 encoding. 4. Mail access protocols Using SMTP, messages are transmitted from the sender to the User Agent sender mail-server, sent from the sending mail server to send transmission to the receiver's mail-server, placed in the recipient's mail box, mail box at the receiver side the mail server. Receiver use access protocol in the mail box from the server to get mail. Mail Access Protocol are: 1, Post Office Protocol Version 3 (POP3) 2, Internet Mail Access Protocol, 3, HTTP: This system is called Web-based e-mail, in essence, the use of HTTP User Agent to contact with the Mail Server and send and receive mail. 4.1 POP3 The POP3 server listening on port 110. User Agent and mail server port 110 to establish a TCP connection, the server first authenticates the user, including username, password, etc.; then, the user can download, delete the message; the final out of the system, close the connection. POP3 mode: 1, Download and Delete: Delete from server after downloading e-mail messages. Users can not access the same from many places an email 2, Download and Keep: User Agent will download your mail to leave messages after the server has a copy, you can visit many different places from the same message. During a session in the session, POP3 Server will maintain some of the user's presence information, such as which messages are marked for deletion. However, there is no different Session state transfer between, for example, the mail is read from the PC, but in a notebook and do not see this message has been read. 4.2IMAP IMAP is a mail access protocol, but provides capabilities far more than POP3. IMAP, all messages are stored on the server, allowing users to e-mail management, including creating the directory, move in a

By Dr. Mohammad Ali

different directory mail. In addition, IMAP in a different session to maintain state, as long as the message is read, no matter from where the login server will be marked as read. 2.5 DNS- The Internet Directory Service Introduction
IP address can identify the network host; you can also use the domain name (domain name) to identify. Easy to understand and remember from the perspective of people prefer to use the domain name, for example, www.qassim.edu.sa; it is more easy to remember. However, Internet routing system uses the IP address instead of domain name based on path selection. Therefore, the domain name to IP address mapping. In the fourth chapter we will introduce the IP address, IP address is a 32-bit binary number, a total of four bytes. Writing, between two adjacent bytes of dot (.) Segmentation, each byte with a decimal number, such as 202.194.86.87. This representation is called a "dotted decimal." DNS is responsible for the domain names into IP addresses. DNS (domain name service, domain name service). DNS is: 1, there are multiple DNS servers distributed hierarchical database system consisting of; 2, allows the user to use it for database query application layer protocol. DNS runs over UDP, the transport layer port is 53. DNS is the Internet's key features, the use of application layer to achieve the design reflects the Internet: "the complex process into the network edge to keep the network simple", which is the "end to end principle" (end to end)

1. DNS Services
DNS services provided: 1, to achieve the domain name to IP address resolution; 2, the host alias: a complete domain name of the Host may have one or more aliases. Relative to the complete alias, called standardization is easier to remember domain name. Such as the canonical name: relay1.west-coast.enterprise.com can have the form www.enterprise.com or enterprise.com other aliases. 3, mail server alias: with 2 similar. Mail application will normally be given first access to its canonical name query aliases and the corresponding IP address. 4, load balancing: Load balancing can be achieved using DNS / balance / distribution. For some largescale Web sites, may be formed by one or more servers to the outside of the Server Farm provides WWW service. All of Server has the same name, but different IP address. When the user address resolution, DNS server will return all IP addresses is Client, but each time the IP address returned in a different order, so the request can be assigned to different WWW server whose IP address for processing, in order to achieve load balancing.

2. Overview of How DNS Works?


Why use such a distributed DNS architecture? 1, there is a single point of failure centralized structure of the problem; 2, there are also focused on structural performance scalability problems, large number of requests flooding the server; 3, the centralized structure makes the server and the client's distance is large, the delay will be the introduction of larger; 4, a single database will make the capacity of the database will be very big, frequent update operation will also have management problems. Centralized structure of the poor scalability. Therefore, DNS from the outset with a distributed architecture.

2.1 Local Name Server


In addition to these three types of DNS servers, there is a more important on the DNS server system, called the Local DNS Sever (local DNS server). Will be strict, the local DNS server does not belong to the DNS tree structure, but the DNS system is still very important. This server is the ISP provides you with the default DNS server (which can be easily by looking at TCP / IP Properties to see). Host when a DNS query, the query is first sent to the Local DNS Server. Therefore, Local DNS Server and DNS hierarchy is equivalent to the user between a Proxy.

2.1 Query: Iterative and Recursive


There are two types of queries a DNS domain name: 1, recursive query (recursive query): query mapping is not the DNS server queries other DNS Server, DNS Server Each query will always get the results / failure and return the requested DNS server. By Dr. Mohammad Ali 9

2, iterative query (iteration query): If a DNS Server not responding mapping, then the DNS server returns the address of the next.

2.1 Query Example


This case there is an assumption that the TLD Server know gaia.cs.umass.edu authoritative DNS server (dns.cs.umass.edu) address. But sometimes TLD server does not know the name of each host address of the authoritative DNS server, but know that some know the Host name in the middle of the authoritative DNS Server DNS server address. Assuming, University of Massachusetts DNS server for the dns.umass.edu; also assume that each department has its own DNS server, department has a DNS server is a host Ben Xisuo Authoritative Domain Name Server. Therefore, when the middle of the DNS server (dns.umass.edu) receives a query for the domain name, then returned to the host where the Department of the Ministry of the Authoritative name server address. Finally, a request to the Authoritative DNS server, complete the domain name to IP address resolution. In this case the query method combines Recursive and Iterative two ways, Host sent to the local DNS Server Recursive queries are queries, and Local DNS Server Iterative methods belong to the query.

2.2 DNS: caching


DNS-Cache is an important feature of the DNS system. DNS Cache of thinking is very simple, when the DNS Server received Host Name-> IP address mapping will be temporarily stored in their memory, the next query results obtained from the local, which can improve performance.

3. DNS records
RR is a quad, including: domain name, value, type, TTL. The TTL determines a record of the longest in the Cache survival time, more than will be deleted. Quadruple in the meaning of the name and value varies with the type. 1, Type = A when, Name of the host's domain name, value corresponding to this domain's IP address 2, Type = NS time, Name for the domain, value domain responsible for address resolution for the authorization server's domain name (hostname) 3, Type = CNAME time, name of an alias, value for the alias name of the corresponding normalized 4, Type = MX time, name of a mail server alias, value for the standardization of the domain name server name. (foo.com, mail.bar.doo.com, MX) If a Hostname is the DNS server authoritative DNS server, it must contain resource records of type A (Host corresponding to); if not authoritative DNS server, which will contain the domain name server Host a record (type = NS), also will include a server in the domain name server Type = A records.

4. DNS protocol, messages


There are two DNS protocol message, query, and reply, both the same format. 1 head (12 bytes): 1) identification: 16 bit. DNS query initiated by the Client, Client to determine the identification, server returns the results to the same identification also identifies reply. 2) flags: 16 bits. Include: 1-bit of the query (0) / reply (1) sign 1-bit of the authoritative DNS server, 1 - is 1-bit sign of recursive queries, a recursive method that Host wants to use the query 1-bit recursive queries can be a sign (reply message set) 3) Question parts: includes a name field, its value until the domain name; type field indicates the type you want to query; 4) Reply messages Answer parts: the query results, RR, can have multiple results 5) authority components: the authoritative DNS servers contain other information.

By Dr. Mohammad Ali

11

También podría gustarte