How DNS Works - Computerphile

Computerphile · Intermediate ·📐 ML Fundamentals ·6y ago

Key Takeaways

The video explains the Domain Name System (DNS) and how it resolves IP addresses to domain names, covering recursive resolvers, root name servers, and authoritative name servers. It also touches on DNS caching and query IDs.

Full Transcript

so i thought today we talked about dns or the domain name system um this is a service that runs on all of our computers um but obviously it's run mostly over the internet by big servers the idea is that we want to try and resolve ip addresses to domain names for example i go to youtube.com then at some point i'm going to have to work out what the ip address of that server is so that i can ask it using http to give me some some amazing computer file videos right so to do that there needs to be some system in place because me just guessing an ip could take quite a long time so the domain name system is the the system we use to to do this right so i'm going to type in either on a url bar in my browser or on the command line a and i a domain name and then it's going to have to be resolved to an ip and then i can actually communicate with that server to do whatever it was i wanted to do so just to clarify if i put in computer file dot website or something like that something somewhere needs to know where to find that there will be usually one or two authoritative name servers which are serviced that can specifically say it's this ip right and i have no idea where they are that's not the point right the point is we can find out where they are this is the mechanism that dns uses we don't know where anything is so we ask a few things that we know where they are and then they help us on and we kind of keep asking we keep asking going to door-to-door and then eventually find out what the answer is or we don't and then you get a couldn't find the dns uh couldn't find a domain uh no website so let's imagine i've gone to my um i've gone to my browser or i've typed in google.com or something like that so my computer will have a cache of lots of domain names that i've visited recently but they will last maybe one or two hours for ones on my computer so let's assume that we've just turned a computer on after a week or something like that and um and so it doesn't know where google.com is it will have to make a a dns query to find out what it is now the first point of contact will usually be a name server that belongs either to you know your organization that you're in so let's say the university of nottingham will have a name server or two or it'll be your isp if you live at home probably or you might have configured something like opendns yourself and you might have one yourself but let's assume for the sake of argument that we're using i know our isp's domain name server right so so this is our computer here and we want to go to some website so let's say google.com now we don't know what the ip address of google.com so we're going to have to ask some other computer that might know what would normally happen here is we would ask a name server that we've either configured ourselves or that is let's say given to us by our isp right so i'm going to connect to my isps server here isp and this is their name server and i'm going to say google.com question mark right i mean there'll be a few other bits of information in that not just google.com it's a rhetorical question um now this server will either know because it has a little cache of of stuff that it can look up right now if someone else has been to google.com recently which is obviously quite likely it would know what that is and it will give that information back but let's assume that it doesn't and let's also assume that this is set up to be what we would call a recursive resolver so that means it can not only answer queries about dns but it can also ask queries about dns it's got to ask another machine that it thinks might know the answer now it hasn't got the foggiest idea right because there are a lot of different ip addresses so what it's going to do is it's going to pick from a list of root name servers right so it's going to talk up here on the internet to a root name server so the name server will go off to the root name server of which is about 20 now these are hard-coded all computers have access to these um i think one of them's run by verisign for example one of them's run by nasa no i i don't know why um but it is so um this root gnome server will say i don't know i don't know what google.com ip address is this this day right because they maybe they turn their computer off and on again and it's changed so what but i do know is that this ip address of this global top level domain name server could help you right and there might be a few of these as well so it's going to send us a comm name server right or multiple ones and one will pick one now this dot com name server we're getting a little bit closer so it's kind of working way backwards through the url in some sense or through the domain name so we will put in a request to this dot com name server it will say i don't actually know but i do know that the next place you should ask or the kind of the name server that's responsible for this zone is let's say ns1.google.com or something like that now we're getting a lot closer right this is a good name server let's let's say hypothetically it's run by google they're going to know what their own ips are like if they don't then google isn't going to work right this is like lesson one of where web administration so we actually put in a request to ns1.google.com this is another referral sort of spelt right with a bit of a mess with my pen and they're gonna send back when we actually query ns1.google.com what is google.com it will finally actually tell us it is you know 10.0.1.2 right now it definitely isn't that but you know you know that's the idea so we finally have an ip address now what we can actually do now is send an http get request or a ping or whatever it is we want to do to that ip and then we can get a response right so that's how it works now the dns service is a little bit more clever than this sort of overview right because of this caching and stuff like this so i have a cache here and this recursive resolver will also have a cache and any other resolvers involved will also have a cache let's suppose this isps name server is serving 10 000 customers right all of whom are going to google this is a bit of a waste of time right especially given that google probably not changing their ip every hour and so the first person in the morning that gets up and goes to google.com is going to have to wait fractions of a second longer because it's going to be doing this um but then google.com will be put into this cache with a time to load time to live and then for that amount of time this will just serve that straight back right so what is google.com it's this right it's 10.00.1.2 whatever um and that means that this this name server which will be quite powerful can serve all the isps customers really really quickly which is kind of neat this is basically a distributed database this name server is going to be putting in lots and lots of requests right to hundreds of servers probably per second because of all the people on the internet asking i want to go to randomwebsite.com random.website.com website.random and so on and it's going to be doing all this how does it know what to do with any of this all this gibberish of information is coming back well what it does is it has a query id which it sends out whenever it sends out a request and the name server that responds will respond with the same query id so it's labeled effectively it's labeled right so and that allows it to sort through the mess a little bit more it leads to a slightly interesting quirk which is that if i send a response to a name server but it didn't want but i get the query id right it will accept it right which is for a different video that's dns cache poisoning for the most part that doesn't happen right for the most part the query ids match and everything works out quite well and it's really really quick so what is she she's a corn snake albino corn snake but she's in the middle of shedding and she's she's grumpy and hiding under a rock and probably asleep so you know that's that's the best of you you're going to get at the moment we might see her another time yeah that's right

Original Description

How do websites marry up to their IP addresses? Dr Mike Pound explains the Domain Name System - DNS. https://www.facebook.com/computerphile https://twitter.com/computer_phile This video was filmed and edited by Sean Riley. Computer Science at the University of Nottingham: https://bit.ly/nottscomputer Computerphile is a sister project to Brady Haran's Numberphile. More at http://www.bradyharan.com
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Computerphile · Computerphile · 0 of 60

← Previous Next →
1 Follow the Cookie Trail - Computerphile
Follow the Cookie Trail - Computerphile
Computerphile
2 EXTRA BITS - Follow the Cookie Trail - Computerphile
EXTRA BITS - Follow the Cookie Trail - Computerphile
Computerphile
3 Musical Floppy Drives - Computerphile
Musical Floppy Drives - Computerphile
Computerphile
4 The Hair Algorithm - Computerphile
The Hair Algorithm - Computerphile
Computerphile
5 Getting Sorted & Big O Notation - Computerphile
Getting Sorted & Big O Notation - Computerphile
Computerphile
6 Quick Sort - Computerphile
Quick Sort - Computerphile
Computerphile
7 Hyper History and Cyber War - Computerphile
Hyper History and Cyber War - Computerphile
Computerphile
8 Entropy in Compression - Computerphile
Entropy in Compression - Computerphile
Computerphile
9 Original Elite on the BBC B - Computerphile
Original Elite on the BBC B - Computerphile
Computerphile
10 IP Addresses and the Internet - Computerphile
IP Addresses and the Internet - Computerphile
Computerphile
11 A Career in Video Games - Computerphile
A Career in Video Games - Computerphile
Computerphile
12 Error Detection and Flipping the Bits - Computerphile
Error Detection and Flipping the Bits - Computerphile
Computerphile
13 Programming BASIC and Sorting - Computerphile
Programming BASIC and Sorting - Computerphile
Computerphile
14 Birthplace of the World Wide Web - Computerphile
Birthplace of the World Wide Web - Computerphile
Computerphile
15 Punch Card Programming - Computerphile
Punch Card Programming - Computerphile
Computerphile
16 Programming Paradigms - Computerphile
Programming Paradigms - Computerphile
Computerphile
17 CERN Computing Centre (and mouse farm) - Computerphile
CERN Computing Centre (and mouse farm) - Computerphile
Computerphile
18 Error Correction - Computerphile
Error Correction - Computerphile
Computerphile
19 Home-Made Code - Computerphile
Home-Made Code - Computerphile
Computerphile
20 Security of Data on Disk - Computerphile
Security of Data on Disk - Computerphile
Computerphile
21 Gesture Controls - Computerphile
Gesture Controls - Computerphile
Computerphile
22 How Intelligent is Artificial Intelligence? - Computerphile
How Intelligent is Artificial Intelligence? - Computerphile
Computerphile
23 Encryption and Security Agencies - Computerphile
Encryption and Security Agencies - Computerphile
Computerphile
24 Virtual Machines Power the Cloud - Computerphile
Virtual Machines Power the Cloud - Computerphile
Computerphile
25 Hacking Websites with SQL Injection - Computerphile
Hacking Websites with SQL Injection - Computerphile
Computerphile
26 How Huffman Trees Work - Computerphile
How Huffman Trees Work - Computerphile
Computerphile
27 Cracking Websites with Cross Site Scripting - Computerphile
Cracking Websites with Cross Site Scripting - Computerphile
Computerphile
28 Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Computerphile
29 Texting Cabbage with a Recorder - Computerphile
Texting Cabbage with a Recorder - Computerphile
Computerphile
30 Hashing Algorithms and Security - Computerphile
Hashing Algorithms and Security - Computerphile
Computerphile
31 How YouTube Works - Computerphile
How YouTube Works - Computerphile
Computerphile
32 How NOT to Store Passwords! - Computerphile
How NOT to Store Passwords! - Computerphile
Computerphile
33 A New Golden Age of Video Games - Computerphile
A New Golden Age of Video Games - Computerphile
Computerphile
34 A Universe of Triangles - Computerphile
A Universe of Triangles - Computerphile
Computerphile
35 Cross Site Request Forgery - Computerphile
Cross Site Request Forgery - Computerphile
Computerphile
36 The True Power of the Matrix (Transformations in Graphics) - Computerphile
The True Power of the Matrix (Transformations in Graphics) - Computerphile
Computerphile
37 The Great 202 Jailbreak - Computerphile
The Great 202 Jailbreak - Computerphile
Computerphile
38 EXTRA BITS - Printing and Typesetting History - Computerphile
EXTRA BITS - Printing and Typesetting History - Computerphile
Computerphile
39 Triangles to Pixels - Computerphile
Triangles to Pixels - Computerphile
Computerphile
40 The Problem with Time & Timezones - Computerphile
The Problem with Time & Timezones - Computerphile
Computerphile
41 The Visibility Problem - Computerphile
The Visibility Problem - Computerphile
Computerphile
42 Lights and Shadows in Graphics - Computerphile
Lights and Shadows in Graphics - Computerphile
Computerphile
43 The Penguin Barcode - Computerphile
The Penguin Barcode - Computerphile
Computerphile
44 Typesetters in the '80s - Computerphile
Typesetters in the '80s - Computerphile
Computerphile
45 The Font Magicians - Computerphile
The Font Magicians - Computerphile
Computerphile
46 The Little Mac with the Big Bite - Computerphile
The Little Mac with the Big Bite - Computerphile
Computerphile
47 EXTRA BITS - More on the Original Mac at 30 - Computerphile
EXTRA BITS - More on the Original Mac at 30 - Computerphile
Computerphile
48 XP to Ubuntu with an 8yr old Hacktop - Computerphile
XP to Ubuntu with an 8yr old Hacktop - Computerphile
Computerphile
49 EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
Computerphile
50 EXTRA BITS - Making a Bootable USB in Linux - Computerphile
EXTRA BITS - Making a Bootable USB in Linux - Computerphile
Computerphile
51 EXTRA BITS - Installing Ubuntu Permanently - Computerphile
EXTRA BITS - Installing Ubuntu Permanently - Computerphile
Computerphile
52 The Dawn of Desktop Publishing - Computerphile
The Dawn of Desktop Publishing - Computerphile
Computerphile
53 What is Bootstrapping? - Computerphile
What is Bootstrapping? - Computerphile
Computerphile
54 Reverse Polish Notation and The Stack - Computerphile
Reverse Polish Notation and The Stack - Computerphile
Computerphile
55 Home-Made Z80 Retro Computer - Computerphile
Home-Made Z80 Retro Computer - Computerphile
Computerphile
56 Should Everybody Learn to Code? - Computerphile
Should Everybody Learn to Code? - Computerphile
Computerphile
57 Programming in PostScript - Computerphile
Programming in PostScript - Computerphile
Computerphile
58 Heartbleed, Running the Code - Computerphile
Heartbleed, Running the Code - Computerphile
Computerphile
59 YouTube's Secret Algorithm - Computerphile
YouTube's Secret Algorithm - Computerphile
Computerphile
60 YouTube Search & Discovery - Computerphile
YouTube Search & Discovery - Computerphile
Computerphile

This video teaches the basics of the Domain Name System (DNS) and how it resolves IP addresses to domain names. It covers the process of recursive DNS queries, DNS caching, and query IDs, and explains how DNS works to connect users to websites. Understanding DNS is essential for working with computer networks and the internet.

Key Takeaways
  1. Connect to an ISP's name server
  2. Ask the ISP's name server for the IP address of a domain name
  3. If the ISP's name server doesn't know, ask a root name server
  4. The root name server will direct the query to an authoritative name server that can provide the IP address
  5. Send a request to a root name server to find the IP address of a domain
  6. Query a higher-level domain name server, such as a .com name server, to find the IP address of a domain
  7. Send an HTTP GET request or a ping to the IP address of a domain
💡 DNS caching reduces the load on name servers and improves response times, making it a crucial component of the internet's infrastructure.

Related Reads

Up next
Is coding becoming obsolete? | Find out what's the new fundamentals
SCALER
Watch →