Part 2: Getting to Know the Network

Part 2: Getting to Know the Network

Seeing Bob's Web Request From the Network's Perspective

From our last encounter in the previous episode, we saw Bob send a web request to Google's web server using the URL https://www.google.com. In that episode, we understood a few things through Bob's eyes.

In this episode of "The Google Search Process," we will explore the journey of Bob's web request as it travels through the internet. Our focus will be on how the network manages and processes Bob's request, regardless of its geographic location, to reach Google's web server. We will also discuss how each network stack layer (TCP/IP) handles the request.

Introduction to TCP/IP

TCP/IP, or Transmission Control Protocol/Internet Protocol, is the suite of communication protocols used to interconnect network devices on the Internet. It can also be used for communications in private networks such as intranets or extranets. Bob is using this protocol to enable him to surf the internet.

What It Entails

TCP/IP specifies how data should be packaged, addressed, transmitted, routed, and received at the destination. It involves two main protocols:

  1. TCP (Transmission Control Protocol): This protocol is connection-oriented, meaning it ensures the delivery of packets to the destination router by establishing a connection. It provides reliable, ordered, and error-checked delivery of a stream of bytes.

  2. IP (Internet Protocol): This protocol is responsible for addressing and routing data packets to travel across networks and arrive at the correct destination.

Uses of TCP/IP

TCP/IP is used extensively for both internet and private network communications because of its interoperability and robustness. Here are some of its uses:

  • Web Browsing: When you use a web browser, it’s the HTTP protocol over TCP/IP that fetches the web page from the server to your browser.

  • Emails: Protocols such as SMTP, POP3, and IMAP used for email services are built on top of TCP/IP.

  • File Transfers: FTP, a standard network protocol, uses TCP/IP to transfer files from one host to another.

  • Connecting Devices: TCP/IP is used to link devices together, forming a network. This includes everything from your local home network to the vast reaches of the internet.

In other words, TCP/IP plays a fundamental role in modern digital communication, providing the foundation for all internet activities. For this reason, Bob needs this to ensure his web request is properly handled throughout its lifetime.

Let's explore how Bob's web request travels through the TCP/IP stack layers. Refer to the image below to get an idea of the different layers available.

An image describing the different layers of the TCP/IP model with familiar concepts

The Web Request at the Application Layer

At the application layer of the TCP/IP model, Bob's web request is typically encapsulated within the data payload of a TCP segment. This is where high-level protocols such as HTTP and HTTPS operate. When a user, for instance, clicks on a link or types a URL into a browser, the browser formats an HTTP request message. This message includes the HTTP method, the path to the resource, and a set of headers that carry metadata about the request.

The HTTP request does not concern itself with the lower layers of the TCP/IP stack; it simply hands over the request to the transport layer, trusting the underlying layers to deliver the message to the intended server. The server (Google's web server in Bob's case), upon receiving the request, processes it according to the HTTP or HTTPS protocol, generates a response message, and sends it back to the client through the same layering process.

The application layer is oblivious to the complexities of the lower layers, such as IP addressing, packet fragmentation, or physical transmission of data, focusing solely on the syntax and semantics of the application data. Here's an example of how the web request looks from the application layer's standpoint.

In the image above, you should see something familiar. The user-agent header, remember we discussed that it is the program that sends the request on the user's behalf. You could also see the method we are using which is simply to GET webpage in Bob's case. Oh look, we see that Bob is going to www.google.com. Let's explore the transport layer next. For more details on these terms, check out the previous episode.

The Web Request at the Transport Layer

At the transport layer of the TCP/IP model, Bob's web request is encapsulated within the Transport Control Protocol (TCP). This layer is crucial for managing the end-to-end communication between the client and the server. When a web request is made, TCP takes charge of breaking down the data from the application layer into smaller packets (i.e., segments), ensuring that each packet is reliably sent to the destination.

Each TCP packet includes a header with vital information such as source and destination ports, sequence and acknowledgment numbers, and flags to manage the state of the connection, such as SYN and ACK in the case of establishing the three-way handshake connection, or FIN to terminate it. Check the image below to see the three packets exchanged during the three-way handshake.

The transport layer is responsible for error detection and correction; it ensures that packets are delivered in order and without errors, retransmitting them if necessary. It also handles flow control, preventing the sender from overwhelming the receiver with too much data at once.

In essence, at the transport layer, the web request is a stream of TCP segments, each carefully orchestrated to ensure data integrity and proper communication flow. The content of the web request itself, such as HTTP methods, headers, and body content, is encapsulated within these TCP segments. It's a process that exemplifies the complexity and efficiency of network communications, enabling the robust and reliable exchange of data that forms the backbone of internet interactions today.

The Web Request at the Network Layer

At the network layer of the TCP/IP model, Bob's web request is encapsulated within an IP packet. This layer is responsible for the logical addressing of hosts and the routing of packets across multiple networks and subnets. When a web request is made, the network layer takes the segment from the transport layer, which includes the TCP header and the web request payload, and encapsulates it within an IP packet by adding its own header.

The IP header contains important information such as the source and destination IP addresses, which are essential for routing the packet across the internet. The packet is then forwarded to the next hop in the network, based on the routing table's information. It's important to note that at this layer, the content of the web request is not inspected; the focus is on delivering the packet to the correct destination.

The network layer does not concern itself with the application data, which might include HTTP methods like GET or POST, nor does it deal with the establishment of the connection, which is managed at the transport layer with TCP. The network layer's primary goal is to deliver packets efficiently and handle any fragmentation or reassembly that may be necessary if the packets are too large for the network's maximum transmission unit (MTU).

Essentially, at the network layer, a web request is seen as a series of IP packets, each with the goal of reaching the destination IP address, where higher layers will then process the actual request content.

At the data link layer of the TCP/IP model, Bob's web request is encapsulated into frames before it is transmitted over the physical medium. This layer is responsible for node-to-node delivery of the message. In the context of a web request, the data link layer takes the network layer's IP packets and encapsulates them into frames, each with its own header and trailer that include information necessary for the frame to be directed to the correct destination and for error detection.

The header typically contains the physical address (MAC address) of the sender and receiver as well as control information. The trailer usually contains a frame check sequence (FCS), which is used to detect any errors that may have occurred during transmission. Once the frame is prepared, it is sent to the physical layer, where it is converted into signals and transmitted over the network.

It's important to note that the data link layer does not understand the contents of the web request; it simply packages the IP packets for delivery. The actual content of the web request, such as HTTP headers and payload, is prepared at higher layers of the TCP/IP stack before being handed down to the data link layer for framing and eventual transmission.

The Web Request at the Physical Layer

At the physical layer of the TCP/IP model, Bob's web request is represented by electrical signals, light pulses, or radio waves, depending on the physical medium of transmission. This layer is concerned solely with the transmission and reception of the raw bitstream over a physical medium.

It defines the electrical and physical specifications for devices, including the layout of pins, voltages, cable specifications, hubs, repeaters, network adapters, and more. For example, when Bob sends his web request from his computer, the data is converted into a format suitable for the physical network. It could be turned into electrical signals if transmitted over copper cables, light pulses if via fiber optics, or radio waves if via wireless.

The physical layer is responsible for the rate at which the data is sent, the modulation of the data, and the conversion of digital bits into signals and vice versa at the receiving end. It's important to note that the physical layer does not understand the content of the data; it merely deals with the establishment, maintenance, and deactivation of the physical link. It's akin to a delivery truck that doesn't know what's inside the packages it's transporting; it just knows the destination where the packages need to be dropped off.

The complexity of what happens at the higher layers of the TCP/IP model, such as packetizing, addressing, managing data flow, error handling, and the actual content of the web request, is abstracted away at the physical layer. It is the foundation upon which the higher layers build a more sophisticated and functional network communication system.

The Web Request on its Way to Google

At this point in the web request's journey, it is out of Bob's home office and headed into the mysterious world of the internet to find Google's web server and knock on its door. When it does, Google's web server will go through the same process Bob's web browser went through but in the reverse. This other process is called decapsulation.

In the next episode, we will discuss how Google's web server receives Bob's web request and how it processes it and ultimately reply Bob. We will learn new terms like load balancer, firewalls, and, application and database servers.

By now Bob might be running out of coffee waiting for his request, let's help him get to Google's web servers quickly so he can continue with his daily routine. See you in the next episode where to get to know the server.