Comprehensive University Study Guide: Computer Networks Units 1-4
UNIT 1 - Introduction to Networks & the Physical Layer
Definition of a Network
- A network consists of devices, referred to as "nodes," that are linked together either via wires or wirelessly.
- The fundamental purpose of these links is to facilitate the exchange of data.
Objectives of Network Construction
- Resource Sharing: This is the primary driver for building networks. Examples include:
- Business Context: Sharing hardware like printers, software files, and internet links, typically using a client-server model.
- Home Context: Using networks for messaging, streaming media, shopping, and general communication.
- Mobile Users: Utilizing networks for SMS texting, GPS navigation, and completing mobile payments.
- Social & Security Considerations: While networks provide utility, they also introduce risks such as snooping, phishing, and botnet attacks. This is why the study of network utility is intrinsically linked to social issues and security.
- Resource Sharing: This is the primary driver for building networks. Examples include:
Performance Metrics: Bandwidth vs. Latency
- Performance is defined by two primary figures, often conceptualized using a "pipe" analogy.
- Bandwidth: Represents the width of the pipe. It measures how much data can fit through the connection per second.
- Measurement: Bits per second ().
- Impact: It determines the speed of downloads and streaming.
- Latency: Represents the length of the pipe. It measures the delay for a single bit to travel from one end to the other.
- Measurement: Milliseconds ().
- Impact: It determines the responsiveness of real-time applications like gaming, Voice over IP (VoIP), and financial trading.
- Throughput: This is the actual data transfer rate achieved in practice. It is always less than the theoretical bandwidth ().
- Bandwidth-Delay Product: Defined as the product of Bandwidth and Latency. It represents the total volume of data that can be "in flight" within the network at any given moment.
- Formula:
- Jitter: Refers to the inconsistency or variation in latency. This is the primary cause for choppy or stuttering video calls.
- Example Scenario: A satellite link may possess huge bandwidth (a wide pipe) but suffer from terrible latency (a very long pipe). This configuration is acceptable for bulk downloads but makes the connection unusable for gaming.
Networking Hardware and Layer Classification
Hardware by OSI Layer
- Repeater (Layer 1 - Physical): Its job is to regenerate a weak signal. It does not interpret the data it receives.
- Hub (Layer 1 - Physical): Acts as a multiport repeater. It broadcasts incoming data to everyone connected to it, resulting in one shared collision domain.
- Bridge (Layer 2 - Data Link): Connects two distinct Local Area Network (LAN) segments. It uses a MAC address table to filter traffic.
- Switch (Layer 2 - Data Link): Essentially a multiport bridge. It provides dedicated bandwidth per port and uses smarter forwarding mechanisms.
- Router (Layer 3 - Network): Connects different networks together. It routes traffic based on IP addresses and divides broadcast domains.
- Gateway (Any Layer, usually Layer 7): Acts as a "protocol translator" between fundamentally dissimilar networks.
- Brouter (Hybrid): A device that acts as a bridge for non-routable protocols and a router for IP traffic.
Hardware Analogies
- Gateway: Like the gate of a castle; it converts outsiders' characteristics to match the standards of what is inside the castle.
- Router: Like an elevator; once you are inside the building, it selects the fastest floor or path to your destination.
Switch Forwarding Styles
- Cut-through: Forwards the frame as soon as the destination address is read. It is very fast but does not perform error checking.
- Store-and-forward: Waits for the entire frame to be received, then runs a Cyclic Redundancy Check (CRC). It is more reliable but slower.
- Fragment-free: Waits for the first bytes before forwarding. This is a compromise, as most network collisions occur within those first bytes.
Connections, Topologies, and Models
Data Flow Modes
- Simplex: One-way communication only (e.g., a keyboard sending data to a screen).
- Half-duplex: Two-way communication, but devices must take turns (e.g., a walkie-talkie).
- Full-duplex: Simultaneous two-way communication (e.g., a standard telephone call).
Link Types
- Point-to-point: A dedicated connection between exactly two devices.
- Multipoint: Shared capacity among multiple devices, either spatially or via time-sharing.
Physical Topologies
- Mesh: Every node connects to every other node.
- Links required for full mesh: .
- Pros/Cons: Extremely fault-tolerant but extremely expensive.
- Star: Every node connects to a central hub or switch. This is the current industry standard.
- Pros/Cons: Easy to scale and failures are isolated to individual nodes, but the central hub is a single point of failure.
- Bus: Features a single shared backbone cable.
- Pros/Cons: Cheap to implement, but a single break in the cable kills the entire network.
- Ring: Uses token passing for orderly communication.
- Pros/Cons: Organized, but a single break disrupts the entire loop.
- Mesh: Every node connects to every other node.
OSI Model vs. TCP/IP Model
- OSI Model (1984 ISO Standard): A theoretical blueprint with layers used for troubleshooting and conceptualizing networks.
- TCP/IP Model (1970s DARPA): The actual protocol suite with layers used to build the internet.
Mapping the Layers
- OSI Layer 7: Application (User-facing - Protocols: HTTP, SMTP, SSH)
- OSI Layer 6: Presentation (Encryption and formatting - Examples: JPEG, ASCII)
- OSI Layer 5: Session (Opens, manages, and closes connections)
- OSI Layer 4 (OSI Transport / TCP/IP Transport): Segments data and manages ports (Protocols: TCP, UDP)
- OSI Layer 3 (OSI Network / TCP/IP Internet): Handles logical addressing and routing (Protocol: IP)
- OSI Layer 2 (Data Link): Manages framing and MAC addresses (Protocol: Ethernet)
- OSI Layer 1 (Physical): Raw bits sent over wire, fiber, or radio.
- Note: In the TCP/IP model, OSI Layers 1 and 2 are combined into the Network Access layer, and Layers 5, 6, and 7 are combined into the Application layer.
Encapsulation and Decapsulation
- This is the process of nested envelopes. Each layer wraps the data from the layer above in its own header.
- Data progression: Data Segment Packet Frame Bits.
- Decapsulation is the reverse process of stripping headers as data moves up the stack.
Network Architecture, Scale, and Media
Architectures
- Client-Server: Centralized and stable. It costs more to implement and has a single point of failure.
- Peer-to-Peer (P2P): Every node acts as both a client and a server. It is cheap and resilient but difficult to secure at a large scale.
Network Scale Hierarchy
- BAN (Body Area Network): Used for pacemakers or insulin pumps ().
- PAN (Personal Area Network): Bluetooth connections ().
- LAN / WLAN: Local Area Network / Wireless LAN used in homes, offices, or buildings.
- CAN (Campus): Covers a university or military base.
- MAN (Metropolitan): City-wide networks, often using fiber rings.
- WAN (Wide Area Network): The internet itself; joins multiple LANs or MANs over vast distances via undersea fiber, leased lines, or satellites.
Transmission Media
- Guided (Wired): Twisted pair, coaxial, and fiber optic (fiber optic offers the highest capacity).
- Unguided (Wireless): Radio, microwave (requires line-of-sight), and infrared.
UNIT 2 - The Data Link Layer: Framing and Flow Control
Core Function: The Data Link Layer converts a raw stream of bits into reliable, addressed, and error-checked frames.
Framing Components: A frame consists of a header (addressing), a payload (the actual data), and a trailer (error check code).
Framing Approaches
- Fixed-size framing: No delimiters are needed, but it is inefficient because it requires padding when data is smaller than the frame (used in ATM/TDM).
- Variable-size framing: Requires either a length field (as in Ethernet) or an end delimiter (as in Token Ring) to define boundaries.
The Delimiter Problem and Stuffing Solutions
- The problem arises when the data payload contains the same pattern as the frame delimiter.
- Byte/Character Stuffing: An escape character is inserted before any accidental delimiter pattern found in the data.
- Bit Stuffing: If the flag is , the system inserts a after any sequence of consecutive s in the data to prevent a false flag match.
Flow Control Mechanisms
- Prevents a fast sender from overwhelming a slow receiver's buffer.
- Stop-and-Wait: The sender transmits one frame and must wait for an Acknowledgment (ACK) before sending the next. It is simple but inefficient on high-latency links.
- Sliding Window: Allows multiple unacknowledged frames to be "in flight" (pipelining). This improves bandwidth utility but requires more memory.
- Leaky Bucket: Smooths out bursty data input into a constant, steady output rate.
- Token Bucket: Similar to the leaky bucket but allows for short bursts of traffic if "tokens" have been accumulated over time. This is more flexible than the leaky bucket.
Error Detection and Robustness
Error Detection Logic: Data verification requires sending redundant bits.
Methods of Detection
- Simple Parity: Uses extra bit to ensure the count of s is either even or odd. It catches all single-bit errors but misses even-numbered bit flips.
- 2D Parity: Arranges data in a grid with row and column parity. It can correct single-bit errors but misses certain multi-bit patterns.
- Checksum: Uses 's-complement arithmetic summation. Commonly used in TCP/IP. It catches most errors and is fast to compute, but misses errors that mathematically cancel out.
- CRC (Cyclic Redundancy Check): Uses binary long division with a polynomial generator. It is the gold standard for Ethernet and Wi-Fi. It is very robust and catches burst errors.
How CRC Works
- The sender appends zeros to the data.
- The sender divides the string by an agreed-upon "generator."
- The remainder of this division becomes the CRC (sent with the data).
- The receiver performs the same division. If the remainder is zero, the data is accepted; otherwise, it is considered corrupt.
HDLC and Ethernet Protocols
HDLC (High-Level Data Link Control)
- A bit-oriented protocol. Frame structure:
Flag | Address | Control | Data | FCS | Flag. - Frame Types:
- I-Frame (Information): Control field starts with . Carries user data and sequence numbers.
- S-Frame (Supervisory): Control field starts with . Used for flow/error control (RR - Receive Ready, RNR - Receive Not Ready, REJ - Reject). No data is carried.
- U-Frame (Unnumbered): Control field starts with . Used for link setup and teardown (e.g., SABM, DISC).
- Modes of Operation:
- NRM (Normal Response Mode): The primary station leads.
- ARM (Asynchronous Response Mode): The secondary can speak with permission.
- ABM (Asynchronous Balanced Mode): Both sides are equal; supports full-duplex.
- A bit-oriented protocol. Frame structure:
Ethernet
- Frame Structure:
Preamble (sync)Destination MACSource MACEtherType/LengthPayload (46-1500 bytes)FCS (CRC). - Access Method: CSMA/CD (Carrier Sense Multiple Access with Collision Detection).
- Sense the channel.
- Transmit if the channel is idle.
- Monitor for collisions.
- If a collision occurs, stop, back off using Binary Exponential Backoff, and retry.
- Speed Evolution: Progressed from Ethernet to (Fast Ethernet), to (Gigabit), and currently and higher.
- Frame Structure:
VLANs, IP, and Address Resolution
Virtual LANs (VLANs)
- Logical groupings of devices that ignore physical wiring. They prevent "broadcast storms" and create security boundaries.
- Access Link: Carries traffic for only one VLAN; traffic is untagged.
- Trunk Link: Carries multiple VLANs over one physical link using IEEE 802.1Q tagging.
- Assignment Types: Static (manually assigned by admin) vs. Dynamic (assigned automatically by MAC address).
- Routing: Crossing between VLANs requires Inter-VLAN routing via a Layer-3 switch or a router.
Addressing Protocols
- IPv4: -bit addresses. Exhausted due to limited space, leading to subnetting and CIDR.
- IPv6: -bit addresses. Features a simpler header and built-in IPsec security.
- ARP (Address Resolution Protocol): Bridges Layer 3 (IP) to Layer 2 (MAC) within a LAN.
- Sender checks local ARP cache.
- If empty, the sender broadcasts a request: "Who has this IP?"
- The owner unicasts back its MAC address.
- Sender caches the result and transmits data.
- Security Vulnerability: ARP has no authentication. ARP Spoofing/Poisoning involves an attacker sending fake replies to intercept or redirect traffic (Man-in-the-Middle attack).
UNIT 3 - The Network & Transport Layers
Routing Fundamentals
- The Network layer acts as "air traffic control." It handles logical addressing and path selection.
- Routing Variables: Hop count, bandwidth, delay, load, and reliability.
- Types of Routing:
- Static: Manually hardcoded (rigid, low overhead, secure).
- Default: Directs unknown packets to a single exit (used for "stub" networks).
- Dynamic: Adaptable algorithms (e.g., OSPF) that adjust to network changes automatically (resilient but resource-intensive).
- Routing vs. Forwarding: Routing is the strategy (calculating the best path). Forwarding is the execution (moving a packet from input to output based on a table).
Packet Switching Methods
- Datagram (Connectionless): No setup needed. Each packet is routed independently and can arrive out of order. Reliability is handled by TCP (Layer 4). Example: TCP/IP.
- Virtual Circuit (Connection-Oriented): Requires a -phase process (setup transfer teardown). Packets follow a predefined path and arrive strictly in order. Reliability is handled by the network. Examples: X.25, ATM, MPLS.
End-to-End Delay Calculation
- Delay is cumulative at every hop: .
PPP (Point-to-Point Protocol):
- A simple WAN link protocol. Frame structure:
Flag-Address-Control-Protocol-Payload-FCS-Flag.
- A simple WAN link protocol. Frame structure:
TCP Congestion Control and Network Security
TCP Congestion Window (cwnd) Management
- Slow Start:
cwnddoubles every round trip (exponential growth) until it reachesssthresh. - Congestion Avoidance: Growth becomes linear ( segment per RTT) to cautiously probe capacity.
- Fast Retransmit: If duplicate ACKs are received, the system assumes packet loss and resends immediately without waiting for a timeout.
- Fast Recovery: Following fast retransmit,
cwndis halved rather than reset to to maintain throughput. - Timeout: If no ACKs arrive,
cwndcrashes back to , and the cycle restarts at Slow Start. This creates a "sawtooth" pattern in throughput graphs.
- Slow Start:
TCP Reno vs. TCP Vegas
- Reno: Reactive; waits for packet loss or duplicate ACKs to trigger a response. Best for steady traffic.
- Vegas: Proactive; predicts congestion by monitoring the gap between expected and actual throughput via RTT. Best for high/variable traffic.
Network Security (CIA Triad)
- Confidentiality, Integrity, Availability.
- Threats: Malware, Phishing, DoS/DDoS, Man-in-the-Middle, Insider threats.
- Vulnerabilities: Unpatched software, weak passwords, misconfigurations, cleartext (no encryption), and social engineering.
Security Defenses
- Firewalls: Evolved from simple packet filtering (IP/port) to stateful inspection, and finally to Next-Generation Firewalls (NGFW) with deep packet inspection.
- VPNs (Virtual Private Networks): Create encrypted tunnels. Includes Remote-Access (single user) and Site-to-Site (office-to-office).
- Encryption and Hashing:
- Symmetric (AES): One shared key; fast but difficult to distribute keys safely.
- Asymmetric (RSA): Public/private key pair; slower but solves the key distribution problem.
- Hashing: One-way and irreversible; used for password storage and integrity checks.
UNIT 4 - The Application Layer & Emerging Technologies
Role of the Application Layer
- Direct interface for the user. Functions: identifying partners, protocol selection, name resolution, data formatting, and session management.
Protocol Map
- Web: HTTP (plaintext), HTTPS (encrypted via TLS).
- Email: SMTP (sending), POP3 (download and delete from server), IMAP (syncing with server).
- File/Remote Access: FTP, TELNET (unencrypted), SSH (encrypted), NFS.
- Infrastructure:
- DNS: Resolves names to IP addresses.
- DHCP: Automatically assigns IPs via the "DORA" process (Discover Offer Request Acknowledge).
- Management:
- SNMP: Monitors devices via a Manager/Agent/MIB (Management Information Base) structure.
Emerging Technologies
- SDN (Software-Defined Networking): Separates the Control Plane ("where should this go?") from the Data Plane (forwarding).
- Features a centralized SDN Controller and the OpenFlow protocol.
- 3 Layers: Application Control (The Brain) Infrastructure (Physical switches).
- NFV (Network Function Virtualization): Replaces physical hardware (firewalls, load balancers) with software versions (VNFs) running on standard servers.
- Components: VNFs (software), NFVI (physical servers/hypervisors), MANO (Management and Orchestration for scaling).
- IoT (Internet of Things): Machine-to-machine communication with sensors.
- Workflow: Sensing Transmission (via MQTT/COAP/HTTP) Processing (Cloud/Edge) Action.
- Networking Impact: Drives IPv6 adoption, increases traffic volume, and requires ultra-low latency at the network "edge."
- SDN (Software-Defined Networking): Separates the Control Plane ("where should this go?") from the Data Plane (forwarding).
Cross-Unit Summary
- Unit 1: Focuses on infrastructure, structure, layers, topology, and physical hardware.
- Unit 2: Focuses on reliable frame exchange between directly connected devices.
- Unit 3: Focuses on global pathfinding (routing) across networks, security, and congestion management.
- Unit 4: Focuses on user-facing applications and the shift toward software-defined networking and IoT.