At what layer in the protocol stack does DNS happen?

dns, http, tcp

Solution

DNS is a protocol that arguably sits at the application-level, but is a separate application in and of itself that makes use of the whole TCP/IP "stack". (LDAP is similar, if that helps "place" DNS.) It's a fundamental "phone book"-like directory for the Internet and has absolutely nothing specific to do with the HTTP protocol. DNS uses UDP and TCP transport to query other distributed DNS servers to answer client questions like "what IP addresses are associated with the name www.google.com?". Once a client application, like a web browser, has an IP address with which to connect, DNS is then out of the picture. The browser opens up a TCP connection to the IP address and then initiates the HTTP protocol over that TCP transport session to talk web stuff.

Problem

Let's use a browser as an example. HTTP requests do not need to contain any IP addresses. So would www.example.com be translated into an IP address at the TPC layer? EDIT Seems like DNS is used to tell TCP which IP address to connect to. So does HTTP call DNS? With this stack: HTTP DNS TCP

Original source