To most people, the internet is a bit of a mystery. You plug into it, and suddenly, all the information in the world is at your fingertips. The world outside your computer or smartphone is a wildly complex jungle of servers and nodes that direct your traffic with such efficiency that the time it takes for you to go to a website and have it load is almost imperceptible. It’s staggering to believe that a packet of information can travel to a remote server on the other side of the world and arrive back with data in tow in a fraction of a second, but it's completely possible in today's world.
Unfortunately, the way the internet works is a pretty broad topic that’s best taken a piece at a time. Perhaps the proper place to start is to look at how your browser even knows how to get to google.ca when you go to search for a takeout menu. It does this using a service called DNS, or Domain Name System, which acts kind of like the internet’s phonebook. Like a phonebook, you start with just a name and are in search of its associated number.
HOSTNAME AND THE INTERNET PROTOCOL ADDRESS
Our journey begins with your computer, phone, tablet, fridge, or whatever you’re using to access the internet. Whatever you choose, like every other device on the internet, it’s is identified in two ways; the first is by its hostname (e.g. coolphone2 or www.justfixit.com), and the other is by the less human-friendly internet protocol address, or IP address (e.g. 192.168.5.5).
Every node in the wild wooly world of networks has these identifiers. When you plug www.google.ca into your web browser, you’re searching by hostname. Your browser still needs the IP address to locate the server, so it sends a packet of data called a query out to find the hostname’s corresponding IP address.
ASKING THE SERVERS
The first place the packet stops is called the recursive nameserver. The recursive server is typically either hosted by the internet service provider you’re connecting with (such as Rogers or Bell) or by a third party, like Google or OpenDNS. The recursive server has the job of acting on behalf of the computer that made the request. It starts by checking its own DNS cache, which contains records of recently queried servers. If you’ve used google.ca recently, it may already know its location and can provide it immediately. If it doesn’t know, it then passes the query to a root nameserver.
Every domain has a secret implied “.” On the end of it (eg. www.google.ca.) and that’s where the root nameserver starts. The root nameservers work backwards by providing the recursive nameserver with the location of the servers that contain information on that .com or .ca at the end of your query; that’s the top-level domain (TLD) nameserver.
The TLD nameserver, like the root nameserver, still doesn’t contain the actual address for the information we’re querying. However, it does know where to find everything that lies before the “.ca” in our address. The top-level domain refers to the .com or .ca in the address, with each server being a repository for that top-level domain. From its repository for .ca addresses, it knows where the Google domain is registered, and it sends the recursive nameserver there for its next stop.
Finally, the packet arrives at the answer it seeks, the definitive phonebook, the authoritative nameserver. The authoritative server contains all the domains that were registered with it, finally providing the sought-after IP address to the recursive nameserver, which then relays it back to your browser so you can place your takeout order.
AROUND THE WORLD IN 80MS
This all happens in the blink of an eye, or more commonly, even faster than that. It may seem inefficient for so many nameservers to be consulted when you’re trying to do a simple search, but when you consider that the internet consists of millions of domains that are registered at any number of locations, it’s a lot to keep track of.
The nameservers themselves exist all over the world to ensure that there’s always one nearby to connect to. Much of this is overseen by the Internet Corporation for Assigned Names and Numbers (ICANN), a non-profit organization that works to maintain the neutrality of the entire system. The physical servers are hosted by a variety of corporations, balancing the load across the globe. It’s not a perfect system, but it’s an impressive one that ensures our takeout menus are always just a few milliseconds away.