What is a Computer Network?
A computer network is a system that connects many independent
computers to share information (data) and resources. The integration
of computers and other different devices allows users to communicate
more easily. A computer network is a collection of two or more
computer systems that are linked together. A network connection can
be established using either cable or wireless media. Hardware and
software are used to connect computers and tools in any network.
What Do Computer Networks Do?
Computer Networks are one of the important aspects of Computer
Science. In the early days, it is used for data transmission on telephone
lines and had a very limited use, but nowadays, it is used in a variety of
Key Components of a Computer Network:
1. Nodes: Devices such as computers, servers, printers, and other hardware
connected to the network.
2. Links: Communication pathways that connect nodes, such as cables (wired)
or radio waves (wireless).
3. Protocols: Rules and standards that govern how data is transmitted and
received (e.g., TCP/IP, HTTP, FTP).
4. Network Devices:
o Router: Directs data packets between networks.
o Switch: Connects devices within a local area network (LAN) and
manages data traffic.
o Hub: A basic device for connecting multiple devices in a network.
o Access Point: Provides wireless connectivity.
o Firewall: Protects the network by controlling incoming and outgoing
traffic.
Types of Computer Networks:
1. Personal Area Network (PAN): A small network used for personal devices
(e.g., Bluetooth).
2. Local Area Network (LAN): Covers a small geographical area, like a home or
office.
3. Metropolitan Area Network (MAN): Spans a city or large campus.
4. Wide Area Network (WAN): Covers large geographical areas, often
connecting multiple LANs (e.g., the Internet).
5. Virtual Private Network (VPN): Provides secure remote access to a private
network over the Internet.
Difference between Router and switch?
Key Points:
Router: Primarily connects networks and manages traffic
between them. It is essential for Internet access in most
setups.
Switch: Primarily connects devices within the same
network and ensures efficient communication between
them.
Example:
A router connects your home network to your Internet
Service Provider (ISP), enabling Internet access.
A switch connects your devices (e.g., computers, printers)
within your home or office network, allowing them to
share files and resources.
What is broadcast Domain?
When a computer network is separated logically then it is a
Broadcast Domain. In a Broadcast Domain, there is reachability
among nodes using broadcast at layer 2 of the OSI (Open
System Interconnection) Model i.e. Data Link Layer.
The broadcasts sent by one device are kept in a broadcast
domain and are not sent to other devices that are part of
another broadcast domain. By default, the available ports on a
hub or a switch are part of the same broadcast domain. The
routers make the separation of LAN into multiple broadcast
domains. The available ports on a router are not part of the
same broadcast domain and no broadcasting is made by
routers from one domain to another.
A broadcast domain is a network segment where any broadcast sent by
a device is received by all other devices in the same segment. It is a
logical division of a computer network in which devices can directly
communicate with each other via broadcast traffic.
Key Points:
1. Broadcast Traffic: Broadcast traffic is a type of communication
where a message is sent to all devices in the network segment.
For example, ARP (Address Resolution Protocol) requests are
broadcast messages.
2. Boundaries:
o Routers: Routers separate broadcast domains because they
do not forward broadcast traffic to other networks.
o Switches and Hubs: Switches forward broadcasts within the
same VLAN, and hubs broadcast to all connected devices.
This means that switches and hubs do not inherently limit
broadcast domains unless VLANs are configured.
3. VLANs: Virtual Local Area Networks (VLANs) can be used to create
multiple broadcast domains within a single switch. Devices in
different VLANs cannot directly communicate via broadcast unless
routed.
4. Size and Performance:
o A larger broadcast domain means more devices receive
every broadcast, which can lead to network congestion.
o Reducing the size of a broadcast domain can improve
network performance by limiting unnecessary broadcast
traffic.
Example:
In a typical LAN setup with one switch and no VLANs, all devices
connected to the switch are in the same broadcast domain.
If VLANs are configured, each VLAN creates its own broadcast
domain, isolating traffic between devices in different VLANs.
Analogy:
Think of a broadcast domain like a room in a building. If someone
shouts in the room, everyone in the room hears it (broadcast).
However, people in other rooms (different broadcast domains) won’t
hear it unless there’s a door (router) that allows communication
between rooms.
Explain OSI Model and Protocol on each Layer?
The OSI (Open Systems Interconnection) Model is a set of rules that
explains how different computer systems communicate over a network.
OSI Model was developed by the International Organization for
Standardization (ISO). The OSI Model consists of 7 layers and each layer
has specific functions and responsibilities. This layered approach makes
it easier for different devices and technologies to work together. OSI
Model provides a clear structure for data transmission and managing
network issues. The OSI Model is widely used as a reference to
understand how network systems function.
There are 7 layers in the OSI Model and each layer has its specific role
in handling data. All the layers are mentioned below:
Physical Layer
Data Link Layer
Network Layer
Transport Layer
Session Layer
Presentation Layer
Application Layer
Application Layer
At the very top of the OSI Reference Model stack of layers, we find the
Application layer which is implemented by the network applications. These
applications produce the data to be transferred over the network. This layer also
serves as a window for the application services to access the network and for
displaying the received information to the user.
Purpose: Provides network services to end-users and applications.
Functions:
User interface for communication.
Network services like file transfer, email, and web browsing.
Protocols:
HTTP/HTTPS (HyperText Transfer Protocol)
FTP/SFTP (File Transfer Protocol)
SMTP (Simple Mail Transfer Protocol)
IMAP/POP3 (Email retrieval protocols)
DNS (Domain Name System)
SNMP (Simple Network Management Protocol)
Presentation Layer
The presentation layer is also called the Translation layer. The data from the
application layer is extracted here and manipulated as per the required format to
transmit over the network. Protocols used in the Presentation Layer
are JPEG, MPEG, GIF, TLS/SSL, etc.
Functions of the Presentation Layer
Translation: For example, ASCII to EBCDIC .
Encryption/ Decryption: Data encryption translates the data into another
form or code. The encrypted data is known as the ciphertext and the
decrypted data is known as plain text. A key value is used for encrypting as
well as decrypting data.
Compression: Reduces the number of bits that need to be transmitted on
the network.
Purpose: Translates, encrypts, and compresses data for the application layer.
Functions:
o Data translation (e.g., ASCII to EBCDIC).
o Data encryption and decryption.
o Data compression.
Protocols:
o SSL/TLS (Secure Sockets Layer/Transport Layer Security)
o JPEG, PNG, GIF (image formats)
o MPEG, MP3 (multimedia formats)
Session Layer
Session Layer in the OSI Model is responsible for the establishment of
connections, management of connections, terminations of sessions between two
devices. It also provides authentication and security. Protocols used in the Session
Layer are NetBIOS, PPTP.
Functions of the Session Layer
Session Establishment, Maintenance, and Termination: The layer allows
the two processes to establish, use, and terminate a connection.
Synchronization: This layer allows a process to add checkpoints that are
considered synchronization points in the data. These synchronization points
help to identify the error so that the data is re-synchronized properly, and
ends of the messages are not cut prematurely and data loss is avoided.
Dialog Controller: The session layer allows two systems to start
communication with each other in half-duplex or full-duplex.
Purpose: Manages sessions or dialogs between applications.
Functions:
o Session establishment, maintenance, and termination.
o Synchronization (checkpoints in data streams).
o Dialog control (half-duplex or full-duplex).
Protocols:
o NetBIOS (Network Basic Input/Output System)
o RPC (Remote Procedure Call)
o PPTP (Point-to-Point Tunneling Protocol)
Transport Layer
The transport layer provides services to the application layer and takes services
from the network layer. The data in the transport layer is referred to
as Segments. It is responsible for the end-to-end delivery of the complete
message. The transport layer also provides the acknowledgment of the successful
data transmission and re-transmits the data if an error is found. Protocols used in
Transport Layer are TCP, UDP NetBIOS, PPTP.
At the sender’s side, the transport layer receives the formatted data from the
upper layers, performs Segmentation, and also implements Flow and error
control to ensure proper data transmission. It also adds Source and
Destination port number in its header and forwards the segmented data to the
Network Layer.
Generally, this destination port number is configured, either by default or
manually. For example, when a web application requests a web server, it
typically uses port number 80, because this is the default port assigned to
web applications. Many applications have default ports assigned.
At the Receiver’s side, Transport Layer reads the port number from its header
and forwards the Data which it has received to the respective application. It also
performs sequencing and reassembling of the segmented data.
Functions of the Transport Layer
Segmentation and Reassembly: This layer accepts the message from the
(session) layer, and breaks the message into smaller units. Each of the
segments produced has a header associated with it. The transport layer at
the destination station reassembles the message.
Service Point Addressing: To deliver the message to the correct process,
the transport layer header includes a type of address called service point
address or port address. Thus by specifying this address, the transport layer
makes sure that the message is delivered to the correct process.
Purpose: Ensures reliable data transfer between systems and provides error
detection, recovery, and flow control.
Functions:
o Segmentation and reassembly.
o Connection management (establishing, maintaining, and terminating
connections).
o Error detection and correction.
Devices: Gateways.
Protocols:
o TCP (Transmission Control Protocol)
o UDP (User Datagram Protocol)
o SCTP (Stream Control Transmission Protocol)
Network Layer
The network layer works for the transmission of data from one host to the other
located in different networks. It also takes care of packet routing i.e. selection of
the shortest path to transmit the packet, from the number of routes available.
The sender and receiver’s IP address are placed in the header by the network
layer. Segment in the Network layer is referred to as Packet. Network layer is
implemented by networking devices such as routers and switches.
Functions of the Network Layer
Routing: The network layer protocols determine which route is suitable
from source to destination. This function of the network layer is known as
routing.
Logical Addressing: To identify each device inter-network uniquely, the
network layer defines an addressing scheme. The sender and receiver’s IP
addresses are placed in the header by the network layer. Such an address
distinguishes each device uniquely and universally.
Purpose: Handles routing and forwarding of data between devices across
different networks.
Functions:
o Logical addressing (IP addresses).
o Routing and path determination.
o Packet fragmentation and reassembly.
Devices: Routers, Layer 3 switches.
Protocols:
o IPv4, IPv6
o ICMP (Internet Control Message Protocol)
o RIP (Routing Information Protocol)
o OSPF (Open Shortest Path First)
o IPsec (Internet Protocol Security)
Data Link Layer (DLL)
The data link layer is responsible for the node-to-node delivery of the message.
The main function of this layer is to make sure data transfer is error-free from one
node to another, over the physical layer. When a packet arrives in a network, it is
the responsibility of the DLL to transmit it to the Host using its MAC address.
Packet in the Data Link layer is referred to as Frame. Switches and Bridges are
common Data Link Layer devices.
The Data Link Layer is divided into two sublayers:
Logical Link Control (LLC)
Media Access Control (MAC)
The packet received from the Network layer is further divided into frames
depending on the frame size of the NIC(Network Interface Card). DLL also
encapsulates Sender and Receiver’s MAC address in the header.
The Receiver’s MAC address is obtained by placing an ARP(Address Resolution
Protocol) request onto the wire asking “Who has that IP address?” and the
destination host will reply with its MAC address.
Purpose: Provides error-free transfer of data frames between nodes on the same
physical network.
Functions:
o Framing: Divides data into frames.
o Error detection and correction.
o Flow control and MAC (Media Access Control) addressing.
Sub-layers:
o MAC: Controls how devices access the medium.
o LLC: Manages frame synchronization and error handling.
Devices: Switches, bridges, NICs.
Protocols/Standards:
o Ethernet (IEEE 802.3 - MAC and LLC)
o Wi-Fi (IEEE 802.11)
o PPP (Point-to-Point Protocol)
o ARP (Address Resolution Protocol)
o HDLC (High-Level Data Link Control)
Physical Layer
The lowest layer of the OSI reference model is the Physical Layer. It is responsible
for the actual physical connection between the devices. The physical layer
contains information in the form of bits. Physical Layer is responsible for
transmitting individual bits from one node to the next. When receiving data, this
layer will get the signal received and convert it into 0s and 1s and send them to
the Data Link layer, which will put the frame back together. Common physical
layer devices are Hub, Repeater, Modem, and Cables.
Functions of the Physical Layer
Bit Synchronization: The physical layer provides the synchronization of the
bits by providing a clock. This clock controls both sender and receiver thus
providing synchronization at the bit level.
Bit Rate Control: The Physical layer also defines the transmission rate i.e.
the number of bits sent per second.
Physical Topologies: Physical layer specifies how the different,
devices/nodes are arranged in a network i.e. bus topology , star topology ,
or mesh topology .
Transmission Mode: Physical layer also defines how the data flows
between the two connected devices. The various transmission modes
possible are Simplex, half-duplex and full-duplex .
Purpose: Deals with the physical transmission of raw bitstreams over a physical
medium.
Functions:
o Defines hardware specifications (e.g., cables, connectors).
o Manages data encoding and signal transmission.
o Ensures synchronization and bit rate control.
Devices: Hubs, repeaters, network cables, connectors.
Protocols/Standards:
o Ethernet (IEEE 802.3 - physical aspects)
o USB
o Bluetooth
o DSL
o ISDN
Explain DHCP DORA Process?
The DHCP DORA process is the sequence of steps used by the Dynamic Host
Configuration Protocol (DHCP) to assign an IP address to a client device in a
network. "DORA" stands for Discover, Offer, Request, Acknowledge, which are
the four main steps in this process. Here's how it works:
1. Discover (D)
What happens?
o The client device (e.g., a computer or smartphone) sends a DHCP
Discover message as a broadcast on the network to find available
DHCP servers.
o The message is sent because the client does not have an IP address
yet.
Details:
o The message is sent to the broadcast IP address 255.255.255.255 or
the subnet's broadcast address.
o The client uses the source IP address 0.0.0.0 because it doesn't have
an assigned IP yet.
Purpose:
o To locate any DHCP servers on the network.
2. Offer (O)
What happens?
o A DHCP server responds with a DHCP Offer message.
o This message contains:
An available IP address.
Subnet mask.
Default gateway.
DNS server addresses.
Lease duration (how long the IP address is valid).
Details:
o The message is sent as a unicast or broadcast depending on the
network setup.
Purpose:
o To inform the client of the IP address and other configuration options
it can use.
3. Request (R)
What happens?
o The client responds to the DHCP Offer with a DHCP Request
message.
o This message indicates that the client accepts the offered IP address
and other configuration details.
Details:
o The DHCP Request message is broadcast so all DHCP servers on the
network are informed that the client has chosen an IP address from
one specific server.
Purpose:
o To confirm the acceptance of the IP address and other
configurations.
4. Acknowledge (A)
What happens?
o The DHCP server sends a DHCP Acknowledge message to the client.
o This message confirms that the client can use the assigned IP address
and other configurations.
Details:
o The DHCP server updates its database to mark the IP address as
leased to the client.
Purpose:
o To finalize the lease agreement and allow the client to start using the
assigned IP address.
Explained DNS in Detailed?
It translates human-readable domain names (e.g., www.google.com) into
machine-readable IP addresses (e.g., 142.250.190.78), enabling devices to locate
and connect to each other over the network.
Why DNS is Needed?
1. Human-Friendly Names:
o Humans prefer easy-to-remember names (e.g., example.com) over
numeric IP addresses.
2. Dynamic IP Addresses:
o Devices on the internet may have changing IP addresses, but their
domain names remain constant.
3. Scalability:
o The DNS system can manage billions of domain names efficiently.
How DNS Works?
DNS resolves domain names to IP addresses through a series of steps. Here’s how
the process works:
1. User Query:
o A user enters a domain name (e.g., www.example.com) into a
browser.
2. DNS Resolver (Recursive Resolver):
o The user's device sends the query to a DNS resolver, typically
managed by their Internet Service Provider (ISP).
3. Root Server:
o The resolver queries a Root DNS Server, which responds with the
address of the appropriate Top-Level Domain (TLD) Server
(e.g., .com, .org).
4. TLD Server:
o The resolver queries the TLD server, which responds with the address
of the Authoritative Name Server for the domain.
5. Authoritative Name Server:
o The resolver queries the Authoritative Name Server, which responds
with the IP address of the requested domain.
6. Response to User:
o The resolver sends the IP address back to the user's device, which
then connects to the target server.
Components of DNS
1. DNS Resolver:
o Acts as an intermediary between the client and the DNS system,
performing recursive queries on behalf of the user.
2. Root DNS Servers:
o The starting point for DNS queries, directing resolvers to the
appropriate TLD servers.
o There are 13 root server clusters globally.
3. TLD Servers:
o Manage information for top-level domains (e.g., .com, .net, .org).
o Examples: .com TLD servers handle domains like google.com.
o
4. Authoritative Name Servers:
o Store and provide the IP address for specific domain names.
o Example: The authoritative server for example.com knows its IP
address.
5. DNS Records:
o DNS servers store information in records:
A Record: Maps a domain to an IPv4 address.
AAAA Record: Maps a domain to an IPv6 address.
CNAME Record: Maps a domain to another domain (alias).
MX Record: Specifies mail servers for email delivery.
TXT Record: Provides text information (e.g., SPF, DKIM).
NS Record: Specifies the authoritative name servers for a
domain.
DNS Caching
To improve speed and reduce load, DNS uses caching at multiple levels:
1. Browser Cache:
o Stores DNS responses locally in the browser.
2. Operating System Cache:
o Stores DNS responses at the OS level.
3. Resolver Cache:
o The resolver caches responses to avoid repeated queries to the DNS
hierarchy.
DNS Example
1. A user types www.google.com in their browser.
2. The browser checks its cache. If not found:
o The query is sent to the local DNS resolver.
o The resolver queries the root server, which points to .com TLD
servers.
o The TLD server points to Google's authoritative server.
o The authoritative server provides the IP address (e.g.,
142.250.190.78).
3. The resolver sends the IP address back to the browser, which connects to
Google's web server.
Advantages of DNS
1. Ease of Use:
o Users can access websites using names instead of IP addresses.
2. Scalability:
o Can handle billions of domain names globally.
3. Redundancy:
o Multiple DNS servers ensure high availability.
4. Load Balancing:
o DNS can distribute traffic across multiple servers.
What is the difference between TCP and UDP, and when would you use each?
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are
transport layer protocols in the TCP/IP model, each designed for specific use
cases.
TCP (Transmission Control Protocol)
1. Connection-Oriented: TCP establishes a connection between the sender
and receiver using a three-way handshake (SYN, SYN-ACK, ACK) before
transmitting data.
2. Reliable Data Transfer: It ensures all packets are delivered, in order, and
without corruption. Lost packets are retransmitted.
3. Error Checking: TCP uses checksums to detect errors and acknowledgments
(ACKs) to confirm successful delivery.
4. Flow Control: TCP uses mechanisms like sliding windows to manage data
flow and prevent congestion.
5. Use Cases:
o Web Browsing: HTTP/HTTPS
o File Transfers: FTP, SFTP
o Email Communication: SMTP, IMAP
o Remote Access: SSH, Telnet
UDP (User Datagram Protocol)
1. Connectionless: UDP does not establish a connection before sending data.
Packets, called datagrams, are sent independently.
2. Unreliable Delivery: There is no guarantee of packet delivery, order, or
error correction. It’s a "best-effort" protocol.
3. Low Overhead: UDP is faster than TCP due to minimal header size and no
acknowledgment mechanism.
4. Broadcast and Multicast Support: UDP efficiently supports one-to-many
communication.
5. Use Cases:
o Real-Time Streaming: Video and audio (e.g., YouTube, Netflix)
o Online Gaming: Low latency is critical.
o Voice over IP (VoIP): Real-time communication.
o DNS Queries: Quick, lightweight communication.
Key Differences
Aspect TCP UDP
Type Connection-oriented Connectionless
Reliable, ensures delivery and
Reliability Unreliable, no guarantees
order
Error Handling Error detection and correction Error detection, no correction
Faster due to minimal
Speed Slower due to overhead
overhead
Web browsing, file transfers,
Use Cases Streaming, gaming, VoIP, DNS
emails
When to Use Each:
TCP is preferred when reliability and data integrity are critical, such as in
web browsing, file transfers, and email.
UDP is ideal for applications requiring speed and low latency, like video
streaming, gaming, and VoIP, where minor data loss is acceptable.
Subnetting
Subnetting is the process of dividing a large network into smaller, more
manageable sub-networks (subnets). It is a fundamental concept in networking
used to improve efficiency, enhance security, and manage IP address allocation
effectively.
Why Subnetting is Important:
1. Efficient IP Address Management: Prevents wastage of IP addresses by
allocating only the required number of addresses to each subnet.
2. Improved Network Performance: Reduces network congestion by limiting
broadcast domains.
3. Enhanced Security: Segments sensitive data or systems into separate
subnets, restricting access.
4. Simplified Troubleshooting: Smaller networks are easier to manage and
debug.
How Subnetting Works:
Subnetting involves borrowing bits from the host portion of an IP address to
create additional network addresses. This is done using a subnet mask.
IP Address: Divided into two parts:
o Network Portion: Identifies the network.
o Host Portion: Identifies individual devices within the network.
Subnet Mask: Defines which part of the IP address is the network portion
and which is the host portion.
Example:
o IP Address: 192.168.1.0
o Subnet Mask: 255.255.255.0 (or /24 in CIDR notation)
Here, the first 24 bits are the network portion, and the remaining 8
bits are for hosts.
Key Terms in Subnetting:
1. CIDR Notation: A shorthand for the subnet mask. For example, /24 means
the first 24 bits are for the network.
2. Subnet ID: The network identifier for a subnet.
3. Broadcast Address: Used to communicate with all devices in a subnet.
4. Number of Hosts: The number of usable IP addresses in a subnet is
calculated as 2host bits−22^{\text{host bits}} - 22host bits−2 (subtracting
network and broadcast addresses).
MSS/MTU
MSS (Maximum Segment Size) and MTU (Maximum Transmission Unit)
MSS and MTU are two critical parameters in networking that determine the size
of data packets transmitted over a network.
1. Maximum Transmission Unit (MTU):
Definition: The maximum size of a single packet (including headers and
payload) that can be transmitted over a network interface.
Layer: Operates at the Data Link Layer (Layer 2) of the OSI model.
Default Value:
o Ethernet: 1500 bytes (common MTU for most networks).
o Other networks may have different MTUs (e.g., 576 bytes for IPv4 in
some cases).
Includes: The entire packet, including the IP and TCP/UDP headers.
Purpose: Ensures efficient transmission without fragmentation.
2. Maximum Segment Size (MSS):
Definition: The maximum amount of data (payload) that can be sent in a
single TCP segment.
Layer: Operates at the Transport Layer (Layer 4) of the OSI model.
Default Value: Determined by subtracting the TCP and IP headers from the
MTU.
o For Ethernet: MSS = MTU (1500 bytes) - IP Header (20 bytes) - TCP
Header (20 bytes) = 1460 bytes.
Purpose: Optimizes data transmission by ensuring the payload fits within
the MTU.
Key Differences:
Aspect MTU MSS
Maximum size of a packet Maximum size of the payload in a
Definition
(header + data). TCP segment.
Layer Data Link Layer (Layer 2). Transport Layer (Layer 4).
Includes
Yes (IP + TCP/UDP headers). No (only the payload).
Headers
Purpose Avoids fragmentation at the Optimizes TCP segment size for
Aspect MTU MSS
Data Link Layer. efficient transmission.
Default Value 1500 bytes (Ethernet). 1460 bytes (Ethernet).
Why MTU and MSS are Important:
1. Avoid Fragmentation:
o If the MTU is exceeded, packets are fragmented, causing delays and
inefficiency.
o MSS ensures the data fits within the MTU to avoid fragmentation.
2. Efficiency:
o Proper MTU and MSS settings reduce retransmissions and overhead.
3. Performance:
o Incorrect settings can lead to reduced throughput and increased
latency.
Complete flow when you trigger amazon.com?
When you type "amazon.com" into your browser and press Enter, a series of
complex processes occur to load the website. Below is a step-by-step, detailed
explanation of the entire flow:
1. User Input
Action: You type amazon.com into your browser's address bar and press
Enter.
Outcome: The browser interprets this as a request to load the website.
2. Browser Checks Cache
Action: The browser first checks its cache to see if it already knows the IP
address of amazon.com or has the page data stored.
Outcome:
o If the cache has the IP or the page data, the browser may use it to
load the page faster.
o If not, the browser proceeds to DNS resolution.
3. DNS Resolution
Action: The domain name amazon.com needs to be converted into an IP
address (e.g., 205.251.242.103).
Steps:
1. The browser checks the local DNS cache on your computer.
2. If not found, the request is sent to the DNS resolver (usually
provided by your ISP or a public DNS like Google’s 8.8.8.8).
3. The resolver queries authoritative DNS servers to find the IP address
for amazon.com.
Outcome: The IP address of Amazon's server is returned to the browser.
4. Establishing a TCP Connection
Action: The browser uses the resolved IP address to establish a connection
with Amazon’s server.
Process:
o A 3-way TCP handshake occurs:
1. Your device sends a SYN (synchronize) packet to the server.
2. The server responds with a SYN-ACK (synchronize-
acknowledge) packet.
3. Your device sends an ACK (acknowledge) packet back to the
server.
Outcome: A reliable connection is established.
5. TLS/SSL Handshake (If HTTPS)
Action: Since amazon.com uses HTTPS, the browser and server establish a
secure, encrypted connection.
Steps:
1. The browser requests the server's SSL/TLS certificate.
2. The server sends the certificate, which is verified by the browser.
3. A session key is exchanged securely to encrypt further
communication.
Outcome: The connection is now secure.
6. Sending the HTTP Request
Action: The browser sends an HTTP GET request to the server to request
the content of the homepage.
Details:
o The request includes headers such as:
User-Agent (browser type and version)
Cookies (to maintain your session)
Accept-Encoding (types of data the browser can handle)
Host (amazon.com)
Outcome: The request reaches Amazon’s server.
7. Server Processing
Action: Amazon’s server processes the request.
Steps:
1. The server checks the requested resource (e.g., the homepage).
2. It fetches data from databases, caches, or microservices.
3. The server generates an HTTP response with the requested data.
Outcome: The server prepares the response and sends it back.
8. Receiving the HTTP Response
Action: The browser receives the HTTP response from the server.
Details:
o The response includes:
HTML (structure of the page)
CSS (styling)
JavaScript (interactivity)
Images and other resources.
o The response status code (e.g., 200 OK) indicates success.
Outcome: The browser begins processing the response.
9. Browser Rendering
Action: The browser parses and renders the webpage.
Steps:
1. Parses the HTML to construct the DOM (Document Object Model).
2. Applies CSS to style the elements.
3. Executes JavaScript for interactivity.
4. Requests additional resources (e.g., images, videos, fonts) from the
server or CDNs.
Outcome: The page is displayed to the user.
10. User Interaction
Action: The webpage is fully loaded, and you can now interact with it (e.g.,
search for products, add items to your cart).
Details:
o Any new actions (e.g., clicking a link) trigger additional HTTP
requests.
o These follow a similar process (DNS lookup may be skipped if
cached).
Key Components of the Flow
1. DNS Resolution: Converts the domain name into an IP address.
2. TCP Connection: Establishes a reliable link between your device and the
server.
3. TLS Handshake: Secures the connection with encryption.
4. HTTP Request/Response: Facilitates communication between the browser
and the server.
5. Browser Rendering: Displays the webpage on your screen.
In Short
1. DNS: Resolves amazon.com to an IP address.
2. TCP Handshake: Establishes a connection.
3. TLS Handshake: Secures the connection.
4. HTTP Request: Requests the homepage.
5. Server Processing: Generates and sends the response.
6. Browser Rendering: Parses and displays the webpage.
7. Interaction: You can now use the website.
This process ensures a seamless, secure, and interactive browsing experience.