Fundamentals 11 min read

Understanding Network Communication: From IP Addresses to HTTP Requests

This article explains how computers exchange data packets over the Internet, covering MAC and IP addressing, subnet determination, static and dynamic IP configuration via DHCP, DNS resolution, and the step‑by‑step construction of TCP, IP, and Ethernet frames for a web request.

Java Captain
Java Captain
Java Captain
Understanding Network Communication: From IP Addresses to HTTP Requests

Previously we analyzed the overall design of Internet protocols from the bottom up; now we switch to the user perspective to see how a user interacts with these protocols from top to bottom.

Network communication consists of exchanging data packets. A packet contains the destination MAC address and IP address, which differ depending on whether the target is in the same subnet (direct MAC address) or in a different subnet (gateway MAC address).

To send a packet, the sender must know two addresses:

* Destination MAC address
* Destination IP address

If the destination is not in the same subnet, the packet is first sent to the gateway, which forwards it based on routing tables.

Static IP configuration requires manually setting four parameters: the host IP address, subnet mask, gateway IP address, and DNS server IP address. This method is inflexible for typical users.

Dynamic IP configuration uses the DHCP protocol. A new host broadcasts a DHCP request (with source MAC, destination MAC set to FF‑FF‑FF‑FF‑FF‑FF, source IP 0.0.0.0, destination IP 255.255.255.255, source port 68, destination port 67). The DHCP server replies with an IP address, subnet mask, gateway, and DNS information.

* Host IP address
* Subnet mask
* Gateway IP address
* DNS server IP address

After the network parameters are set, the user opens a browser and requests a website (e.g., www.google.com). The process proceeds as follows:

DNS lookup : the client sends a DNS query to the configured DNS server (e.g., 8.8.8.8) and receives the IP address of the target host.

Subnet check : using the subnet mask, the client determines that the target IP is not in the same subnet and therefore routes the packet via the gateway.

TCP segment : the client creates a TCP segment with source port (e.g., 51775) and destination port 80, embedding the HTTP request.

IP packet : the TCP segment is encapsulated in an IP packet with source IP (e.g., 192.168.1.100) and destination IP (e.g., 172.194.72.105).

Ethernet frame : the IP packet is placed inside an Ethernet frame whose destination MAC is the gateway’s MAC address.

Fragmentation : because the IP packet (≈5000 bytes) exceeds the Ethernet MTU (1500 bytes), it is split into four fragments, each with its own IP header.

The fragments traverse multiple routers, are reassembled by the destination server, which then processes the HTTP request and sends back an HTTP response following the same encapsulation steps in reverse.

Finally, the client receives the HTTP response and renders the web page, completing the communication cycle.

protocolsHTTPTCP/IPnetworkingDNSDHCP
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.