The Internet: How Does it Work?

    The Internet: How Does it Work?

      There are few things in life we hate more than the will-they-won't-they trope. Let’s pretend for a moment that the show writers have a way to engage viewers besides that one, view-bating relationship and the characters really do fall for each other. According to the 1940s lingo, they’re going steady—he gave her his pin and everything.

      Word gets around to you, the person who gave up on the show a whole season ago, so you head to your favorite, totally-legal TV-watching site to catch up to the current episode. Once you see The Big Moment (whether it's in an airport or the parking lot of a gas station), it moved you enough to head to Facebook and make a post about your dreams coming true.

      Friends comment, random internet users post headcanons, and some clickbait site uses all this as fodder to claim, "they finally broke the internet."

      Besides appreciation of true love (and an obvious ploy for readers), what’s happening here?

      Connecting to the Net

      The magic of the internet plays out in a series of loops, like a boomerang. Think of that boomerang as a packet (an envelope with a piece of information in binary). The boomerang flies from your computer through routers and servers until it retrieves the stuff you want, turns around, and flies back to you—not necessarily along the original path.

      That doesn't sound like a very good boomerang, but stick with us for a second.

      To unpack(et) how this all happens, let’s start at your house. The Wi-Fi network that lets you watch eight hours of uninterrupted sitcom comes from an Internet Service Provider (ISP). When you turn on your computer, the ISP assigns it a new IP address for this session of TV-bingeing.

      Every domain name and device connected to the internet lives at a unique assigned IP address, and everything you do on the internet starts and ends at your current IP address. When you type "www.facebook.com" into their web browser, your computer looks for Facebook’s IP address so it can send you to Facebook.

      To find that IP address, your computer needs to send a request to a DNS server, so it wraps that domain name in a packet and stamps the header with your computer’s IP address and the address of the DNS server.

      That packet of 1s and 0s leaves your computer as radio waves of different frequencies—thanks to a conversion that takes place either inside a wireless internet card or a small Wi-Fi receiver. The packet travels through the ether until your wireless router catches it. The router then translates the packet back to binary and passes it along to the modem, which blasts it through the cable connected to your house.

      But wait, there's more.

      Now that the packet's out in the world, it needs to find the DNS. That packet zips in and out of several other routers and miles of cable until it hits the local DNS server. This particular DNS server might not know where to find the IP address for "www.facebook.com," making your request get passed along a chain.

      First it visits the root DNS servers, which know the IP address for the specific DNS server that manages .com domains. When it reaches the .com DNS server, that server's going to be able to send it on to the DNS server that holds the info about "www.facebook.com." Finally, the request hits that specific DNS server, which returns the IP address you need.

      That IP address gets wrapped up in a new packet, stamped with the IP address for your local DNS server, and sent back along its dizzying path until it reaches that local server, which passes it on until it returns to your modem, passes to your router, gets translated into radio waves, gets retranslated into binary, and unpacked on your web browser.

      [Phew] 

      Accessing that Facebook Feed

      So tantalizingly close to that Facebook feed. Now your web browser has to actually request the webpage located at the IP address that the DNS server just handed it. Your browser makes an HTTP "GET" request for the webpage (this time in its IP form). It sends this request inside—you guessed it—a packet. That packet completes a relay race similar to the one your DNS server request ran. The only difference is that, instead of returning an IP address, Facebook’s server sends back the HTML code for the site’s homepage.

      Facebook has a complicated design, meaning that all of that HTML code probably won’t fit in one packet. Facebook’s web servers—spread over massive data centers—distribute the code into bunches of packets, marking each with the destination IP address (yours) and instructions explaining how they’re all supposed to fit together.

      Since not every packet necessarily moves along the same path, and routers often have to redirect packets from traffic jams along the way, good ol’ Vint Cerf and Bob Kahn’s TCP/IP protocols act as quality assurance. IP sends all the packets between the many computers along their path to yours. TCP then checks over the received collection of packet data to make sure everything was delivered. If all the packets made it, then TCP sends a receipt to the server verifying that the page was completely delivered. If something fell behind, TCP requests Facebook’s server to resend missing packets until all the data ducks line up. Your browser then reassembles the packets in order based on the instructions and voilà. Welcome to Facebook.

      But…we still aren't finished yet. The HTML code patched together in those packets includes all the text on the webpage, but a site like Facebook holds a lot more than just text. Besides, everyone watched as

      • Ross and Rachel
      • Jim and Pam
      • Chapman and Vause
      • Ted and Your Mother

      finally got together and they're posting all kinds of reactions. All those adorable pictures, videos, and GIFs live at their own URLs, and your browser has to send HTTP GET requests for all of them individually. The protocol-monitored cycle of packet shipping continues until the webpage loads completely and you can get your fill of everyone's excitement.

      No matter what site you're on, this is always how loading and interacting with the internet works.

      Plenty of this data travels a long distance before you can enjoy the latest headcanon updates and reaction GIFs from your Facebook friends. Depending on where it needs to go, your data could zoom (and we mean zoom) in the form of light waves through a fiber optic cable buried beneath the ocean before it reaches you. These cables, as fragile as they are expensive, form the backbone of the current, connected world.

      Treat your internet with tender love and care. Without it, you never would have known about whether that sitcom couple got together—much less all the reaction GIFs or dancing lady emojis.

      (Source 1Source 2, Source 3, Source 4, Source 5Source 6, Source 7, Source 8)