340 likes | 348 Views
Lec- 26. Domain Name System (DNS) Muhammad Waseem Iqbal. IP address identifies the connection of a host to the Internet. People prefer names instead of IP. Host file: maps name and address; stored in local disk; Any program can consult the host file.
E N D
Lec- 26 Domain Name System (DNS) Muhammad Waseem Iqbal
IP address identifies the connection of a host to the Internet. People prefer names instead of IP. Host file: maps name and address; stored in local disk; Any program can consult the host file. With large number of users, it is not possible to have all the host name mappings in a single file. Divide this huge amount of information into small parts and store each part on a different computer DNS. Namespace: Names must be unique like IP addresses. A name space that maps each address to a unique name can be organized as: flat or hierarchical
Flat name space A name is assigned to an address. Name is a sequence of characters without structure Due to central control for ambiguity, this is not possible on huge networks like Internet. Hierarchical Name space Each name is made of several parts. 1st part is nature of organization, 2nd part is name, … Central authority takes control of 1st and 2nd part only. No need to worry of internal names or host names. Ex. Kfupm.edu.sa & ccse.kfupm.edu.sa
Names are defined in an inverted-tree structure with the root at the top. Can have 128 levels: level 0 (root) to level 127. Label: Each node in the tree has a level Maximum of 63 characters. Root label is a null string (empty string). Children of a node have different labels. Figure-1Domain Name Space
Full domain name is a sequence of labels separated by dots. Domain names are always read from the node up to the root. Last label is the label of root (null). So, full domain name always ends in a null label [means dot]. Figure-2Domain Names and Labels
Fully Qualified Domain Name (FQDN) Label is terminated by a null string. Contains the full name of a host. Partially Qualified Domain Name (PQDN) Not terminated by a null string. PQDN starts from a node, but it does not reach the root. Used when the name to be resolved belongs to the same site as the client. Resolver supplies the missing part called as suffix. Figure-3FQDN and PQDN
Domain: Sub-tree of the domain name space. Name of the domain is the domain name of the node at the top of the sub-tree. A domain can be divided into sub-domains. Figure-4Domains
If information is stored in one machine, the requests will overload the machine. Hierarchy of name servers Distribute among DNS servers. Let root stand alone and create as many domains (subtrees) as there are first-level nodes. Each server can be responsible (authoritative) for either a large or a small domain. Fig-5 Distribution of Name Space
Root Server: Server whose zone consists of the whole tree. It does not store any information about domains but delegates its authority to other servers. Keeps reference to other servers. There are 13 root servers. Primary server: A primary server loads all information from the disk file, for which it is an authority; Responsible for creating, maintaining, and updating the zone file. Secondary server loads all information from the primary server; Neither creates nor updates the zone files; create redundancy.
Generic Domains Registered hosts according to their generic behaviour. Each node in the tree defines a domain, which is an index to the domain name space database. First level in the generic domain section allows seven possible three-character labels. Figure-6DNS in the Internet
Country domain section follows the same format as the generic domains but uses two-character country abbreviations. Second level labels can be organizational or more specific, national designations. Figure-8Country domains
Mapping a name to an address or an address to a name is called name-address resolution. Resolver A host that needs to map an address to a name or a name to an address calls a DNS client named a resolver. Resolver contacts the closest DNS server for mapping. If the server has the info, it replies; otherwise, it either refers to the resolver to other servers or asks other servers to provide the information. After the resolver receives the mapping, it interprets the response to see if it a real resolution or an error and finally delivers the result to the process that requested it. Resolution
Mapping names to addresses Resolver gives a domain name to the server and asks for the corresponding address. The server checks the generic domains or the country domains to find the mapping. Mapping addresses to names Client can send an IP address to a server to be mapped to a domain name. DNS uses inverse domain. Recursive Resolution Resolver can ask for a recursive answer from a name server Resolver expects the server to supply the final answer. If server is the authority, it checks its database and replies. If server is not the authority, it sends the request to another server (the parent usually) and waits for the response. If the parent is the authority, it responds; otherwise, it sends the query to yet another server. When the query is finally resolved, the response travels back until it finally reaches the requesting client.
If server is authority, it sends the answer. If server is not authority, it returns the IP address of the server that it thinks can resolve the query. The client is responsible for repeating the query to this second server. Figure-10Iterative resolution
Hypertext Transfer Protocol (HTTP) is used mainly to access data on the World Wide Web. It can jump from one document to another Functions like FTP and SMTP Transfers files and uses services of TCP; Uses TCP port 80 Transfer data between client and server HTTP information is read and interpreted by HTTP server and HTTP client HTTP
HTTP itself is a stateless protocol Client initializes the transaction by sending a request message. Server replies by sending a response. Two types of HTTP messages Request Response Figure-11HTTP Transaction
Request line Request type Uniform Resource Locator (URL): address of the web page Method: Protocol used to retrieve the document. Host computer: Name of the computer where the information is located Port: [Optional] Port number of server Path: Path name of the file where the information is located. Version: HTTP 1.1 OR 1.0 OR 0.9 Headers Body Figure -12Request Message
Methods Request method is the actual command or request that a client issues to the server GET: Client wants to retrieve a document from server HEAD: client wants information about a document and not the document itself. POST: Client provides information to the server. PUT: Client provides a document to the server. PATCH: similar to PUT but only with differences that should be implemented in existing file. COPY: Copies a file to another location. Source is in request line and destination is in entity header. MOVE: Moves a file to another location. DELETE: Removes a document from server. LINK: Creates a link or links from a document to another location. UNLINK: Deletes links created by LINK method. OPTION: Used by client to ask the server about available options.
HTTP support Proxy server. Proxy server is a computer that keeps copies of responses to recent requests. If proxy server is present, HTTP client sends a request to proxy server and the proxy server checks its cache. If the response is not stored in cache, the proxy server sends the request to corresponding server. Incoming responses are sent to proxy server and stored for further requests from other clients. Reduces load on original sever, decreases traffic, and improves latency. Proxy Server
World wide web (WWW) Repository of information spread all over the world. Unique combination of flexibility, portability and user friendliness. WWW today is a distributed client-server service, in which a client using a browser can access a service using a server. However, the service provided is distributed over many locations called websites. Figure-14Distributed services
Linking of documents is done using pointers Hypertext documents only contain text, hypermedia documents can contain pictures, graphics, and sound Unit of hypertext or hypermedia available on web is called a page. The main page for an organization or an individual is called homepage. Figure-15Hypertext
Browser has three parts Controller: receives input from keyboard or mouse and uses the client programs to access the document. Client programs Interpreters: After the document has been accessed, the controller use one of the interpreters to display the document on the screen; HTML or Java. Figure-16Browser architecture
Static documents Fixed-content documents that are created and stored in the server. Client can get only the copy of the document. The contents in the server can be changed, but the user cannot change it. Figure-17Categories of Web documents
Dynamic documents do not exist in a predefined format. Dynamic document is created by a Web server whenever a browser requests the document. When a request arrives, the Web server runs an application program that creates the dynamic document. The server returns the output of the program as a response to the browser that requested the document. As fresh document is created for each request, the contents of a dynamic document can vary from one request to another. Example is getting date and time from the server. Figure-19Dynamic Document
Steps involved in handling dynamic documents. Server examines the URL to find if it defines a dynamic document. URL defines a dynamic document, the server executes the program. Sends the output of the program to the client (browser). Common Gateway Interface (CGI) Technology that creates and handles dynamic documents. CGI is a set of standards that defines how a dynamic document should be written, how input data should be supplied to the program, and how the output result should be used. Can use C, C++, Perl, … Use of common in CGI indicates that the standard defines a set of rules that are common to any language or platform. Gateway here means that a CGI program is a gateway that can be used to access other resources such as databases and graphics packages. Interface means that there is a set of predefined terms, variables, calls, and so on that can be used in any CGI program.
For active documents, we need a program to be run at the client side. For example, to run animations. When a browser requests an active document, the server sends a copy of the document in the form of byte code. The document is then run at the client (browser) site; the client can store this document in its own storage area also. Active document is stored in binary code in the server. Figure-20Active document
At server site, programmer writes a program, in source code, and stores it in a file. Compile the code into byte code. Path name of the file is the one used by a URL to refer to the file. In this file, each program command (statement) is in binary form, and each identifier (variable, constants, function names, and so on) is referred to by a binary offset address. Client (browser) requests a copy of the binary code, which is probably transported in compressed form from the server to the client (browser). Client (browser) uses its own software to change the binary code into executable code. The software links all the library modules and makes it ready for execution. Client (browser) runs the program and creates the result that can include animation or interaction with the user. Creation, compilation and execution