Group B — Medium / Descriptive Questions (5 Marks Each)
OSI 7 Layer Architecture
The Open Systems Interconnection (OSI) model is a conceptual framework used to describe the functions of a networking system. It characterizes computing functions into a universal set of rules and requirements to support interoperability.
- Physical Layer: Transmits raw bit streams (0s and 1s) over a physical medium (cables, radio). Deals with voltages, hubs, and repeaters.
- Data Link Layer: Organizes bits into Frames. Provides node-to-node data transfer and handles MAC addressing and Error Detection (CSMA/CD, Switches).
- Network Layer: Organizes frames into Packets. Handles logical IP addressing and Routing to determine the best path (Routers, IPv4/IPv6).
- Transport Layer: Organizes packets into Segments. Ensures reliable, in-order, end-to-end delivery using Port numbers. Handles Error Correction and Flow Control (TCP, UDP).
- Session Layer: Establishes, maintains, and terminates connections (sessions) between local and remote applications.
- Presentation Layer: Formats, encrypts, and compresses data so it can be understood by the application layer (SSL/TLS, JPEG, ASCII).
- Application Layer: Directly interacts with the software application. Provides network services to end-users (HTTP, FTP, SMTP, DNS).
OSI Model vs TCP/IP Model
| Feature | OSI Model | TCP/IP Model |
|---|---|---|
| Origin & Nature | A theoretical reference model developed by ISO. | A practical, implementation-first model developed by ARPANET/DoD. |
| Number of Layers | 7 Layers (Physical, Data Link, Network, Transport, Session, Presentation, Application) | 4 Layers (Network Access, Internet, Transport, Application) |
| Session & Presentation | Has dedicated Session and Presentation layers. | Session and Presentation functions are merged into the Application layer. |
| Network Layer Delivery | Supports both connectionless and connection-oriented communication. | Internet layer exclusively supports connectionless communication (IP). |
Transmission Media (Guided)
Transmission media are the physical pathways that carry data from a transmitter to a receiver.
- Twisted Pair Cable: Consists of two insulated copper wires twisted around each other to cancel out Electromagnetic Interference (EMI) and crosstalk.
• Unshielded (UTP): Cheap, flexible, used in standard Ethernet (Cat5e/Cat6).
• Shielded (STP): Has metal foil casing for better noise protection. - Coaxial Cable: Has a central copper conductor core, surrounded by an insulating layer, a braided metal shield, and an outer plastic jacket. Carries higher frequency signals than twisted pair. Used heavily for Cable TV and older broadband.
- Fiber Optics: Uses total internal reflection to transmit data as pulses of light through a glass or plastic core.
• Pros: Extremely high bandwidth, completely immune to electromagnetic interference, spans massive distances.
• Cons: Expensive, fragile, and difficult to splice.
Switching Techniques
| Feature | Circuit Switching | Packet Switching |
|---|---|---|
| Connection Path | A dedicated, physical path is established between sender and receiver before transmission begins. | No dedicated path. Data is broken into packets which travel independently over various routes. |
| Bandwidth Usage | Bandwidth is reserved and wasted if no data is being sent (inefficient). | Bandwidth is dynamically shared among all users (highly efficient). |
| Order of Delivery | Data always arrives in the exact order it was sent. | Packets may arrive out-of-order and must be reassembled at the destination. |
| Primary Use Case | Traditional telephone networks (Voice calls). | The Internet (Data transfer). |
Error Detection: Cyclic Redundancy Check (CRC)
CRC is a highly robust error-detecting code used in the Data Link Layer (like Ethernet). It uses polynomial binary division.
Mechanism:
- Generator Polynomial: Both sender and receiver agree on a generator polynomial \(G(x)\) (represented as a binary divisor, e.g., 1101). Let the length of \(G\) be \(n\).
- Appending Zeros: The sender appends \(n-1\) zero bits to the end of the original Data message \(M\).
- Modulo-2 Division: The sender performs binary Modulo-2 division (which is just XORing) of the appended data by \(G\).
- Remainder (CRC): The remainder of this division is the CRC checksum.
- Transmission: The sender replaces the appended zeros with the CRC checksum and transmits the frame.
- Verification: The receiver divides the received frame by \(G\). If the remainder is exactly zero, the frame is accepted as error-free. Otherwise, it is rejected.
Error Correction: Hamming Code
Hamming Code is a block code that is capable of detecting up to two simultaneous bit errors and correcting single-bit errors.
Mechanism:
- Redundant Bits Calculation: Given \(m\) data bits, the number of redundant parity bits \(r\) must satisfy: \(2^r \ge m + r + 1\).
- Positioning: Parity bits are placed at positions that are powers of 2 (1, 2, 4, 8...). Data bits fill the remaining positions.
- Parity Calculation: Each parity bit calculates Even (or Odd) parity for a specific overlapping set of bit positions. For example, \(P_1\) checks positions 1, 3, 5, 7. \(P_2\) checks 2, 3, 6, 7.
- Error Correction at Receiver: The receiver recalculates all parity bits. If there is an error, the parity bits that fail will form a binary number indicating the exact position of the flipped bit. The receiver simply flips that bit back to correct the error.
Stop-and-Wait ARQ Protocol
Stop-and-Wait ARQ is the simplest flow and error control protocol.
- Mechanism: The sender transmits exactly ONE frame and then stops. It waits for an Acknowledgement (ACK) from the receiver before sending the next frame.
- Error Handling: If the frame is lost or corrupted (failed CRC), the receiver stays silent (or sends a NAK). The sender's timer expires (Timeout), and it retransmits the same frame.
- Sequence Numbers: Frames and ACKs are numbered (0 or 1) to prevent duplicate frames.
Efficiency Formula
\[ \text{Efficiency } (\eta) = \frac{\text{Transmission Time (Tt)}}{\text{Total Cycle Time}} = \frac{T_t}{T_t + 2 \times T_p} = \frac{1}{1 + 2a} \]
Where \(a = \frac{T_p}{T_t}\) (Propagation Delay / Transmission Delay). It is highly inefficient for links with high propagation delay (like satellites) because the sender is idle most of the time.
Go-Back-N ARQ Protocol
Go-Back-N is a Sliding Window protocol that improves upon Stop-and-Wait by allowing the sender to transmit multiple frames before receiving an ACK.
- Window Sizes:
• Sender Window Size \(W_s = N\) (can send up to N unacknowledged frames).
• Receiver Window Size \(W_r = 1\) (can only accept frames strictly in order). - Mechanism: If frame 3 is lost, but the sender continues to send frames 4, 5, and 6, the receiver will discard 4, 5, and 6 because it is strictly waiting for frame 3.
- Retransmission: When the sender times out waiting for the ACK for frame 3, it must "Go Back N" frames and retransmit frame 3 AND all subsequent frames (4, 5, 6).
- Efficiency: Much better than Stop-and-Wait, but wastes bandwidth on noisy channels due to retransmitting correctly received out-of-order frames.
Selective Repeat ARQ Protocol
Selective Repeat is the most efficient Sliding Window protocol, designed to overcome the wasted bandwidth of Go-Back-N on noisy channels.
- Window Sizes:
• Sender Window Size \(W_s = 2^{m-1}\).
• Receiver Window Size \(W_r = 2^{m-1}\) (where m is sequence number bits). Both windows must be equal and half the maximum sequence number. - Mechanism: The receiver has a window larger than 1, meaning it can accept and buffer out-of-order frames. If frame 3 is lost, but 4, 5, and 6 arrive intact, the receiver buffers 4, 5, and 6 and sends a NAK specifically for frame 3.
- Retransmission: The sender only retransmits the specific frame that was lost (frame 3). Once the receiver gets frame 3, it delivers 3, 4, 5, and 6 to the Network layer in order.
ALOHA Protocols: Pure vs Slotted
ALOHA is a random-access MAC protocol used for satellite and wireless communications.
| Feature | Pure ALOHA | Slotted ALOHA |
|---|---|---|
| Transmission Rule | Any station can transmit data at any time it has a frame ready. | Time is divided into discrete slots. Stations can only transmit at the beginning of a time slot. |
| Vulnerable Time | \(2 \times T_f\) (Twice the frame transmission time). | \(T_f\) (Exactly one frame transmission time). Collisions only happen if two stations pick the exact same slot. |
| Maximum Throughput | \(S = G \times e^{-2G}\)
Max efficiency is 18.4% (when \(G = 0.5\)). |
\(S = G \times e^{-G}\)
Max efficiency is 36.8% (when \(G = 1\)). |
CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
CSMA/CD is a MAC protocol used in traditional wired Ethernet LANs.
Mechanism:
- Sense: A station listens to the cable. If idle, it transmits. If busy, it waits.
- Detect: While transmitting, the station simultaneously listens. If it detects a signal amplitude higher than its own, a Collision has occurred.
- Abort & Jam: It immediately stops transmitting the data frame and sends a short "Jam Signal" so all other stations know a collision happened.
Binary Exponential Backoff Algorithm
To prevent immediate re-collision, colliding stations wait a random amount of time before retrying. After the \(c\)-th collision (where \(c \le 10\)), a station chooses a random number \(K\) between \(0\) and \(2^c - 1\). It waits \(K \times 51.2 \mu s\) before sensing the line again. This exponentially increases the waiting time range, spreading out retries under heavy load.
CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance)
CSMA/CA is used in Wireless LANs (Wi-Fi / 802.11) because wireless nodes cannot transmit and listen at the same time to detect collisions (the "Hidden Terminal Problem").
Mechanism (Collision Avoidance):
- DIFS: A station with a frame to send listens to the channel. If idle for a period called DIFS, it proceeds.
- RTS/CTS Handshake: To avoid hidden terminals, the sender transmits a short Request To Send (RTS) frame. The Access Point responds with a Clear To Send (CTS) frame broadcasted to everyone, reserving the channel.
- Data & ACK: The sender transmits the Data frame. The receiver replies with an ACK. If no ACK is received, a collision is assumed, and the sender uses exponential backoff before retrying.
IPv4 Address Classes
An IPv4 address is 32 bits long. Classful addressing divided the IP space into 5 distinct classes based on the leading bits of the first octet.
| Class | Leading Bits | First Octet Range | Network/Host Split | Purpose |
|---|---|---|---|---|
| Class A | 0 | 1 - 126 | N.H.H.H (8/24) | Massive networks (16M hosts). |
| Class B | 10 | 128 - 191 | N.N.H.H (16/16) | Medium networks (65K hosts). |
| Class C | 110 | 192 - 223 | N.N.N.H (24/8) | Small networks (254 hosts). |
| Class D | 1110 | 224 - 239 | N/A | Multicasting (Sending to groups). |
| Class E | 1111 | 240 - 255 | N/A | Reserved for Future/Experimental use. |
(Note: 127.x.x.x is reserved for Loopback testing).
Subnetting and Subnet Masks
Subnetting is the process of logically dividing a single large IP network into multiple smaller, manageable sub-networks (subnets). This reduces broadcast traffic and conserves IP addresses.
Mechanism
It works by "borrowing" bits from the Host portion of the IP address and reassigning them to the Network portion to create Subnet IDs.
Subnet Mask
A 32-bit number used by routers to distinguish the Network/Subnet ID from the Host ID. It consists of a continuous stream of 1s (representing Network/Subnet bits) followed by a continuous stream of 0s (representing Host bits).
Example: A default Class C mask is 255.255.255.0. If we borrow 1 bit for subnetting, the mask becomes 255.255.255.128 (11111111.11111111.11111111.10000000), yielding 2 subnets of 126 hosts each.
CIDR (Classless Inter-Domain Routing)
CIDR was introduced to replace the rigid Classful (A, B, C) IP addressing system, which was rapidly depleting the IPv4 address space due to massive waste.
CIDR Notation (Slash Notation)
Instead of relying on fixed classes, CIDR uses a variable-length subnet mask (VLSM). An IP address is written with a slash followed by the prefix length: IP_Address / Prefix.
The Prefix (e.g., /26) explicitly states exactly how many bits from left to right represent the Network ID. The remaining bits (\(32 - \text{Prefix}\)) represent the Host ID.
Example: 192.168.1.0 /26. The network uses 26 bits. Hosts use \(32 - 26 = 6\) bits. Total hosts per subnet = \(2^6 - 2 = 62\) usable hosts.
Address Resolution Protocol (ARP)
ARP is a critical protocol used to map a known logical IP Address to an unknown physical MAC Address on a local network.
Workflow:
- ARP Request: A host wants to send data to IP
192.168.1.10but doesn't know its MAC address. The host broadcasts an ARP Request frame to the entire local network: "Who has IP 192.168.1.10? Tell me your MAC address." (Destination MAC isFF:FF:FF:FF:FF:FF). - ARP Reply: All devices receive the request, but only the device with IP
192.168.1.10processes it. It sends a Unicast ARP Reply back to the original sender containing its MAC address. - Caching: The sender saves this IP-to-MAC mapping in its local ARP Cache table for future use.
RARP, BOOTP, and DHCP
These protocols handle assigning IP addresses to devices.
- RARP (Reverse ARP): Used by diskless workstations to discover their own IP address when they boot up. The device broadcasts its MAC address asking, "What is my IP?". It was obsolete because it only provided an IP address, no subnet mask or gateway.
- BOOTP (Bootstrap Protocol): An improvement over RARP. It provided the IP address, subnet mask, and default gateway. However, mappings were static; an admin had to manually bind MACs to IPs in a server file.
- DHCP (Dynamic Host Configuration Protocol): The modern standard. It dynamically leases IP addresses from a pool to devices for a specific duration. It automates entire network configurations (IP, Mask, Gateway, DNS servers) with zero manual admin work. Uses the DORA process (Discover, Offer, Request, Acknowledge).
Distance Vector Routing
A dynamic routing algorithm (like RIP) where every router shares its entire routing table, but only with its immediate neighbors, at regular intervals.
Mechanism:
Routers calculate the best path using the Bellman-Ford equation. They don't know the full topology of the network; they only know "Route X is in that direction and is Y hops away".
Count-to-Infinity Problem:
A major flaw in DVR. If a network link goes down, Router A might think it can reach the broken network via Router B, while Router B thinks it can reach it via Router A. They continuously update each other, infinitely increasing the hop count (distance) until it hits infinity. Solutions include Split Horizon and Route Poisoning.
Link State Routing
A modern dynamic routing algorithm (like OSPF) that solves the Count-to-Infinity problem.
Mechanism:
- Discovery: Every router says "hello" to its immediate neighbors to learn their identities and link costs.
- Flooding (LSA): Each router creates a Link State Packet (LSP) containing the state/cost of its direct links. It floods this packet to every single router in the entire network.
- Database Construction: Every router builds an identical, complete map (Topology Database) of the entire network.
- Dijkstra's Algorithm: Every router independently runs Dijkstra's Shortest Path algorithm on this map to compute the optimal routing table to all destinations.
Internet Control Message Protocol (ICMP)
ICMP is a Network Layer protocol used by routers and hosts to send error messages and operational information. It does not carry user data.
Key Utility Tools:
- Ping: Sends an ICMP Echo Request message to a destination IP. If the destination is alive and reachable, it replies with an ICMP Echo Reply. Used to test basic connectivity and measure round-trip time.
- Traceroute: Used to map the exact path a packet takes through the internet. It works by sending packets with increasing TTL (Time To Live) values (1, 2, 3...). When a packet reaches a router and TTL hits 0, the router drops it and sends back an ICMP Time Exceeded error, revealing that router's IP address.
TCP 3-Way Handshake
TCP is a connection-oriented protocol. Before any data can be transferred, a reliable connection must be established between the client and server using a 3-way handshake.
- SYN: The client sends a packet with the
SYNflag set and a random initial Sequence Number (x) to the server. - SYN-ACK: The server receives the SYN. It replies with a packet that has both
SYNandACKflags set. It acknowledges the client's sequence number (ack = x+1) and provides its own random initial Sequence Number (y). - ACK: The client receives the SYN-ACK. It replies with an
ACKacknowledging the server's sequence number (ack = y+1). The connection is now established.
TCP 4-Way Connection Termination
TCP connections are full-duplex, meaning both directions must be shut down independently. This takes 4 steps.
- FIN (Client): The client has no more data to send, so it sends a
FINsegment to the server. - ACK (Server): The server acknowledges the
FINwith anACK. The client-to-server connection is now closed. However, the server might still have data to send to the client. - FIN (Server): Once the server finishes sending all its data, it sends its own
FINsegment to the client. - ACK (Client): The client acknowledges the server's
FINwith a finalACK. The connection is completely closed.
TCP Flow Control (Sliding Window)
Flow control prevents a fast sender from overwhelming a slow receiver. TCP uses a dynamic Sliding Window protocol to achieve this.
- Receiver Window (rwnd): Every time the receiver sends an ACK to the sender, it includes a "Window Size" field in the TCP header. This number tells the sender exactly how many bytes of buffer space are currently available at the receiver.
- Dynamic Adjustment: If the receiver's application processes data slowly, its buffer fills up, and it advertises a smaller window to the sender. The sender must slow down.
- Zero Window: If the receiver's buffer is completely full, it advertises a window size of 0. The sender stops transmitting entirely until it receives a window update greater than 0.
TCP Congestion Control
While Flow Control protects the receiver, Congestion Control protects the entire network (routers and links) from being overwhelmed.
TCP maintains a Congestion Window (cwnd). The sender can only transmit up to the minimum of cwnd and rwnd.
- Slow Start: The connection starts with a very small
cwnd(e.g., 1 MSS). For every ACK received,cwnddoubles. The window grows exponentially until it reaches a threshold (ssthresh). - Congestion Avoidance: Once
ssthreshis reached, the growth slows down.cwndonly increases by 1 MSS per RTT (Additive Increase). - Congestion Detection:
• 3 Duplicate ACKs (Fast Retransmit): Implies mild congestion.ssthreshis halved, andcwndis halved.
• Timeout: Implies severe congestion (packet totally lost).ssthreshis halved, andcwnddrops all the way back to 1 MSS (Multiplicative Decrease).
Leaky Bucket Algorithm
The Leaky Bucket algorithm is a traffic shaping mechanism used to convert bursty, erratic traffic into a smooth, steady stream of packets.
Mechanism:
- Imagine a bucket with a hole at the bottom. Water (packets) pours into the top in bursts.
- No matter how fast water pours in, it leaks out of the bottom hole at a constant, fixed rate.
- If water pours in so fast that the bucket fills up entirely, any extra water spills over and is lost (packets are dropped).
Use Case: Ideal for applications that require a strict, constant bandwidth without fluctuations, like Voice over IP (VoIP) or Live Video Streaming.
Token Bucket Algorithm
The Token Bucket algorithm is another traffic shaping mechanism, but unlike the Leaky Bucket, it allows for temporary bursts of data.
Mechanism:
- A bucket holds "Tokens" instead of packets. Tokens are generated and added to the bucket at a constant rate.
- To transmit a packet, the sender must grab and destroy one token from the bucket.
- If the bucket is empty, the sender must wait for a new token to be generated.
- If the sender has been idle, tokens accumulate in the bucket (up to its maximum capacity). When the sender suddenly needs to transmit a massive burst of data, it can use all the accumulated tokens at once to send the burst at maximum line speed.
Use Case: Standard internet traffic (web browsing, file downloads) which is naturally bursty.
Domain Name System (DNS)
DNS is the "phonebook of the Internet". It translates human-readable domain names (like www.google.com) into machine-readable IP addresses (like 142.250.190.46).
Hierarchy
- Root Servers (.): The top of the tree. They know where all the TLD servers are.
- TLD Servers (.com, .org): Top-Level Domain servers know where the Authoritative servers for specific domains are located.
- Authoritative Servers (google.com): The final servers that actually hold the exact IP address records for a specific domain.
Resolution Process
When you type a URL, your browser asks a Recursive Resolver (usually provided by your ISP). If the IP isn't cached, the resolver asks the Root Server → then the TLD Server → then the Authoritative Server, finally returning the IP to your browser.
HTTP vs HTTPS
| Feature | HTTP (Hypertext Transfer Protocol) | HTTPS (HTTP Secure) |
|---|---|---|
| Security | Data is transmitted in plain text. Anyone intercepting the traffic can read it (passwords, credit cards). | Data is heavily encrypted using SSL/TLS before transmission. |
| Port Number | Uses TCP Port 80. | Uses TCP Port 443. |
| Authentication | No authentication. You don't know if the server is really who it claims to be. | Uses Digital Certificates issued by a Certificate Authority (CA) to prove the server's identity. |
File Transfer Protocol (FTP)
FTP is an application layer protocol used to transfer files between a client and a server. Uniquely, FTP requires two separate TCP connections to function:
- Control Connection (Port 21): This connection is established first and stays open for the entire session. It is used exclusively to send commands (like
LIST,RETR,QUIT) and receive server replies. No files are sent over this connection. - Data Connection (Port 20): This connection is opened dynamically only when a file transfer or directory listing is requested. The actual file bytes are transferred here. Once the specific file finishes transferring, this data connection is immediately closed.
Email Protocols
Sending and receiving emails involves distinct protocols:
- SMTP (Simple Mail Transfer Protocol - Port 25/587): Used exclusively for sending (pushing) emails. It pushes the email from the sender's client to the sender's mail server, and then from the sender's mail server to the recipient's mail server.
- POP3 (Post Office Protocol v3 - Port 110): Used for receiving (pulling) emails. It connects to the mail server, downloads all the emails to the local device, and then usually deletes them from the server. Not ideal for multiple devices.
- IMAP (Internet Message Access Protocol - Port 143): A modern receiving protocol. It syncs the local client with the mail server. Emails remain stored on the server. If you read or delete an email on your phone, it syncs and shows as read/deleted on your laptop.
Network Devices
- Hub (Layer 1): A dumb device that connects multiple computers. When it receives a packet on one port, it blindly broadcasts it to all other ports. High collision rate.
- Bridge (Layer 2): Connects two LAN segments. It learns MAC addresses and filters traffic, only forwarding frames across the bridge if the destination MAC is on the other side.
- Switch (Layer 2): A multi-port bridge. It maintains a MAC address table. When a frame arrives, the switch intelligently forwards it only to the specific port where the destination MAC lives. Eliminates collisions.
- Router (Layer 3): Connects different logical networks (e.g., your home LAN to the ISP's network). Uses IP addresses to determine the best path to forward packets globally.
- Gateway (All Layers): A device that translates between entirely different network architectures and protocols (e.g., connecting a TCP/IP network to an old IPX/SPX network).
IPv6 Header and Benefits over IPv4
IPv6 was developed to solve the IPv4 address exhaustion problem by expanding the address space from 32 bits to 128 bits.
Benefits of IPv6:
- Massive Address Space: \(2^{128}\) addresses, enough for every grain of sand on Earth to have an IP.
- Simpler Header: The IPv6 header has a fixed length of 40 bytes. Several optional IPv4 fields (like Fragmentation and Checksum) were removed or moved to Extension Headers, making routing much faster.
- No NAT Required: Because there are so many public IPs, every device can have a globally unique public IP, restoring true end-to-end connectivity without NAT.
- Built-in Security: IPSec (which is optional in IPv4) is fully integrated into the IPv6 protocol standard.
Wireless LAN (IEEE 802.11) Architecture
The IEEE 802.11 standard defines the architecture for Wi-Fi networks.
- BSS (Basic Service Set): The fundamental building block. It consists of a group of wireless stations and one central Access Point (AP). All communication goes through the AP.
- IBSS (Independent BSS / Ad-Hoc): A network with no AP. Stations communicate directly with each other (peer-to-peer).
- ESS (Extended Service Set): Created by connecting multiple BSSs together using a Distribution System (usually a wired Ethernet backbone). This allows users to roam from one AP's coverage area to another without dropping their connection (like Wi-Fi in a large university).
Bluetooth Architecture: Piconet & Scatternet
Bluetooth (IEEE 802.15.1) is a short-range wireless Personal Area Network (PAN) technology.
- Piconet: The basic Bluetooth network. It consists of exactly one Master node and up to 7 active Slave nodes. The Master controls the clock and frequency hopping sequence. Slaves can only communicate with the Master, not directly with each other.
- Scatternet: Formed when two or more Piconets overlap. A node can act as a Slave in one Piconet and a Master in another, effectively bridging the two Piconets together.
Network Address Translation (NAT) & PAT
NAT is used by routers to translate Private, non-routable IP addresses (like 192.168.1.5) into a single Public, routable IP address (like 8.8.8.8) before sending traffic out to the Internet.
Types:
- Static/Dynamic NAT: Translates 1 private IP to 1 public IP. Does not conserve addresses, mostly used to hide internal server IPs.
- PAT (Port Address Translation / NAT Overload): This is what home routers use. It maps multiple private IP addresses to a single public IP address. It distinguishes different internal devices by assigning them unique TCP/UDP Port Numbers in the router's NAT table.
Symmetric vs Asymmetric Cryptography
| Feature | Symmetric (Secret Key) | Asymmetric (Public Key) |
|---|---|---|
| Keys Used | Uses the exact same key for both encryption and decryption. | Uses a pair of keys: a Public Key (to encrypt) and a Private Key (to decrypt). |
| Speed | Extremely fast. Excellent for bulk data transfer. | Very slow (computationally heavy math). |
| Key Distribution Problem | Major issue. Sender and receiver must securely exchange the secret key beforehand. | Solved. The Public Key is shared openly with everyone. Only the Private Key is kept secret. |
| Examples | AES, DES, 3DES | RSA, ECC, Diffie-Hellman |
RSA Public Key Algorithm
RSA is the most widely used asymmetric encryption algorithm, based on the mathematical difficulty of factoring the product of two massive prime numbers.
Key Generation Steps:
- Choose two large distinct prime numbers, \(p\) and \(q\).
- Compute \(n = p \times q\). (\(n\) is the modulus for both keys).
- Compute Euler's totient function: \(\phi(n) = (p-1) \times (q-1)\).
- Choose an integer \(e\) such that \(1 < e < \phi(n)\), and \(e\) is coprime with \(\phi(n)\).
- Compute \(d\) such that \((d \times e) \pmod{\phi(n)} = 1\). (\(d\) is the modular multiplicative inverse of \(e\)).
Keys: Public Key is \((e, n)\). Private Key is \((d, n)\).
Encryption: \(Cipher = Message^e \pmod{n}\)
Decryption: \(Message = Cipher^d \pmod{n}\)
Firewall Types
A firewall is a network security device that monitors and filters incoming and outgoing traffic based on security rules.
- Packet Filter (Stateless): Operates at Layer 3 (Network). It examines every individual packet in isolation and checks its IP address and Port number against a strict access control list (ACL). Fast, but easily bypassed.
- Stateful Inspection: Operates at Layer 4 (Transport). It remembers the "state" of active TCP connections. It knows if an incoming packet is a legitimate response to an outgoing request you just made, blocking unsolicited incoming traffic.
- Proxy (Application-Level Gateway): Operates at Layer 7 (Application). It acts as an intermediary. The client connects to the proxy, and the proxy connects to the outside world on behalf of the client. Highly secure, capable of deeply inspecting HTTP/FTP traffic for viruses, but very slow.
Quality of Service (QoS)
QoS refers to any technology that manages data traffic to reduce packet loss, latency, and jitter on a network. It prioritizes specific types of traffic (like VoIP) over less critical traffic (like file downloads).
Parameters:
- Bandwidth: The maximum rate of data transfer.
- Delay (Latency): The time it takes a packet to travel from source to destination.
- Jitter: The variation in packet delay. High jitter causes audio/video to stutter.
- Packet Loss: The percentage of packets that fail to reach their destination.
Techniques:
Traffic Shaping (Leaky Bucket), Scheduling (Priority Queuing where voice traffic goes first), and Resource Reservation.
Socket Programming Concepts
Socket programming allows two applications on different computers to communicate across a network.
- IP Address: Identifies the specific computer/server on the global network.
- Port Number: Identifies the specific application/process running on that computer (e.g., Port 80 for the web server, Port 22 for SSH).
- Socket: One endpoint of a two-way communication link. A socket is fundamentally defined by the combination of an IP Address and a Port Number (e.g.,
192.168.1.5:80). - Socket API (Berkeley Sockets): Provides functions for developers to use:
•socket(): Creates a new socket.
•bind(): Associates the socket with a specific local IP and port.
•listen()&accept(): Server waits for incoming client connections.
•connect(): Client initiates a connection to a server.
•send()&recv(): Transmit data.
Press ← and → to move between groups