IP addresses are how computers identify other computers on the Internet. IP addresses aren't particularly human-friendly, though. Who wants to memorize an address like
? Or the even longer IP v6 addresses?
The Domain Name System (DNS) gives us humans an easy way to identify where we want to go on the Internet.
We simply type in a domain name like "www.wikipedia.org", and our computer connects us to the computers powering Wikipedia:
A domain name is a human-friendly address for a website, something that's easy for us to remember and type in.
Anatomy of a domain name
Each domain name is made up of parts:
There are a limited set of top level domains (TLDs), and many websites use the most common TLDs, ".com", ".org", and ".edu".
The second level domain is unique to the company or organization that registers it, like "wikipedia" or "khanacademy".
The third level domain is also called a subdomain, because it's owned by the same group and that URL often directs you to a subset of the website, like "m.wikipedia.org" (mobile-optimized Wikipedia) or "es.khanacademy.org" (Spanish-language Khan Academy).
Domains ↔ IP addresses
Behind the scenes, each domain name maps to an IP address. When we type a URL in the address bar of our browser, the computer has to figure out its IP address.
The computer can't store a database of more than 300 million domain names locally, so it goes through a multi-step process to find out the IP address.
Step 1: Check the local cache
If you've visited a website once, there's a fairly good chance you'll visit it again. That's why computers keep their own local cache of domain name to IP mappings. The cache stays small, because it kicks out domains you haven't visited in a while or domains that send down expiration dates.
🔍 In the Chrome browser, you can view the database yourself. Just type "chrome://net-internals/#dns" in the address bar.
Here's a snippet from my browser's cache:
Step 2: Ask the ISP cache
Every ISP (Internet Service Provider) provides a domain name resolving service and keeps its own cache. Perhaps you've never visited a particular website but your neighbor just did, so the ISP can lookup the domain name mapping from their visit.
If it's not in the ISP's cache, then it's off to the next step.
Step 3: Ask the name servers
There are domain name servers scattered around the globe that are responsible for keeping track of a subset of the millions of domain names.
The servers are ordered in a hierarchy:
Root name servers → TLD name servers → Host name servers.
The ISP starts by asking the root name servers: "hey, which name server knows about .org domains?" The root name server responds with the IP address of a TLD name server that tracks ".org" domains.
Next, the ISP asks the TLD name server: "so, who knows about wikipedia domains?" The TLD name server responds with the IP address of a host name server that contains the "wikipedia" records.
Finally, the ISP asks the host name server: "okay, so where's www.wikipedia.org?" The host name server responds with an exact IP address.
The ISP sends the IP address back to the requesting computer, and now our computer can successfully connect with the computer powering that domain.
If that sounds like quite a process: yes, it is! But don't worry, it's not done that often. A lot of information is cached along the way, so it's rare that a DNS lookup has to go through so many steps.
When a lookup does have to go through all the steps, there are multiple name servers that can answer each question, so a computer doesn't have to wait too long for a response or worry about a name server going down.
We've had the domain name system since 1985, and it's scaled impressively to match the growth of the Internet, thanks to its hierarchy, redundancy, and caching.
Want to join the conversation?
- when I look at chrome://net-internals/#dns it doesn't show anything beyond a button that says 'Clear host cache' -- nothing like what you have in the lecture. Does this mean that nothing is cached? If so, why would that be the case?(28 votes)
- Am I the only person confusing about the TLDs name and root name? As the lecture writes: There are a limited set of top level domains (TLDs), and many websites use the most common TLDs, ".com", ".org", and ".edu", why is that ISP domain resolver needs to ask a root name server about ¨.org¨?
And finally, is that host name is the same domain name?(5 votes)
- Think of the web address as a tree with the root being the last part (org, com, and so on) and then growing from there to the left.
Root name servers are responsible for keeping track of the servers that keep track of the e.g. org domains.
The process is basically to start at the most general part of the webadress and from there working your way down to the more specific parts. You would probably work the same way if I asked you to search for lyon, france on a map (start by finding europe, then look for france and then you search for lyon).
In this case yes, there are the same.(8 votes)
- Why does the ISP domain resolver have to go through 3 steps? Couldn't it just ask what's the IP address for wikipedia.org?(5 votes)
- Sometimes computers need to over copulate things. They aren't humans so they don't know any better(8 votes)
- What is the difference between a URL and a domain name?(4 votes)
- URL stands for Uniform Resource Locator; a URL is used to identify a resource on a network. A domain name is generally specified in a URL. For example, the URL https://www.khanacademy.org/computing specifies a protocol (Hypertext Transfer Protocol Secure - HTTPS), a domain name (khanacademy.org), and a resource (/computing).
A domain name is resolved through DNS (Domain Name System) which maps it to an Internet Protocol address. Once the I.P. address has been resolved, your device can locate the resource it wishes to request.(9 votes)
- So to understand correctly, essentially when we type in a domain name, the computer we are using is connecting straight to the computer/servers of the site we are accessing? Routed of course through multiple, well, routers (lol).
I suppose this seems obvious but until a tangible definition was presented I always wondered how that worked. With that information now, it's really quite astounding and fascinating!(6 votes)
- Also, all the individual packets of information going between your computer and theirs will go through different routers! They all find their own way, like hippies converging via various routes on a music festival, not like soldiers marching in a column.(4 votes)
- Why wouldn't the ISP Domain Resolver only ask the hostname server, instead of going through all of the steps to get to asking the hostname server?(2 votes)
- Because the domain resolver doesn't know which hostname server to ask for the information. Those steps beforehand are necessary to actually find it.
Randomly asking hostname servers wouldn't be efficient.(4 votes)
- what does it means when some websites blocked?
and why it can be accessed by using public dns?
i know this is basic lesson so maybe what im asking not in the right place(2 votes)
- It might mean that you have a content blocker on your system, that prevents you from accessing certain websites. That's done by specifying those sites, if the blocker is badly implemented you might circumvent the blocker in which case a DNS will just point you to the site.(3 votes)
- what is DNS over Http? Also Does it safe to use third-party DNS and how to use third-party DNS?(1 vote)