Loading...
Loading...
Network: Do ya zyada computers jo data share karne ke liye connected hain.
Benefits:
Network Types: | Type | Coverage | Example | |------|----------|---------| | PAN | Room | Bluetooth | | LAN | Building/campus | Office Wi-Fi | | MAN | City | Cable TV network | | WAN | Country/World | Internet |
Layer 7: Application → HTTP, FTP, SMTP, DNS, Telnet
Layer 6: Presentation → SSL/TLS, JPEG, ASCII, Encryption
Layer 5: Session → Session management, NetBIOS
Layer 4: Transport → TCP, UDP (Port numbers)
Layer 3: Network → IP, ICMP, Routing
Layer 2: Data Link → Ethernet, MAC addresses, ARP, Switch
Layer 1: Physical → Cables, Wi-Fi, bits as electrical/optical signals
Mnemonic (top to bottom): "All People Seem To Need Data Processing"
Data Encapsulation:
Application → Data
Transport → Segment (+ port numbers)
Network → Packet (+ IP addresses)
Data Link → Frame (+ MAC addresses)
Physical → Bits (0s and 1s)
Application Layer → Application + Presentation + Session (OSI)
Transport Layer → Transport (TCP/UDP)
Internet Layer → Network (IP)
Network Access → Data Link + Physical
3-Way Handshake (Connection Setup):
Client ──── SYN ──────────► Server
Client ◄─── SYN-ACK ──────── Server
Client ──── ACK ──────────► Server
[Connected! Data transfer begins]
4-Way Termination:
Client ──── FIN ──────────► Server
Client ◄─── ACK ──────────── Server
Client ◄─── FIN ──────────── Server
Client ──── ACK ──────────► Server
TCP features: Sequence numbers, acknowledgments, flow control (sliding window), congestion control, error detection.
Header: Source Port | Dest Port | Length | Checksum
(Only 8 bytes!)
No connection, no guarantee, just speed.
Use: DNS, DHCP, Video streaming, Online gaming
Class A: 1.0.0.0 – 126.255.255.255 /8 (large orgs)
Class B: 128.0.0.0 – 191.255.255.255 /16 (medium orgs)
Class C: 192.0.0.0 – 223.255.255.255 /24 (small networks)
Class D: 224.0.0.0 – 239.255.255.255 Multicast
Class E: 240.0.0.0 – 255.255.255.255 Reserved
Private Ranges (not on internet):
10.0.0.0/8
172.16.0.0 – 172.31.255.255 (/12)
192.168.0.0/16
Network: 192.168.1.0/24
Subnet Mask: 255.255.255.0
Hosts: 2^8 – 2 = 254
Split into 4 subnets → borrow 2 bits → /26
New mask: 255.255.255.192
Subnet 1: 192.168.1.0/26 → hosts .1–.62, broadcast .63
Subnet 2: 192.168.1.64/26 → hosts .65–.126, broadcast .127
Subnet 3: 192.168.1.128/26 → hosts .129–.190, broadcast .191
Subnet 4: 192.168.1.192/26 → hosts .193–.254, broadcast .255
Hosts per subnet: 2^6 – 2 = 62
Request:
GET /notes HTTP/1.1
Host: wohotech.in
User-Agent: Chrome/120
Response:
HTTP/1.1 200 OK
Content-Type: text/html
[page content]
Common Status Codes:
200 OK, 201 Created, 301 Redirect
400 Bad Request, 401 Unauthorized, 403 Forbidden
404 Not Found, 500 Internal Server Error
1. Browser checks own cache
2. OS checks /etc/hosts file
3. Query → Local DNS Resolver (ISP)
4. Resolver checks cache → if miss:
5. Query Root DNS server (.)
6. Root → .com TLD server
7. TLD → google.com Authoritative server
8. Authoritative → returns 142.250.x.x
9. Resolver caches → returns to browser
10. Browser connects to IP
SMTP (port 25/587): Send mail
POP3 (port 110): Download mail, delete from server
IMAP (port 143): Access mail, stays on server, sync across devices
| Device | OSI Layer | Function | |--------|-----------|----------| | Hub | Physical (L1) | Broadcast to all ports | | Switch | Data Link (L2) | Forward by MAC address | | Router | Network (L3) | Route by IP address | | Firewall | L3/L4/L7 | Filter traffic by rules | | Access Point | L1/L2 | Wireless connectivity | | Modem | L1 | Convert digital↔analog |
Static Routing: Admin manually configures routes
ip route 10.0.0.0 255.0.0.0 192.168.1.1
Dynamic Routing:
RIP (Routing Information Protocol):
Distance vector, metric = hop count, max 15 hops
Updates every 30 seconds, slow convergence
OSPF (Open Shortest Path First):
Link state, Dijkstra algorithm, metric = cost
Fast convergence, scalable, used in enterprise
BGP (Border Gateway Protocol):
Path vector, used between ISPs (Internet backbone)
Policy-based, autonomous system routing
Phishing: Fake emails/websites steal credentials
MITM: Intercept communication between two parties
DDoS: Flood server with traffic → crash
SQL Injection: Malicious SQL in input fields
Packet Sniffing: Capture unencrypted network traffic
ARP Spoofing: Fake ARP replies → redirect traffic
Firewall: Block/allow traffic by rules (port, IP, protocol)
IDS/IPS: Detect/prevent intrusions
Encryption: HTTPS (TLS), VPN, SSH
Authentication: Strong passwords, MFA, certificates
Updates: Patch known vulnerabilities regularly
# Allow established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow HTTP/HTTPS
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Allow SSH from specific IP only
iptables -A INPUT -p tcp -s 192.168.1.100 --dport 22 -j ACCEPT
# Drop all other incoming
iptables -A INPUT -j DROP
Q: MAC address aur IP address mein kya fark hai? A: MAC (Media Access Control): hardware address, factory mein assigned, 48-bit hex (AA:BB:CC:DD:EE:FF), same LAN ke andar communication. IP: logical address, software assigned, changes with network, routing ke liye use hota hai.
Q: DHCP kya karta hai? A: Dynamic Host Configuration Protocol — automatically IP address, subnet mask, gateway, DNS server assign karta hai. Koi manually configure nahi karna padta. Server → broadcast → client request → server offers IP → client accepts → server confirms (DORA process).
Q: Ping aur Traceroute mein kya difference hai? A: Ping: ICMP echo request/reply, connectivity test, RTT measure. Traceroute: TTL badha ke har hop ka IP pata karta hai — poora path map ho jaata hai source se destination tak.
Complete Computer Networks notes for BCA Sem 4 — OSI Model, TCP/IP, IP Addressing, DNS, HTTP, Routing, Network Security, Subnetting with diagrams and viva Q&A.
42 pages · 2.1 MB · Updated 2026-03-11
7 layers: Physical (bits/signals), Data Link (MAC, framing), Network (IP, routing), Transport (TCP/UDP, port), Session (connection management), Presentation (encryption, encoding), Application (HTTP, DNS, FTP — user-facing).
TCP: connection-oriented, reliable, ordered, slow (3-way handshake). Use: web, email, file transfer. UDP: connectionless, unreliable, fast, no overhead. Use: DNS, video streaming, gaming, VoIP.
IP address network pe device ki unique identity. IPv4: 32-bit dotted decimal (192.168.1.1) — ~4B addresses, exhausted. IPv6: 128-bit hex colon (2001:db8::1) — 340 undecillion addresses, built-in security.
Switch: Layer 2, same network ke devices connect karta hai MAC address se (LAN). Router: Layer 3, different networks connect karta hai IP address se, routing decisions leta hai (LAN↔WAN, internet).
Domain name → IP address resolve karta hai. www.google.com → 142.250.x.x. Hierarchy: Root → .com TLD → google.com Authoritative server. Local cache → ISP resolver → Root → TLD → Authoritative.
Your feedback helps us improve notes and tutorials.