CN MediaNet InterviewGuide
CN MediaNet InterviewGuide
OSI & TCP/IP · DNS & HTTP · TCP vs UDP · What happens when you type [Link]
Contents
1. OSI Model — All 7 Layers
Layer roles, devices, protocols per layer
2. TCP/IP Model
4-layer model, comparison with OSI
6. TCP vs UDP
■ Standard [Link] question
7 Application User-facing services, data representation HTTP, FTP, SMTP, DNS, DHCP
Switch (L2): Learns MAC addresses and forwards frames only to the correct port.
Router (L3): Routes packets between different IP networks using a routing table.
Application data → Segment (Transport adds port) → Packet (Network adds IP) → Frame (Data Link
adds MAC) → Bits (Physical).
Layers 7 4
A [Link] – [Link] /8
It allows many devices to share a single public IP address — crucial since IPv4 addresses are limited.
Types: Static NAT (1-to-1), Dynamic NAT (pool), PAT/Overloaded NAT (many-to-one using ports).
DNS translates human-readable domain names (e.g. [Link]) into IP addresses. It is a distributed,
hierarchical database.
OS/hosts file
2 Checks /etc/hosts (local override file) and OS DNS cache.
Recursive Resolver
3 Your ISP's DNS resolver (or [Link]) takes over. It does the heavy lifting.
Response cached
7 Resolver caches the result per TTL. Browser connects to the IP.
■ TTL (Time To Live) controls how long a DNS record is cached. Low TTL = frequent updates, high TTL = faster
resolution.
HTTP Methods
Method Purpose Idempotent? Safe?
3xx Redirection 301 Moved Permanently, 302 Found, 304 Not Modified
4xx Client Error 400 Bad Request, 401 Unauthorised, 403 Forbidden, 404 Not Found
5xx Server Error 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable
Use cases HTTP, FTP, SSH, Email DNS, Video streaming, Gaming, VoIP
Client Server
|--- SYN (seq=x) -----------> | Step 1: Client requests connection
|<-- SYN-ACK (seq=y,ack=x+1) --| Step 2: Server acknowledges + sends its seq
|--- ACK (ack=y+1) ----------> | Step 3: Client acknowledges server
|======= DATA TRANSFER ======== | Connection established!
Q. What is the difference between flow control and congestion control in TCP?
Flow Control prevents the sender from overwhelming the receiver. TCP uses a sliding window — the
receiver advertises how much buffer it has.
Congestion Control prevents the sender from overwhelming the network. Algorithms: Slow Start,
Congestion Avoidance, Fast Retransmit, Fast Recovery (AIMD principle).
URL Parsing
1 Browser parses the URL: scheme=https, host=[Link], path=/
HSTS Check
2 Browser checks its HSTS preload list — if [Link] is listed, it forces HTTPS.
DNS Resolution
Browser checks cache → OS cache → /etc/hosts → Recursive DNS resolver → Root NS → TLD
3
NS (.com) → Authoritative NS → IP returned (e.g. [Link]). Result cached per TTL.
TCP Connection
5 OS initiates a TCP 3-way handshake with [Link]:443 (HTTPS port).
TLS Handshake
Client Hello → Server Hello + Certificate → Key Exchange → Session key derived → Encrypted
6
tunnel established.
HTTP Request
7 Browser sends: GET / HTTP/2 Host: [Link] (plus cookies, user-agent, etc.)
Server Processing
8 Google's load balancer receives request, routes to an available server. Server generates response.
HTTP Response
9 Server responds: 200 OK with HTML content, headers (Content-Type, Cache-Control, etc.).
Rendering
Browser parses HTML, discovers CSS/JS/image resources, fires additional requests. DOM +
10
CSSOM → Render Tree → Layout → Paint → Composite.
Connection Reuse
11 TCP connection stays open (Keep-Alive) for subsequent requests.
■ In the interview, walk through OSI layers as you describe each step — it shows depth. Mention: DNS (App
layer), TCP (Transport), IP routing (Network), Ethernet/ARP (Data Link).
2. The target host replies: 'I have that IP. My MAC is AA:BB:CC:DD:EE:FF'
RARP does the reverse (MAC → IP). DHCP has now replaced RARP for address assignment.
Routing Protocols
Protocol Type Algorithm Metric Notes
RIP Distance Vector Bellman-Ford Hop count Max 15 hops; slow convergence
OSPF Link State Dijkstra (SPF) Cost (bandwidth) Fast convergence; scalable
BGP Path Vector Best path selection AS path, policies Internet backbone protocol
Q. What is a socket?
A socket is a combination of IP address + port number — it uniquely identifies a communication endpoint.
Every network connection has two sockets: one at each end (client socket and server socket).
Formally: socket = (IP address, port, protocol). Example: ([Link], 80, TCP)
Well-Known Ports
Port Protocol Service
22 TCP SSH
23 TCP Telnet
53 TCP/UDP DNS
80 TCP HTTP
Ephemeral Ports
When a client initiates a connection, it is assigned a temporary high port (1024–65535) called an ephemeral port.
The server listens on its well-known port (e.g. 80), while the client uses its ephemeral port.
Firewall
Stateful inspection: Tracks active connections — knows if a packet belongs to an established session.
Application-layer (WAF): Inspects HTTP content, blocks XSS, SQL injection etc.
DDoS Flood server with traffic from many sources Rate limiting, CDN, scrubbing centres
DNS Spoofing / PoisoningAttacker injects fake DNS records DNSSEC, use trusted resolvers
ARP Spoofing Attacker sends fake ARP replies to link their MAC toDynamic
another IP
ARP Inspection (DAI)
SYN Flood Send many SYN packets without completing 3-way handshake
SYN cookies,
(half-open
rate limits
conns)
When a user requests content, DNS routes them to the nearest CDN edge server instead of the origin.
Cache hit: Content served from edge — very fast. Cache miss: Edge fetches from origin, caches it.
Benefits: Lower latency, reduced origin load, DDoS protection, better availability.
Weighted Round Robin Heavier servers get more requests Different-capacity servers
Least Connections Route to server with fewest active connections Variable request duration
Reverse Proxy: Sits in front of servers. Clients don't know they're hitting a proxy. Used for load
balancing, SSL termination, caching, security. Examples: Nginx, HAProxy.
Bandwidth = max theoretical data rate (capacity of the pipe). Throughput = actual data transferred per
second (real-world). Throughput ≤ Bandwidth.
Time taken for a packet to travel from source to destination. Components: propagation + transmission +
processing + queuing delays.
A 48-bit hardware address burned into a NIC. Written as 6 hex pairs: AA:BB:CC:DD:EE:FF. Unique per
device on a LAN segment.
IP handles logical addressing and routing (getting packets to the right machine). TCP handles reliable,
ordered delivery between processes (on top of IP).
Determines which part of an IP is the network portion vs host portion. [Link] means first 3 octets =
network, last = host.
Internet Control Message Protocol — used for diagnostics. ping uses ICMP Echo Request/Reply.
traceroute uses ICMP TTL Exceeded messages.
Time To Live — decremented by 1 at each router. When it hits 0, the packet is dropped and ICMP Time
Exceeded is sent back. Prevents infinite loops.
An address that targets all hosts on a subnet. For [Link]/24, broadcast = [Link]. Routers do
not forward broadcasts.
Connection-oriented (TCP): establish → transfer → teardown. Reliable. Connectionless (UDP): just send.
No setup. Faster but unreliable.
When routers/links receive more traffic than they can handle — packets queue up, then get dropped. TCP
detects this via packet loss and slows down.
HTTPS = HTTP over TLS. Data is encrypted in transit. TLS provides: confidentiality, integrity, and server
authentication via certificates.
A semi-permanent interactive information interchange between two devices. OSI Layer 5 manages
session creation, maintenance, and termination.
SSL (Secure Sockets Layer) is the older, deprecated predecessor to TLS (Transport Layer Security). TLS
1.2 and 1.3 are current standards. People still say 'SSL' informally to mean TLS.
A tool that sends ICMP Echo Requests to a host. If the host replies, network is reachable. Measures
round-trip time (RTT).
Traces the path packets take to a destination, listing each hop (router). Sends packets with incrementing
TTL values to reveal each router along the path.
IPv4: 32-bit, ~4.3B addresses. IPv6: 128-bit, virtually unlimited. IPv6 has no NAT, built-in IPSec, simpler
header, auto-configuration.
Unicast = one-to-one. Multicast = one-to-many (group). Broadcast = one-to-all (subnet). IPv6 has no
broadcast — replaced by multicast.
Physical/logical arrangement of nodes. Types: Bus (single cable), Star (central switch), Ring (loop), Mesh
(every node connected), Hybrid.
Virtual LAN — logically segments a physical network into separate broadcast domains without needing
separate physical infrastructure.
Content Delivery Network — distributes cached content geographically so users are served from the
nearest edge server, reducing latency.
An endpoint for communication — identified by (IP address, port number, protocol). A connection has two
sockets, one at each end.
Q22. What happens if two devices on a network have the same IP?
IP conflict! Both devices may stop working correctly. ARP will have conflicting entries, packets will go to
unpredictable destinations.
Quality of Service — mechanisms to prioritise certain traffic types (e.g. voice over bulk downloads) to
reduce latency/jitter for time-sensitive apps.
Half-duplex: can send OR receive at a time (walkie-talkie). Full-duplex: can send AND receive
simultaneously (phone call).
GET retrieves data — params in URL, cached, bookmarkable, idempotent. POST sends data in request
body — not cached, for mutations, not idempotent.
Simple Mail Transfer Protocol — used to send emails (port 25/587). For receiving, IMAP (port 143) or
POP3 (port 110) is used.
Hub (Layer 1) broadcasts packets to all ports. Switch (Layer 2) learns MAC addresses and sends frames
only to the correct port — more efficient.
The router that a host sends traffic to when the destination is outside its local subnet. Typically the first
address in a subnet: [Link].
Circuit switching: dedicated path reserved (old telephone). Packet switching: data split into packets that
independently route through the network (internet). More efficient.
L2 switch: forwards frames based on MAC addresses. L3 switch: can route packets based on IP
addresses — acts as both switch and basic router.