What is a Protocol?
A protocol is a set of rules that governs how data is transmitted and received over a
network. These rules define the format, timing, sequencing, and error control of the
messages being exchanged.
Elements of a Protocol:
● Syntax: Defines the structure or format of the data.
● Semantics: Defines the meaning of each section of bits.
● Timing: Specifies when data should be sent and how fast.
Key Network Protocols Explained
1. DHCP (Dynamic Host Configuration Protocol)
● Layer: Application Layer
● Purpose: Automatically assigns IP addresses and network configuration to devices
on a network.
● Default Port: UDP 67 (server), UDP 68 (client)
● Technical Explanation:
○ When a device joins a network (like Wi-Fi), it broadcasts a DHCP Discover
message.
○ The DHCP server responds with an IP offer.
○ The device requests the offered IP, and the server acknowledges it.
● Simpler Explanation: It’s like a receptionist assigning a hotel room when you check
in. The room = your IP address.
Discussion Highlights:
● Devices use IP [Link] and port 68 to broadcast DHCP requests before they have
an IP.
● The DHCP server uses port 67 to listen and respond.
● DHCP interaction is local and doesn’t need internet access.
● On mobile data, your SIM’s mobile provider acts as DHCP, assigning an IP using the
GTP protocol.
● If you're on Wi-Fi, your local router assigns the IP.
● When using mobile data, the IP and DNS are handled by your cellular provider.
● DHCP is a network call but works on a local network broadcast — it doesn’t require
internet.
2. FTP (File Transfer Protocol)
● Layer: Application Layer
● Purpose: Transfers files between a client and a server.
● Default Port: TCP 21
● Explanation:
○ FTP lets you upload/download files from a remote computer.
○ Uses separate channels for command and data.
● Note: Can be insecure; SFTP or FTPS is preferred nowadays.
3. ICMP (Internet Control Message Protocol)
● Layer: Network Layer
● Purpose: Used by network devices to send error messages and operational
information (e.g., unreachable host).
How it works:
● Routers and hosts detect delivery issues (e.g., TTL expired, port unreachable).
● They send ICMP messages back to the source IP.
● ICMP messages include:
○ Type (e.g., 8 for Echo Request, 0 for Echo Reply)
○ Code (specific meaning of the type)
○ Portion of the original IP header and data.
Discussion Highlights:
● ICMP doesn’t require a server; handled by routers or OS.
● Used by ping and traceroute to diagnose networks.
● ICMP error messages are triggered by specific conditions like no route, unreachable
port, etc.
● ICMP gets triggered when a router or destination host can’t fulfill packet delivery.
4. ARP (Address Resolution Protocol)
● Layer: Network Layer
● Purpose: Maps a known IP address to a physical MAC address on a local network.
How it works:
● Device sends a broadcast ("Who has IP x.x.x.x?").
● The device with that IP replies with its MAC address.
5. RIP (Routing Information Protocol)
● Layer: Network Layer
● Purpose: Used by routers to share routing information in small to medium networks.
How it works:
● Uses hop count as the routing metric (max 15 hops).
● Periodically sends full routing table to neighbors.
Protocols vs Servers Clarification
● Protocols are not servers — they are sets of rules (like a language grammar).
● Servers are real-world software/machines that implement those protocols.
Concep Example
t
Protocol HTTP, DNS, DHCP
Server Apache, BIND, DHCPd
Client Browser, nslookup, FTP
client
Discussion Highlights:
● HTTP is a protocol, implemented by servers like Apache or Nginx.
● DNS is a protocol, implemented by servers like Google’s [Link].
● ICMP and TCP are handled internally by OS/network stack, not needing servers.
● DNS servers are built and maintained by Google, Cloudflare, ISPs, and private orgs.
● Routers know the IPs of DNS servers from ISP via DHCP or manual config.
● Protocols define how to communicate; servers are implementations following those
rules.
DNS System in Detail
What is DNS?
DNS = Domain Name System. It maps human-friendly domain names (like [Link]) to IP
addresses.
Discussion Highlights:
● When you connect to Wi-Fi or mobile network, your router/provider gives you a DNS
server IP.
● DNS resolution works in a hierarchy:
○ Root → TLD (.com) → Authoritative DNS → Final IP
● Servers are globally distributed with Anycast routing.
● You can override DNS server settings manually.
● DNS involves multiple queries to get the final IP.
DNS Resolution Chain:
1. Ask Root DNS Server: “Where is .com?”
2. Ask .com DNS Server: “Where is [Link]?”
3. Ask [Link] Authoritative Server: “What’s the IP of [Link]?”
4. Get IP and contact the server.
Overview: What systems does your Browser contacts?
Your browser contacts a chain of systems, in this general order:
🔄 Step-by-Step Flow:
1. Browser → OS (TCP/IP Stack)
Your browser asks the OS:
“Hey, what’s the IP address of [Link]?”
2. OS → DNS Resolver (usually your router or public DNS)
If the IP is not in local DNS cache, your OS sends a DNS query to:
● The DNS IP you received from DHCP (e.g., your router [Link] or public DNS
like [Link])
● This query is sent over UDP, port 53
📨 Your laptop contacts:
✅ DNS Server (either in your router or on the internet)
3. DNS Resolver → Multiple DNS Servers (if needed)
If the local DNS doesn’t know, it will:
● Query the root DNS server → .
● Then the .com DNS server
● Then the [Link] DNS server
● Finally, it gets the IP of [Link]
4. OS → Networking Stack
Now your OS:
● Opens a TCP connection to the resolved IP (e.g., [Link])
● On port 443 (HTTPS)
📨 Your laptop contacts:
✅ Google’s Web Server (at its IP, via TCP 443)
5. Packets go through:
● Your router (default gateway)
● Your ISP (Jio, Airtel, etc.)
● Various intermediate routers on the internet (backbone)
● Eventually to Google’s data center
So you're contacting:
✅ Router → ISP Gateway → Internet Routers → Google Server
6. TLS Handshake (HTTPS)
Before sending any real data:
● Your browser and Google’s server perform a TLS handshake.
● They agree on encryption keys
● Then, encrypted data is exchanged
📨 You contact:
✅ Google's TLS system (part of their web server)
7. Request is made (HTTP over TLS)
Your browser sends an HTTP GET request:
GET / HTTP/1.1
Host: [Link]
📨 You contact:
✅ Google’s web service / app server
8. Response comes back
Google sends:
● HTTP headers
● HTML, CSS, JS, Images, etc.
These are sent back over the same TCP connection.