Unit 6 19.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. DNS To identify an entity, TCP/IP protocols use the IP address, which uniquely identifies the connection of a host to the Internet. However, people prefer to use names instead of numeric addresses. Therefore, we need a system that can map a name to an address or an address to a name. A user of an e-mail program may know the recipient’s email address; however, the IP protocol needs the IP address. The DNS client program requests a DNS server to map the e-mail address to the corresponding IP address. 19.2 Purpose of DNS 19.3 Namespace To be unambiguous, the names assigned to machines must be carefully selected from a namespace with complete control over the binding between the names and IP addresses. In other words, the names must be unique because the addresses are unique. A name space that maps each address to a unique name can be organized in two ways: 19.4 Flat or Hierarchical. Flat Namespace In a flat namespace, a name is assigned to an address. A name in this space is a sequence of characters without structure. The names may or may not have a standard section; if they do, it has no meaning. The main disadvantage of a flat namespace is that it cannot be used in an extensive system such as the Internet because it must be centrally controlled to avoid ambiguity and duplication. 19.5 Hierarchical Namespace In a hierarchical namespace, each name is made of several parts. The first part can define the nature of the organization, the second part can define the name of an organization, The third part can define departments in the organization, and so on. In this case, the authority to assign and control the namespaces can be decentralized 19.6 Hierarchical Namespace A central authority can assign the part of the name that defines the nature of the organization and the name of the organization. The organization can add suffixes (or prefixes) to the name to define its host or resources. The management of the organization need not worry that the prefix chosen for a host is taken by another organization because, even if part of an address is the same, the whole address is different. 19.7 Hierarchical Namespace 19.8 Assume two colleges and a company call one of their computers challenger. The first college is given a name by the central authority such as fhda.edu, the second college is given the name berkeley.edu, and the company is given the name smart.com. When each of these organizations adds the name challenger to the name they have already been given, the end result is three distinguishable names: challenger.fhda.edu, challenger.berkeley.edu, and challenger.smart.com. Domain Namespace To have a hierarchical name space, a domain name space was designed. In this design the names are defined in an inverted-tree structure with the root at the top. The tree can have only 128 levels: level 0 (root) to level 127 19.9 Label Each node in the tree has a label, a string with a maximum of 63 characters. The root label is a null string (empty string). DNS requires that children of a node (nodes that branch from the same node) have different labels, guaranteeing the domain names' uniqueness. 19.10 Domain Name Each node in the tree has a domain name. A full domain name is a sequence of labels separated by dots (.). The domain names are always read from the node up to the root. The last label is the label of the root (null). This means that a full domain name always ends in a null label, which means the last character is a dot because the null string is nothing 19.11 Domain Names and Labels 19.12 Fully Qualified Domain Name (FQDN) If a label is terminated by a null string, it is called a fully qualified domain name (FQDN). An FQDN is a domain name that contains the full name of a host. It contains all labels, from the most specific to the most general, that uniquely define the host’s name. A DNS server can only match an FQDN to an address. That the name must end with a null label, but because null means nothing, the label ends with a dot (.). challenger.atc.fhda.edu 19.13 Partially Qualified Domain Name (PQDN) If a label is not terminated by a null string, it is called a partially qualified domain name (PQDN). A PQDN starts from a node, but it does not reach the root. It is used when the name to be resolved belongs to the same site as the client. 19.14 Domain A domain is a subtree of the domain name space. The name of the domain is the name of the node at the top of the subtree. A domain may itself be divided into domains (or subdomains as they are sometimes called). 19.15 Distribution of Name Space The information contained in the domain name space must be stored. However, it is very inefficient and also unreliable to have just one computer store such a huge amount of information. It is inefficient because responding to requests from all over the world places a heavy load on the system. It is not reliable because any failure makes the data inaccessible 19.16 Hierarchy of Name Servers 19.17 The solution to these problems is to distribute the information among many computers called DNS servers. One way to do this is to divide the whole space into many domains based on the first level. In other words, we let the root stand alone and create as many domains (subtrees) as there are first-level nodes. Because a domain created in this way could be very large, DNS allows domains to be divided further into smaller domains (subdomains). Each server can be responsible (authoritative) for either a large or a small domain. In other words, we have a hierarchy of servers in the same way that we have a hierarchy of names Hierarchy of Name Servers The hierarchy is organized in a tree-like structure, and it includes various types of name servers. Root Servers: 1. 1. 2. 3. Top Level Domain( TLD) Servers: 2. 1. 2. 3. 19.18 At the top of the DNS hierarchy are the 13 root name servers (labeled A through M). These servers maintain information about top-level domains (TLDs) like .com, .org, .net, .gov, and country-code TLDs like .us, .uk, etc. They don't contain information about specific domain names but rather direct queries to the appropriate TLD servers. These servers are responsible for specific top-level domains (TLDs). For example, there are separate TLD servers for .com, .org, .net, .uk, and many others. They maintain information about second-level domains (SLDs) within their TLD. Hierarchy of Name Servers The hierarchy is organized in a tree-like structure, and it includes various types of name servers. 3. 19.19 Authoritative Name Servers: 1. These are the servers maintained by domain registrars or organizations that have control over specific domain names. 2. They store the actual DNS records (such as A records for IP addresses or MX records for mail servers) for individual domain names. 3. Authoritative name servers are responsible for providing DNS information for specific Hierarchy of Name Servers The hierarchy is organized in a tree-like structure, and it includes various types of name servers. 4. 19.20 Recursive Solvers: 1. These are typically operated by Internet Service Providers (ISPs) or DNS resolver services like Google's public DNS or OpenDNS. 2. Recursive resolvers are responsible for handling DNS queries from end-user devices. 3. When a user's device makes a DNS query, the recursive resolver contacts the root servers, TLD servers, and authoritative name servers to obtain the requested information Resolution Mapping a name to an address or an address to a name is called name-address resolution. Resolver 19.21 DNS is designed as a client/server application. A host that needs to map an address to a name or a name to an address calls a DNS client called a resolver. The resolver accesses the closest DNS server with a mapping request. If the server has the information, it satisfies the resolver; otherwise, it either refers the resolver to other servers or asks other servers to provide the information. Resolution-Mapping Names to Addresses 19.22 After the resolver receives the mapping, it interprets the response to see if it is a real resolution or an error, and finally delivers the result to the process that requested it. In this case, the server checks the generic domains or the country domains to find the mapping. If the domain name is from the generic domains section, the resolver receives a domain name such as "chal.atc.jhda.edu.". The query is sent by the resolver to the local DNS server for resolution. If the local server cannot resolve the query, it either refers the resolver to other servers or asks other servers directly Recursive Resolution The client (resolver) can ask for a recursive answer from a name server. This means that the resolver expects the server to supply the final answer. If the server is the authority for the domain name, it checks its database and responds. If the server is not the authority, it sends the request to another server (the parent usually) and waits for the response. 19.23 Recursive Resolution 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. This is called recursive resolution 19.24 Iterative Resolution If the client does not ask for a recursive answer, the mapping can be done iteratively. If the server is an authority for the name, it sends the answer. If it is not, it returns (to the client) 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. If the newly addressed server can resolve the problem, it answers the query with the IP address; otherwise, it returns the IP address of a new server to the client. Now the client must repeat the query to the third server. This process is called iterative resolution because the client repeats the same query to multiple servers. 19.25 Iterative Resolution If the newly addressed server can resolve the problem, it answers the query with the IP address; otherwise, it returns the IP address of a new server to the client. Now the client must repeat the query to the third server. This process is called iterative resolution because the client repeats the same query to multiple servers. 19.26 Caching 19.27 Each time a server receives a query for a name that is not in its domain, it needs to search its database for a server IP address. Reduction of this search time would increase efficiency. DNS handles this with a mechanism called caching. When a server asks for a mapping from another server and receives the response, it stores this information in its cache memory before sending it to the client. If the same or another client asks for the same mapping, it can check its cache memory and solve the problem Example of DNS Resolution 19.28 SMTP The actual mail transfer is done through message transfer agents. To send mail, a system must have the client MTA( Mail transfer Agent), and to receive mail, a system must have a server MTA. The formal protocol that defines the MTA client and server in the Internet is called the Simple Mail Transfer Protocol (SMTP). 19.29 Figure 26.16 SMTP range 26.30 Figure 26.17 Commands and responses 26.31 Figure 26.18 Command format 26.32 SMTP SMTP is used two times, between the sender and the sender's mail server and between the two mail servers. Another protocol is needed between the mail server and the receiver. 19.33 Mail Transfer Phases The process of transferring a mail message occurs in three phases: connection establishment, mail transfer, and connection termination. Connection Establishment A client initiates a connection to the SMTP server of the recipient's domain on port 25 (or an alternate port if specified). The client and server engage in a handshake protocol to establish a connection. This typically involves a 3-way handshake. Once the connection is established, the server is ready to receive commands from the client. 19.34 Mail Transfer Phases 19.35 Mail Transfer: The client (sender) initiates the mail transfer phase by sending a series of SMTP commands to the server. Common SMTP commands during the mail transfer phase include: HELO/EHLO: The client identifies itself to the server. MAIL FROM: The client specifies the email address of the sender. RCPT TO: The client specifies the recipient's email address. DATA: The client begins sending the email content. The email content includes the header, message body, and any attachments. The client sends this data to the server using the DATA command. The data is terminated with a period (.) on a line by itself. The server processes the email and, if all is well, queues it for delivery to the recipient's mailbox. If there are issues, the server may send back error messages to the client. Mail Transfer Phases Connection Termination Once the email transfer is complete, the client can initiate the connection termination phase. This typically involves sending the QUIT command to the server to gracefully close the connection. The server acknowledges the QUIT command, and the connection is terminated. 19.36 FILE TRANSFER Transferring files from one computer to another is one of the most common tasks expected from a networking or internetworking environment. As a matter of fact, the greatest volume of data exchange in the Internet today is due to file transfer. File Transfer Protocol (FTP) Anonymous FTP 26.37 Note FTP uses the services of TCP. It needs two TCP connections. The well-known port 21 is used for the control connection and the well-known port 20 for the data connection. 26.38 FTP 26.39 Using the control connection 26.40 Communication over Control Section FTP uses the same approach as SMTP to communicate across the control connection. It uses the 7-bit ASCII character set Communication is achieved through commands and responses. This simple method is adequate for the control connection because we send one command (or response) at a time. Each command or response is only one short line, so we need not worry about file format or file structure. Each line is terminated with a two-character (carriage return and line feed) end-of-line token. 19.41 Using the data connection 26.42 19.43 The purpose of the data connection is different from that of the control connection. We want to transfer files through the data connection. File transfer occurs over the data connection under the control of the commands sent over the control connection. However, we should remember that file transfer in FTP means one of three things: A file is to be copied from the server to the client. This is called retrieving after. It is done under the supervision of the RETR command, A file is to be copied from the client to the server. This is called storing after. 19.44 It is done under the supervision of the STOR command. A list of directory or file names is to be sent from the server to the client. This is done under the supervision of the LIST command. Note that FTP treats a list of directory or file names as a file. It is sent over the data connection. The client must define the type of file to be transferred, the structure of the data, and the transmission mode. Before sending the file through the data connection, we prepare for transmission through the control connection. The heterogeneity problem is resolved by defining three attributes of communication: file type, data structure, and transmission mode HTTP The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on the World Wide Web. HTTP functions as a combination of FTP and SMTP. Unlike SMTP, the HTTP messages are not destined to be read by humans; they are read and interpreted by the HTTP server and HTTP client (browser). SMTP messages are stored and forwarded, but HTTP messages are delivered immediately. The contents of the requested file or other information are embedded in a response message. HTTP uses the services of TCP on well-known port 80 19.45 HTTP Although HTTP uses the services of TCP, HTTP itself is a stateless protocol. The client initializes the transaction by sending a request message. The server replies by sending a response. 19.46 HTTP Transaction HTTP uses the services of TCP, HTTP itself is a stateless protocol. The client initializes the transaction by sending a request message. The server replies by sending a response. Messages A request message consists of a request line, a header, and sometimes a body. A response message consists of a status line, a header, and sometimes a body 19.47 HTTP messages are of two types: request and response. Both the message types follow the same message format. Request Message: The request message is sent by the client that consists of a request line, headers, and sometimes a body. Response Message: The response message is sent by the server to the client that consists of a status line, headers, and sometimes a body. 19.48 Request Message 19.49 Response Message