Data Flow Computer To Internet

Data Flow: Computer to Internet (Opening a Website)

Data Flow: Computer to Internet (Opening a Website)

Example: User opens Google website (https://www.google.com)

  1. User Request from Browser (Application Layer)

When a user types www.google.com in a web browser, the browser sends a request to access the website. This request is generated by the HTTP or HTTPS protocol. The browser first checks whether it already knows the IP address of the website from its cache. If not, it needs to find the IP address using the Domain Name System (DNS). This process happens at the Application Layer (Layer 7) of the **OSI Model.

  1. DNS Query to Find the IP Address (Layer 7 → Layer 3)

The computer sends a DNS query to a DNS server to convert the domain name www.google.com into an IP address (for example 142.250.183.206). The DNS request uses port 53 and usually uses the User Datagram Protocol (UDP). The DNS server replies with the correct IP address of the website.

  1. Creating the Data Packet (Layer 4 – Transport Layer)

After receiving the IP address, the browser prepares the request to send to the web server. Since HTTPS is used, the request is sent through the Transmission Control Protocol (TCP) using port 443. TCP divides the data into smaller units called segments and adds a TCP header containing source port, destination port, and sequence numbers.

  1. Adding the IP Header (Layer 3 – Network Layer)

At Layer 3, the computer adds an IP header to the TCP segment. This header contains:

  • Source IP Address (for example: 192.168.1.10)
  • Destination IP Address (Google server IP)

This process creates an IP packet. The network layer determines how the packet will travel across different networks on the internet.

  1. Layer 2 – MAC Address Resolution (ARP Process)

Before sending the packet to the network, the computer must know the MAC address of the default gateway (router).

The computer uses Address Resolution Protocol (ARP) to ask:

“Who has IP 192.168.1.1 (router)?”

The router replies with its MAC address, such as 00:1A:2B:3C:4D:5E.

  1. Creating the Ethernet Frame (Layer 2 – Data Link Layer)

The packet is then encapsulated into an Ethernet frame.

The Ethernet frame contains:

  • Source MAC address (computer MAC)
  • Destination MAC address (router MAC)
  • Payload (IP packet)

This process happens at Layer 2 of the **OSI Model.

  1. Sending Data Through the Local Network

The Ethernet frame is transmitted through the network interface card (NIC) to the switch in the local network. The switch reads the MAC address table and forwards the frame to the port connected to the router.

  1. Router Processing (Layer 3 Routing)

When the frame reaches the router:

  1. The router removes the Layer 2 header.
  2. It checks the destination IP address in the packet.
  3. The router consults its routing table to determine the best path to reach the destination network.

The router then forwards the packet to the Internet Service Provider (ISP) network.

  1. Data Traveling Across the Internet

The packet travels through multiple routers across different networks on the internet. Each router performs the same process:

  • Reads the destination IP address
  • Chooses the best route
  • Re-encapsulates the packet into a new Layer-2 frame

This continues until the packet reaches the destination network where the web server is located.

  1. Reaching the Web Server

When the packet arrives at the destination data center server (for example servers owned by **Google), the server processes the request.

The server:

  1. Removes the Ethernet frame (Layer 2).
  2. Reads the IP packet (Layer 3).
  3. Sends the data to the TCP layer (Layer 4).
  4. Passes the request to the web server application (Layer 7).
  1. Server Sends the Response Back

The server then sends the requested webpage data back to the client. The response follows the same layers and path in reverse order:

Application → Transport → Network → Data Link → Physical → Internet → Router → Switch → Computer.

Finally, the browser receives the data and displays the website on the screen.

Complete end-to-end Process of how a Computer Accesses the Facebook Server

1. User Request from the Computer

A user opens the browser and enters www.facebook.com. The browser sends a request to the operating system network stack to contact the Facebook server. However, computers communicate using IP addresses, not domain names. Therefore, the system must first convert the domain name into an IP address.

Example:

User request

				
					www.facebook.com
				
			
  1. 2. DNS Resolution (Finding Facebook Server IP)

    The computer performs a DNS lookup to find the IP address of Facebook.

    Steps:

    1. Browser checks its local DNS cache.

    2. Operating system checks the hosts file.

    3. If not found, it queries the DNS server provided by the ISP.

    The DNS server returns an IP address.

    Example:

				
					www.facebook.com → 157.240.22.35
				
			
  1. This becomes the Destination IP (Dst IP).

    Now the computer knows where to send the packet.

  1. 3. Application Layer (Creating HTTP/HTTPS Request)

    At the Application Layer of the OSI Model, the browser creates an HTTPS request.

    Example request:

				
					GET / HTTP/1.1
Host: www.facebook.com
				
			
  1. Because Facebook uses secure communication, it normally uses HTTPS protocol (TCP port 443).

4. Transport Layer (Layer 4 – TCP)

Next, the Transport Layer creates a TCP segment.

Before sending data, TCP establishes a connection using the TCP three-way handshake.

  1. SYN
  2. SYN-ACK
  3. ACK

Example ports

				
					Source Port: 49500 (random)
Destination Port: 443
				
			

5. Network Layer (Layer 3 – IP Header)

The IP header is added to the packet.

Example:

Computer Private IP

				
					Src IP = 192.168.1.10
				
			

Facebook Server IP

				
					Dst IP = 157.240.22.35
				
			

The packet is now called an IP packet.

Important point:

Source and destination IP remain the same across the Internet (until NAT happens).

6. Data Link Layer (Layer 2 – MAC Address)

Inside the local network, communication happens using MAC addresses.

The computer must send the packet to the default gateway (home router).

But the computer does not know the router MAC address yet.

Therefore, it uses ARP (Address Resolution Protocol).

ARP Request:

				
					Who has 192.168.1.1 ?
				
			

Router replies

				
					192.168.1.1 → AA:BB:CC:DD:EE:FF
				
			

Now the computer knows the router MAC.

Example Ethernet Frame:

				
					Src MAC = 00:11:22:33:44:55
Dst MAC = AA:BB:CC:DD:EE:FF
				
			

7. Physical Layer Transmission

The Ethernet frame is converted into electrical signals or WiFi radio signals.

Devices involved:

Network Interface Card (NIC)
• Ethernet cable or WiFi
• Switch

8. Switch Processing

If the computer is connected through a switch, the frame first arrives at the switch.

The switch reads the destination MAC address and checks its MAC address table.

The switch forwards the frame to the port where the router is connected.

Switch works at:

Layer 2 (MAC forwarding).

9. Router Receives the Packet

The home router receives the frame.

Router operations:

  1. Remove Layer 2 header

  2. Inspect the Layer 3 IP packet

  3. Check routing table

Destination IP:

				
					157.240.22.35
				
			

The router determines that the packet must go to the ISP gateway.

10. NAT (Network Address Translation)

Since the computer uses a private IP address, it cannot be routed on the Internet.

Private IP example:

				
					192.168.1.10
				
			

The router performs NAT (PAT).

Example translation:

				
					Before NAT
Src IP = 192.168.1.10
Src Port = 49500
				
			
				
					After NAT
Src IP = 49.36.210.55 (public ISP IP)
Src Port = 62000
				
			

The router stores this mapping in the NAT table.

Example NAT table entry:

				
					192.168.1.10:49500 → 49.36.210.55:62000
				
			

11. Packet Sent to ISP Network

The router sends the packet to the ISP edge router.

Example ISP companies:

  • Airtel
  • Jio
  • BSNL

The ISP network consists of:

• Access router
• Aggregation router
• Core router

The packet travels through these routers using routing protocols.

12. Internet Backbone Routing

The packet now travels through the global Internet backbone.

Routers use BGP routing to decide the best path to Facebook’s network.

The packet may pass through multiple routers across different networks before reaching Facebook’s data center.

During this journey:

• Source IP remains 49.36.210.55
• Destination IP remains 157.240.22.35

But MAC addresses change at every hop.

12. Internet Backbone Routing

The packet now travels through the global Internet backbone.

Routers use BGP routing to decide the best path to Facebook’s network.

The packet may pass through multiple routers across different networks before reaching Facebook’s data center.

During this journey:

• Source IP remains 49.36.210.55
• Destination IP remains 157.240.22.35

But MAC addresses change at every hop.

13. Facebook Edge Network

Eventually, the packet reaches the Facebook edge router inside the Meta Platforms data center network.

Infrastructure may include:

Edge routers
• Firewalls
• Load balancers
• Application servers

A load balancer distributes traffic to one of many Facebook web servers.


14. Facebook Web Server Processing

The web server receives the packet.

Steps:

  1. TCP connection verified
  2. HTTPS request processed
  3. User authentication checked
  4. Web page generated

The server prepares a response containing:

• HTML
• CSS
• JavaScript
• Images


15. Server Sends Response Back

The server sends the response packet back.

Now:

				
					Src IP = 157.240.22.35
Dst IP = 49.36.210.55
				
			

The packet travels through the Internet backbone and ISP network back to the user’s router.

16. NAT Reverse Translation

When the router receives the packet:

Destination IP:

				
					49.36.210.55
				
			

Router checks the NAT table.

				
					49.36.210.55:62000 → 192.168.1.10:49500
				
			

The router translates the packet back to the original private IP.

17. Router Sends Packet to Computer

The router sends the packet to the computer.

Example Layer 2 frame:

				
					Src MAC = AA:BB:CC:DD:EE:FF
Dst MAC = 00:11:22:33:44:55
				
			

The frame passes through the switch and reaches the computer.

18. Browser Displays Facebook Page

The operating system sends the data to the browser.

The browser renders the Facebook page and displays it to the user.

The user now sees the Facebook homepage.


19. Complete Packet Header Example

Ethernet Frame

				
					Src MAC = 00:11:22:33:44:55
Dst MAC = AA:BB:CC:DD:EE:FF
				
			

IP Header

				
					Src IP = 192.168.1.10
Dst IP = 157.240.22.35
				
			

TCP Header

				
					Src Port = 49500
Dst Port = 443
				
			

Application Data

				
					HTTPS request for facebook.com
				
			

20. Complete End-to-End Path

				
					Computer
↓
Switch
↓
Home Router (NAT)
↓
ISP Access Router
↓
ISP Core Network
↓
Internet Backbone
↓
Facebook Edge Router
↓
Load Balancer
↓
Facebook Web Server
↓
Response back to Computer
				
			

Important Key Points

Layer 2 → MAC address changes every hop
Layer 3 → IP address stays same end-to-end
NAT → converts private IP to public IP
TCP → reliable communication
DNS → converts domain name to IP
Routers → route packets across networks
Switch → forwards frames inside LAN