The main role of DNS is to translate Domain Names to their corresponding IP adresses, so why is necessary to be an application layer protocol?

I think that DNS is an application layer protocol because if for example i want to create a TCP connection i need the destination ip address in layer 4, Am i correct? there is another answer?


  • @sergeyrar summarizes the case (basically, DNS is above TCP+UDP, so on the simplified Internet stack it is an application protocol, even if often hidden from views) but why is it important for you? What is the context? Is it purely a theoretical question? Also DNS is not just to translate domain names to corresponding IP addresses, it is a little broader than that. – Patrick Mevzek Feb 28 '18 at 15:37
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Apr 1 '18 at 21:14

DNS is a application layer protocol, because DNS query and answer is the application level communications. Application layer only understand the query and answer section in the DNS packet. so application layer DNS query/answer is encapsulated in layer 4 udp then layer 3 IP.....and so on.

| improve this answer | |
  • 1
    DNS uses UDP and TCP (yes I am repeating myself here). – Patrick Mevzek Feb 28 '18 at 15:42
  • TCP it uses for zonal transfers only right?. but normal query/answer will be udp. – abdul_razak Feb 28 '18 at 15:49
  • No, this is not true. TCP can be used for "normal" queries too. See RFC cited by @RonMaupin above or for example see other question: serverfault.com/questions/404840/… – Patrick Mevzek Feb 28 '18 at 15:50

Protocols at the Physical, Data-Link, Network, or Transport layers do not use names. Only applications need to use names, so DNS is an application-layer protocol because it allows the application to translate a name into a network address.

| improve this answer | |

I think that DNS is an application layer protocol because if for example i want to create a TCP connection i need the destination ip address in layer 4, Am i correct?

IP is a layer 3 protocol.

DNS is just a service that translates host names into IP addresses, you need this because humans are better at remembering names than numbers.

So once you enter a website name your browser client has some API to ask the operating system to issue a DNS request for the name you entered.

DNS requests are transmitted to a specific DNS server IP address that resides somewhere on the internet (The address which you configured manually or received via a DHCP update). For that server to know which service you specifically want (since this server might also be an HTTP server for example) you also need to specify a port number, DNS uses UDP port 53. So for that reason it must be an application layer protocol.

If your DNS server would always reside on your local subnet you could have a Layer 4 protocol to implement this (the sever would then identify the incoming request by the unique multicast IP address dedicated for this service - the same mechanism as OSPF for example).

| improve this answer | |
  • The person who down-voted me, please present your arguments ! would love to hear your insights. – sergeyrar Feb 28 '18 at 14:22
  • 1
    DNS uses UDP and TCP! – Patrick Mevzek Feb 28 '18 at 15:34
  • 1
    I think someone really disagrees that DNS is an application-layer protocol because all the answers were voted down. – Ron Maupin Feb 28 '18 at 15:34
  • @PatrickMevzek that is correct, although many implementation have not caught up with RFC 5966, DNS Transport over TCP - Implementation Requirements: "This document therefore updates the core DNS protocol specifications such that support for TCP is henceforth a REQUIRED part of a full DNS protocol implementation." – Ron Maupin Feb 28 '18 at 15:37
  • @RonMaupin this becomes the rare cases now wrt implementations (as it is needed for DNSSEC anyway) or do you have some specific ones in mind?, it just remains so much misinformation and networks blindly filtering TCP/53 for no good reason (just because they read somewhere that this is needed only for AXFR, which is false). The RFC was done in order to have a way to show a document saying that it is now above SHOULD, otherwise people would just exonerate themselves by pointing the previous one. – Patrick Mevzek Feb 28 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.