How DNS Works - Computerphile

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
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
Info
Channel: Computerphile
Views: 456,108
Rating: undefined out of 5
Keywords: computers, computerphile, computer, science, Computer Science, University of Nottingham, DNS, Domain Name System, Websites, IP, IP Addresses, Name Server, Domain Name Server
Id: uOfonONtIuk
Channel Id: undefined
Length: 8min 4sec (484 seconds)
Published: Thu Jul 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.