Client Server Concepts, DNS, DHCP Prof. I. Sengupta / Dr. S.K. Ghosh School of Information Technology Indian Institute of Technology, Kharagpur 1
Client-Server Model 2
Client-server Model Standard model for developing network applications. Notion of client and server. A server is a process that is offering some service. A client is a process that is requesting the service. Server or client may be running on different machines. Server waits for requests from client(s). 3
Client-server Model (contd.) CLIENT SERVER CLIENT CLIENT 4
Client-server Model (contd.) Typical scenario: The server process starts on some computer system. Initializes itself, then goes to sleep waiting for a client request. A client process starts, either on the same system or on some other system. Sends a request to the server. 5
When the server process has finished providing its service to the client, the server goes back to sleep, waiting for the next client request to arrive. The process repeats. 6
Client-server Model (contd.) Roles of the client and the server processes are asymmetric. Two types of servers: Iterative servers. Concurrent servers. 7
Iterative Servers Used when the server process knows in advance how long it takes to handle each request and it handles each request itself. Single copy of server runs at all times. A client may have to wait if the server is busy. 8
Concurrent Servers Used when the amount of work required to handle a request is unknown; the server starts another process to handle each request. A copy of the server caters to a client s request in a dedicated fashion. As many copies of server as there are client requests. 9
Using TCP or UDP Before start of communication, a connection has to be established between the two hosts. Five components in a connection: Protocol used Source IP address Source port number Destination IP address Destination port number 10
Develop a Network Application The best way is to use some standard and well-accepted protocol. At the data link layer level, use Ethernet. At the network layer level, use IP. At the transport layer level, use TCP. At the application layer level, use a standard API like the Berkeley Socket Interface. 11
What is a Socket? The socket is the method for achieving inter-process communication (IPC). It is used to allow one process to speak to another (on same or different machine). Analogy: Like the telephone is used to allow one person to speak to another. 12
Basic Idea When two processes located on two machines communicate, we define association and socket. Association: basically a 5-tuple Protocol Local IP address Local port number Remote IP address Remote port number 13
Socket: also called half-association (a 3-tuple) Protocol, local IP address, local port number Protocol, remote IP address, remote port number 14
Domain Name System (DNS) 15
What is DNS? The global database system for Internet addressing, mail and other information. Much easier to use and memorize. Concept of domains and sub-domains. Domain management is distributed. DNS servers translate domain names to IP addresses. 16
Top Level Domains com Commercial org Non-profit net Network service provider gov US govt. mil military edu Education au Australian at Austrian ca Canadian dk Dutch fr French de German in Indian it Italian jp Japanese kr Korean nz New Zealand es Spanish tw Taiwanese uk British or Irish us U.S. 17
Domain Name Space 18
Domain Names and Labels 19
Domains 20
Domain Name Structure Domain names are arranged in a hierarchical tree-like structure. ernet iitkgp cse ece mech in iitb cse math nic Eg: cse.iitkgp.ernet.in 21
Some Statistics In thousands Year COM EDU GOV MIL NET ORG 1991 200 250 75 20 5 50 1992 1993 350 700 450 700 100 150 20 30 10 25 50 75 1994 1,200 1,075 250 100 125 175 1995 2,400 1,700 300 250 700 250 22
Today: Com :: 56 million Net :: 8 million Org :: 5 million Us :: 1 million Biz :: 1.5 million Total :: 70 million 23
Distribution of Name Space 24
Hierarchy of Name Servers 25
Zones and Domains 26
What is a Zone? Domains are broken into zones for which individual DNS servers are responsible. A domain represents the entire set of names/machines that are contained under an organizational domain name. A zone is a domain minus any subdomains delegated to other DNS servers. 27
The Concept Each domain name is typically served by 2 or more DNS servers for redundancy. Referred to as primary and secondary. Only one DNS server should be configured as primary for a zone. Several secondary DNS servers possible. The primary server contains master copy of the data for a zone. Secondary servers get copies of this data through zone transfers. 28
Zone Transfer A primary server loads all information from the disk file. The secondary server loads all information from the primary server. When the primary downloads information from the secondary, it is called zone transfer. 29
DNS in the Internet 30
DNS in the Internet 31
Generic Domains 32
Country Domains 33
Inverse Domain 34
Name Resolution 35
Name Resolution Process The commonly used server is BIND (Berkeley Internal Name Domain). Runs under UNIX as a process called named. When an application needs some information from the server, it invokes the DNS name resolver. DNS translates a fully qualified domain name into the corresponding IP address. Using the command nslookup. 36
37
If the name server does not have the information locally, it asks its primary server, and so on. For redundancy, each host may also have one or more secondary name servers which may be queried when the primary fails. How do name servers update themselves? 38
Hierarchy of Name Servers root au edu com in stanford.edu gatech.edu rediff.com yahoo.com 39
Recursive Resolution 40
Iterative Name Resolution Client sequentially sends queries to DNS servers and receives response. If response is negative, the DNS server to query next is also returned. Unlike recursive name resolution, where only one response is finally returned back to the client. 41
Iterative Resolution 42
DNS Messages 43
DNS Messages 44
Query and Response Messages 45
Header Format 46
Flag Fields QR: OpCode: AA: TC: RD: RA: rcode: Query/Response 0 standard, 1 inverse, 2 server status Authoritative Truncated Recursion Desired Recursion Available Status of the error 47
Types of Records 48
Question Record Format 49
Query Name Format admin.atc.fhda.edu. 50
Resource Record Format 51
Example 1 A resolver sends a query message to a local server to find the IP address for the host chal.fhda.edu. We discuss the query and response messages separately. 52
Example 1: The Query Message 53
Example 1: The Response Message 54
Example 2 An FTP server has received a packet from an FTP client with IP address 153.2.7.9. The FTP server wants to verify that the FTP client is an authorized client. 55
Example 2: Inverse Query Message 56
Example 2: Inverse Response Message 57
BOOTP and DHCP 58
BOOTP 59
Introduction The Bootstrap Protocol allows a host to configure itself dynamically at boot time. This protocol provides three services: IP address assignment. Detection of the IP address of a serving machine. The name of a file to be loaded and executed by the client machine. The BOOTP packet is assumed to never fragment. 60
BOOTP uses two well-defined port numbers. UDP port number 67 is used for the server. UDP port number 68 is used for the BOOTP client. The process: The BOOTP client broadcasts a single packet. called a BOOTREQUEST packet containing the client s MAC address. The client waits for a response from the server. If not received within a specified time interval, the client retransmits the request. The server responds with a BOOTREPLY packet. 61
Points to Note BOOTP is an alternative to RARP, which operates at the data link layer for LAN only. BOOTP, a UDP/IP based configuration protocol, provide much more configuration information. Allows dynamic configuration of the entire IP network. BOOTP and its extensions became the basis for the DHCP protocol. 62
BOOTP Packet Format 63
Operation code (8 bits) Value = 1 Boot request Value = 2 Boot reply Hardware type (8 bits) Value = 1 Ethernet Value = 2 Experimental Ethernet Value = 15 Frame relay Value = 19 ATM 64
Option Format 65
BOOTP Operation 66
DHCP 67
What is DHCP? Dynamic Host Control Protocol Used to centrally allocate and manage TCP/IP configurations of client nodes. Allows us to define pools of IP addresses, which are then allocated to client computers by the server. These pools of addresses are called scopes. Not only are the addresses handed out, so also are the related configuration settings like the subnet mask, default router, DNS server, etc. 68
DHCP works across most IP routers, and allocates addresses depending on the subnet the request came from. No need to reconfigure a PC that is moved from one subnet to another. 69
How does DHCP work? When a DHCP client is first switched on: It sends a broadcast packet on the network with a DHCP request. This is picked up by the DHCP server. Server allocates an IP address to the PC, from one of the scopes it has. DHCP does not allocate addresses permanently: It leases the address for a particular time period. Controlled by the administrator. 70
DHCP Packet Format 71
DHCP Transition Diagram 72
DHCP: Exchanging Messages 73
Exchanging Messages (contd.) 74