Computer networks are what make the Internet possible. Despite the Internet being an indispensable part of our daily lives as well as our jobs as software engineers, it often seems like a magical black box that just works (or if it doesn’t work, we’re not sure why). To understand how the Internet works, I’ll be taking a look at the fundamentals of computer networking in a series of articles.
What is a Computer Network?
A computer network is simply a bunch of computers that are connected together so they can talk to one another. More formally, a computer network is two or more computing devices that are connected with the purpose of sharing data and resources.
Devices in a network are connected via physical (cables, fiber optics) or wireless technologies, allowing them to communicate with one another using a set of standardised rules (protocols).
There are several types of networks, each for different needs - some of these include:
Local Area Network (LAN): connects computers over short distances - eg. connecting computers in a school or building
Wireless Local Area Network (WLAN): like LAN but connections are wireless
Metropolitan Area Network (MAN): size is between LAN and WAN - eg. connecting computers across a city
Wide Area Network (WAN): connects computers over a wide area, such as computers across a continent - eg. the internet is the largest WAN in the world
Virtual Private Network (VPN): secure, point-to-point connection between two network end points - establishes an encrypted channel
Common Terminology
Here are some common terms used in computer networking:
Node: a device connected to a network, including computers, servers, routers, switches and other devices - nodes can receive, send, create or store data
Host: a node, usually a computer or server, that has its own IP address and actively engages in network communication by initiating communication with other devices and responding to requests from other hosts - hosts are a subset of nodes
Switches: a device that connects other devices and manages node-to-node communication within a network (routers connect networks, while switches connect nodes within a network)
Routers: a physical or virtual device that connects networks by sending data packets between them - routers decides a packet’s future path by examining the destination IP address of the packet’s header and comparing it to its routing database
Internet Protocol (IP) Address: a unique number that identifies a device on the internet or local network. IP addresses are important as they are crucial in figuring out where to send data to
Port: a virtual point where network connections start and end. Each port is associated with a specific process or service - as lots of different types of data flow to and from a computer, ports helps computers understand where should data go and what to do with them
Protocol: a standardised set of rules or algorithms that define the way how two entities communicate across the network
How do Computers Talk to Each Other?
Let’s say you want to send a message using your computer to another computer in another network - what happens? Here’s a high-level overview:
First, the message is broken down into data packets which contain two parts: a header and a payload. The header includes information such as the source and destination IP addresses, while the payload contains the message.
Second, the packets are sent from the source node to the destination node through a series of intermediary nodes such as switches and routers. Routers examine the destination IP address in the packet header and decides the best path for forwarding the packet towards its destination.
Third, when the destination node receives the packets, the packets are reassembled into the original message and processed accordingly.
How does the Internet work?
The Internet is a behemoth network of networks that enables communication on a global scale. It consists of millions of interconnected networks owned by various organisations, internet service providers (ISPs) and backbone providers. As it is still a network, at a high-level, it works the same way as described in the previous section.
Let’s say you want to send an image from your phone to your friend Alex halfway across the world. The image is first broken down into data packets that is sent to your wireless router via radio technology (here’s a video by Wendover that explains how this works). The router then transmits your data packets via electrical signals (copper wires) or flashes of light (fiber optics) to your ISP.
Next, your ISP sends these data packets to an internet hub where networks are connected together with each other. Because Alex is halfway across the world, these data packets will be further forwarded to the internet backbone providers that have laid out vast arrays of cables to connect up networks across large areas. One such example is the underwater cables that connect up networks across vast bodies of water - here’s a snapshot of the Submarine Cable Map by TeleGeography:
When the data packets are transmitted across the ocean to reach an internet hub where Alex is, the packets are forwarded to Alex’s ISP, which then transmits them to his wireless router and to his phone via wireless technology. Lastly, his phone re-assembles the packets into an image.
All this happens in a split second - genuinely mind-boggling!
Here’s a great video by Vox that explains how the Internet works using helpful visual materials.
Conclusion
While the Internet might seem like magic, at its core it is a computer network. Computer networks enable computers to communicate with each other by routing data packets using switches and routers until it reaches the destination.
If you found this helpful, please share it with a friend and do consider subscribing 👇🏼
Thanks for reading,
Nicholas Lim