Loading...
Loading...
A Computer Network is a collection of interconnected devices (computers, servers, smartphones) that can communicate and share resources.
Why Networks?
Mnemonic: Please Do Not Throw Sausage Pizza Away (Physical→Application)
| Layer | Name | Function | Protocols | Unit | |---|---|---|---|---| | 7 | Application | User interface | HTTP, FTP, SMTP, DNS | Data | | 6 | Presentation | Encryption, compression | SSL, JPEG, ASCII | Data | | 5 | Session | Session management | NetBIOS, RPC | Data | | 4 | Transport | Reliable delivery, ports | TCP, UDP | Segment | | 3 | Network | Routing, IP addressing | IP, ICMP, ARP | Packet | | 2 | Data Link | Frame delivery, MAC | Ethernet, Wi-Fi | Frame | | 1 | Physical | Bit transmission | Cables, Radio, NIC | Bit |
Data Encapsulation: Each layer adds its header as data moves down. Decapsulation happens on receive.
| TCP/IP Layer | OSI Equivalent | Protocols | |---|---|---| | Application | 5+6+7 | HTTP, FTP, SMTP, DNS, DHCP | | Transport | 4 | TCP, UDP | | Internet | 3 | IP, ICMP, ARP, RARP | | Network Access | 1+2 | Ethernet, Wi-Fi, PPP |
| Feature | TCP | UDP | |---|---|---| | Connection | Connection-oriented (3-way handshake) | Connectionless | | Reliability | Guaranteed delivery, ACK | No guarantee | | Order | Ordered | May arrive out-of-order | | Speed | Slower | Faster | | Header Size | 20 bytes | 8 bytes | | Flow Control | Yes (sliding window) | No | | Use Cases | HTTP, FTP, Email, SSH | DNS, DHCP, VoIP, Video |
Client Server
|---SYN(seq=x)---→| Step 1: Client sends SYN
|←--SYN-ACK(seq=y,ack=x+1)--| Step 2: Server responds SYN-ACK
|---ACK(ack=y+1)--→| Step 3: Client sends ACK
|===Connected======| Connection established!
Connection Termination (4-way):
Client: FIN → Server: ACK → Server: FIN → Client: ACK
(TIME_WAIT state: client waits 2*MSL before fully closing)
32-bit address, written as 4 octets: 192.168.1.100
Classes:
| Class | Range | Default Mask | Networks | Hosts | |---|---|---|---|---| | A | 1-126 | /8 (255.0.0.0) | 126 | ~16M | | B | 128-191 | /16 (255.255.0.0) | 16K | ~65K | | C | 192-223 | /24 (255.255.255.0) | 2M | 254 | | D | 224-239 | Multicast | — | — |
Special Addresses:
127.0.0.1 — Loopback (localhost)0.0.0.0 — This host, any address255.255.255.255 — Broadcast192.168.x.x, 10.x.x.x, 172.16-31.x.x — PrivateCIDR Notation: 192.168.1.0/24 means 24 bits for network, 8 bits for host
Network Address: 192.168.1.0/24
Subnet Mask: 255.255.255.0
First Host: 192.168.1.1
Last Host: 192.168.1.254
Broadcast: 192.168.1.255
Total hosts: 2^8 - 2 = 254
Subnetting example — /26:
/26 → 26 network bits, 6 host bits
Hosts per subnet = 2^6 - 2 = 62
Subnets from /24 = 4
Subnet 1: .0 to .63 (hosts .1 to .62)
Subnet 2: .64 to .127 (hosts .65 to .126)
Subnet 3: .128 to .191
Subnet 4: .192 to .255
128-bit address, written as 8 groups of 4 hex digits:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Shorthand: Consecutive zeros → :: (once only)
2001:db8::1
Routing: Finding best path from source to destination.
| Type | Algorithm | Metric | Where Used | |---|---|---|---| | Distance Vector | RIP | Hop count | Small networks | | Link State | OSPF | Cost (bandwidth) | Large enterprises | | Path Vector | BGP | Policy-based | Internet (between ISPs) |
RIP (Routing Information Protocol):
OSPF (Open Shortest Path First):
BGP (Border Gateway Protocol):
| Feature | Static | Dynamic | |---|---|---| | Configuration | Manual by admin | Auto via protocols | | Overhead | No routing overhead | Protocol overhead | | Scalability | Poor | Good | | Convergence | Instant | Time needed | | Use case | Small networks | Large enterprise/ISP |
Translates domain names → IP addresses.
Browser types: www.google.com
1. Check local cache
2. Check /etc/hosts
3. Query Recursive Resolver (ISP's DNS)
4. Resolver queries Root DNS Server
5. Root → TLD server (.com)
6. TLD → Authoritative DNS (Google's)
7. Authoritative → returns IP: 142.250.190.46
8. Cache result (TTL-based)
DNS Record Types:
| Record | Purpose | Example | |---|---|---| | A | Domain → IPv4 | google.com → 142.250.x.x | | AAAA | Domain → IPv6 | | | CNAME | Alias | www → google.com | | MX | Mail server | gmail.com → aspmx.l.google.com | | NS | Name server | | | TXT | Text (SPF, verification) | |
HTTP Methods:
GET — Retrieve data (idempotent, safe)POST — Send data, create resourcePUT — Replace entire resourcePATCH — Partial updateDELETE — Remove resourceHTTP Status Codes:
1xx: Informational (100 Continue)
2xx: Success (200 OK, 201 Created, 204 No Content)
3xx: Redirection (301 Moved, 302 Found, 304 Not Modified)
4xx: Client Error (400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found)
5xx: Server Error (500 Internal, 502 Bad Gateway, 503 Unavailable)
HTTP/1.1 vs HTTP/2 vs HTTP/3:
| Protocol | Port | Purpose | |---|---|---| | SMTP | 25 / 587 | Sending email | | POP3 | 110 / 995 | Download + delete from server | | IMAP | 143 / 993 | Sync email (stays on server) |
| Device | Layer | Function | |---|---|---| | Hub | 1 - Physical | Broadcast to all ports, dumb | | Switch | 2 - Data Link | Forward based on MAC table | | Router | 3 - Network | Route based on IP, connect networks | | Bridge | 2 - Data Link | Connect two LAN segments | | Firewall | 3-7 | Filter traffic, security | | Gateway | All | Protocol conversion | | Modem | 1 | Modulate/demodulate signals |
NAT (Network Address Translation):
Private IP (192.168.1.x) ← NAT Router → Public IP (ISP assigned)
Allows multiple devices to share one public IP
SSL/TLS Handshake:
1. Client Hello (supported cipher suites)
2. Server Hello + Certificate (public key)
3. Client verifies certificate (CA chain)
4. Key Exchange (pre-master secret encrypted with server's public key)
5. Both derive session keys
6. Finished messages (verify all good)
7. Encrypted communication begins
Common Network Attacks:
Firewalls:
Complete CN notes covering OSI model, TCP/IP, subnetting, routing, switching, DNS, HTTP, SSL/TLS, and networking interview questions for B.Tech CS Sem 5.
62 pages · 3.1 MB · Updated 2026-03-11
OSI 7 layers hai (conceptual model), TCP/IP 4 layers hai (practical implementation). OSI theoritical, TCP/IP internet par actually use hota hai.
TCP reliable, connection-oriented, ordered delivery, flow control (HTTP, FTP, email). UDP fast, connectionless, no guarantee (video streaming, DNS, gaming).
HTTPS = HTTP + SSL/TLS encryption. Port 443 vs 80. HTTPS data encrypt karta hai man-in-middle attacks se protect karne ke liye.
Large networks ko smaller logical networks mein divide karta hai — better performance, security, IP address management. CIDR notation use hoti hai /24, /16 etc.
Switch Layer 2 pe kaam karta hai (MAC address, same network). Router Layer 3 pe (IP address, different networks connect karta hai).
Software Engineering — SDLC, Agile, UML, Testing
Software Engineering
Artificial Intelligence — Search, Logic, ML Basics Complete Notes
Artificial Intelligence
Computer Organization and Architecture — Complete Notes
Computer Organization & Architecture
DBMS Complete Notes — B.Tech CS Sem 4
Database Management Systems
Compiler Design — Complete Notes CS Sem 6
Compiler Design
Your feedback helps us improve notes and tutorials.