DNS vs DHCP | difference between DNS and DHCP servers
This page compares DNS vs DHCP and describes basic difference between DNS and DHCP servers. DHCP stands for Dynamic Host Configuration Protocol and DNS stands for Domain Name System. It also mentions basics of DHCP server and DNS server.
DNS-Domain Name System Address Resolution
As mentioned DNS is the short form of Domain Name System. It uses DNS servers. The DNS server maps host name to the IP address similar to phone books or directory which maps name to phone number. This is done as it is easy to remember the name compare to ip address.
Prior to development of DNS, hosts file need to be managed which contains ip addresses and their respective names. But over the time, due to large number of computers have been added to the internet, it has become difficult to manage updated copy of the hosts file in all the computers. This has lead to the development of DNS across the world.
DNS works by exchanging messages between client and server machines. A client application will pass the destination host name to the DNS process in order to obtain IP address.
As shown in the figure-1, hardware addresses are used in physical network, IP addresses are used in internet and symbolic addresses such as domain names are used in the applications or used by users. ARP/RARP protocols convert IP address to MAC address and viceversa. DNS does translation between domain name and IP address.
DNS Hierarchy and Syntax
DNS is a distributed database implemented in a hierarchy of name servers. The figure-2 depicts DNS hierarchy and syntax in tree form. As shown, the domain name is divided into TLD (top level domain), label and host name. Each organization needs to obtain TLD (e.g. com, org, edu etc.) from central authority.
DNS servers and resolvers
• DHCP is needed by the client at the beginning to establish the internet connection with
the web server. Using DHCP protocol client or user obtains ip address from the DHCP server.
• Once the connection is established, user uses Internet Explorer application or Google Chrome to browse the website and he/she does this by typing the domain name in the address bar.
• the application gets the ip address from the DNS resolver.
• Most applications use addresses in the order provided by DNS resolver. This process is depicted in the figure-3.
DHCP-Dynamic Host Configuration Protocol
• DHCP is defined in RFC 2131.
• It runs over UDP.
• It provides automatic configuration of host connected to the network or booted while connected on the network.
• It provides hosts with initial configuration data which includes following.
-IP address with subnet mask
-IP address of the DNS server
How DHCP Works
The figure-4 depicts how DHCP works. As shown DHCP client requests for its configuration from DHCP server. Upon receiving the request, DHCP server replies the information to the client. These include IP address, subnet mask, default routers, DNS servers, lease time etc.
DHCP messages exchanged between DHCP Server and DHCP Client
Following table mentions list of DHCP messages used with their functions between DHCP server and DHCP client.
|DHCP DISCOVER||The client broadcasts message in search of available DHCP servers.|
|DHCP OFFER||The server response to the client DHCP DISCOVER with offer of configuration parameters.|
|DHCP REQUEST||The client broadcasts to the server, requesting offered parameters from one server specifically. Confirms correctness of previously allocated address after, e.g. system reboot. Extends the lease on a particular network address.|
|DHCP RELEASE||The client-to-server communication, relinquishing network address and canceling remaining lease.|
|DHCP ACK||The server to client communication with configuration parameters, including committed network address.|
|DHCP NAK||Server to client indicating client's notion of network address is incorrect (e.g., client has moved to new subnet) or client's lease as expired.|
|DHCP DECLINE||The client-to-server communication, indicating that the network address is already in use.|
|DHCP INFORM||The client-to-server communication, asking for only local configuration parameters that the client already has externally configured as an address.|
Tabular difference between DNS server and DHCP server protocols
Following is the tabular difference DNS server and DHCP server protocols i.e. DNS and DHCP respectively.
|Full Form||Domain Name System||Dynamic Host Configuration Protocol|
|Function||Resolving name to IP address||Assigning IP address to host or client|
|Server||DNS server resolves names and gives address to the DNS clients.||DHCP server dynamically assigns IP address on demand to the DHCP clients.|
|Protocols and Ports used||DNS uses both UDP and TCP protocols.
Initially DNS client sends DNS query usign UDP over port-53.
If client does not get any response from DNS server, it must re-transmits DNS query over TCP over port-53 after waiting for few seconds.
|DHCP uses UDP port number 67 as destination server and port number 68 for the client.|