DNS and DHCP both work on the client-server architecture but are dissimilar terms. DNS maps the domain name to IP address whereas DHCP is a protocol which assigns IP to the hosts in a network be it statically or dynamically. DHCP is also used while setting up the DNS server to the host.
Content: DNS Vs DHCP
|Basis for comparison||DNS||DHCP|
|Basic||It is an address resolving mechanism.||It is a protocol used for assigning IP's to the host in a local area network statically or dynamically.|
|Features||Coverts symbolic names into IP address and vice-versa.||Provide additional information such as IP addresses of the host, router and name server and Subnet mask of the computer.
|Used for locating active directory domain servers.||Assigns IP to host for a particular lease time.
|Port number used||53||67 and 68|
|Related protocols||UDP and TCP||UDP|
|Server||DNS server resolves the Domain name to the IP and vice-versa.||DHCP server configures the hosts automatically.|
|Advantage||Eliminate the need to remember the IP address; instead, the domain name is used for the web address.||Reliable IP address configuration and reduced network administration.|
Definition of DNS
DNS (Domain Name System) is a mechanism which provides directory lookup service which maps the name of a host on the Internet and its unique numerical address (logical address).
Conventionally, mapping was done using a host file, which had details such as name and address. Those host files could be stored on each host and updated periodically from a master host file. Whenever a program or a user needed to map a name to address, the host consult the host file and find the mapping. But this mechanism would be extremely unreliable for today’s scenario where there is an extensive number of hosts are connected through the internet.
Working of DNS
When a user wants to use a file transfer client to access the file transfer server running on a remote host while the user is only aware of file transfer name. To establish the connection the TCP/IP suite must need IP address of the file transfer server. The given figure illustrates the working of the DNS step by step.
- The hostname is passed to the file transfer client by the user.
- The file transfer client passes the hostname to the DNS client.
- The DNS client sends the query to the DNS server which gives file transfer server name by utilizing known IP address of the DNS server.
- DNS server sends the response with the IP address of the desired file transfer server.
- The DNS client passes the IP address to the file transfer server.
- The received IP address is used by file transfer client to access the file transfer server.
Definition of DHCP
DHCP (Dynamic Host Configuration Protocol) has been concocted to provide static and dynamic address allocation to the hosts connected in the network. It includes information such as IP address and subnet mask of the computer, IP address of the router and IP address of the name server.
DHCP is comprised of two components: a protocol which delivers host-specific configuration parameters from a DHCP server to the host and a mechanism to allocate network addresses to the hosts. DHCP can quickly configure a host, everything that required for doing so is a defined range of IP addresses on a DHCP server. When a host gets active, it contacts to the DHCP server and request address information.The DHCP server chooses an address and allocates it to the host. But these addresses are leased for a particular period after the expiration of lease the host can contacts to the DHCP server and requests to extend the lease. This lease mechanism is very useful for finding non-working moved or switched off hosts. In the given cases hosts do not hold on to the addresses and addresses are returned to the address pool by the DHCP server which can be reallocated as necessary. It prevents the IP loss.
Key Differences Between DNS and DHCP
- DNS is used for resolving and recursively resolving the address to name or name to address of the host. On the other hand, DHCP is used for allocating the addresses to the host in the network dynamically or statically.
- DNS uses port number 53 whereas DHCP could either use 67 or 68.
- DHCP supports only UDP while DNS can support TCP and UDP both protocols.
- Servers in DNS and DHCP performs different operations where DNS server is responsible for accepting the queries through client and responding back to the client s along with the results. As against, DHCP server is responsible for allocating the temporary addresses to the client machines for a lease time and then extending the lease according to the requirement.
- DNS follows a certain hierarchy which does not allow the storage of all the domain names at one place instead it breaks it into subdomains and then the particular piece of information is stored on a particular server. Hence it is decentralized in manner. In contrast, DHCP server configures IP addresses of the clients from a pool of IP addresses and centrally handles all the tasks, in case a DHCP server is not directly attached to the clients then it uses a router to receive the DHCP broadcasts and relay them to the DHCP server.
DNS and DHCP both of the technologies were devised for the convenience of the users and administrators using the network or internet. DNS eliminated the need of remembering the complex IP addresses for the casual users while DHCP reduced the time-consuming process of configuring the systems in a network manually, nowadays its all automatic and fast.