Something I get asked a lot, especially when working in schools with inquisitive young minds is “How does the internet work?”
What they actually mean is “how do websites open on my computer”? The ‘internet’ is much bigger and that’s a post for another day.
We all know that when we type “Google.com” into our web browser, the Google website will load. The same with any other website address you care to imagine; bbc.co.uk, facebook.com… whatever.
But how does that work?
Well the internet works thanks to something called “DNS”.
Imagine DNS (Domain Name System) as a phone directory for the internet. When you type a web address like “www.example.com” into your web browser (Chrome, Edge, Internet Explorer, Safari, etc), your computer needs to find the actual numerical address or “Internet Protocol (IP) address”, associated with that name.
An IP address is a series of numbers which is unique to every website. Humans find remembering words like Google and Facebook much easier than remembering their IP address.
For example, Facebook’s IP address is 188.8.131.52.
It’s much easier to just remember facebook.com, right?
Well computers disagree, they prefer numbers, so that’s where DNS comes in. DNS translates the words to numbers.
Here’s how it works:
You Type a Web Address: You type a web address (like “www.example.com“) into your browser.
Your Computer Checks Its Local Cache: Your computer first checks its local cache to see if it already knows the IP address for that website, if you have visited it recently it will remember it. If it does know, it can skip the next steps and go directly to the website.
Asking the DNS Resolver: If it doesn’t know the address, your computer asks a special server called a DNS resolver. This is usually provided by your internet service provider (BT, Virgin, Plusnet… whoever). If you work for a larger organisation your IT Support team will have a DNS server on-site too.
DNS Resolver Searches: The DNS resolver may already have the address in its cache. If not, it starts searching. It has a few options:
Root DNS Servers: These servers know how to find information about top-level domains like .com, .org, etc.
TLD DNS Servers: They know where to find information about specific domains, like example.com and facebook.com.
Authoritative DNS Servers: These servers hold the specific information about a domain. For example, the authoritative DNS server for “example.com” knows the IP address for it.
Getting the IP Address: The authoritative DNS server sends the IP address back up the chain to the resolver.
Returning to Your Computer: The resolver sends the IP address back to your computer.
Accessing the Website: Now your computer knows the IP address and can use it to request the webpage from the server where the website is hosted.
Think of it like asking for directions to a place you’ve never been. If you don’t know the way, you ask someone (the DNS resolver) who might know, if they don’t they ask others (the DNS servers) until they get the specific directions (the IP address) you need.
This process happens incredibly quickly, allowing you to access websites with just a click!
Just imagine how many people are browsing the web at any one time and imagine how many DNS requests the servers are resolving every second.