Network Security Fundamentals, Routing Algorithms, and Placement Interview Prep
These comprehensive study notes cover network security threats, transmission modes, bandwidth vs. throughput, core routing protocols, socket and port architecture, and rapid-fire technical interview questions for computer networking roles.
1. Why Do We Need Network Security and Threat Mitigation?
As data travels across networks, it passes through various routers, switches, and intermediary nodes. Without adequate cryptographic safeguards and access controls, malicious actors can intercept, modify, or forge network traffic. Understanding common attack vectors and defensive mechanisms is critical for designing robust, production-ready distributed systems.
Real-Life Analogy
Real-Life Analogy: Imagine mailing a physical letter through an open postal drop box where an individual can intercept the envelope, steam it open, read your bank statements, and reseal it without your knowledge. In networking, an attacker sitting on your local Wi-Fi router can intercept unencrypted packets traveling across the airwaves.
2. Common Network Security Vulnerabilities
Attackers exploit vulnerabilities in network protocols, human behavior, and web applications. The four primary attack vectors highlighted in network engineering include:
- Man-in-the-Middle (MitM): An attacker positions themselves between a client and server (e.g., on a public Wi-Fi network) to eavesdrop on or alter data packets. Even if traffic is encrypted, compromised trust certificates can enable decryption.
- Phishing: Cybercriminals create fake, convincing replicas of legitimate websites (e.g.,
go-ogl.cominstead ofgoogle.com) to trick users into inputting credentials. - SQL Injection (SQLi): Malicious SQL statements are inserted into input fields (such as login forms) to manipulate backend database queries and extract unauthorized data.
- DNS Spoofing: Attackers forge DNS replies, misleading a client's resolver into mapping domain names to malicious IP addresses.
3. Network Defense and Mitigation Strategies
To combat network-level vulnerabilities, multi-layered defensive controls must be implemented across the application and transport layers:
- Encrypted Connections: Enforce transport-layer security using HTTPS (TLS/SSL) to guarantee data confidentiality and integrity in transit.
- Firewalls: Deploy hardware or software firewalls to monitor and filter incoming and outgoing network traffic based on predetermined security rules.
- Virtual Private Networks (VPNs): Encapsulate and encrypt all client traffic inside a secure tunnel before it traverses public networks.
- Strong Authentication: Implement Multi-Factor Authentication (MFA) and secure One-Time Passwords (OTPs) to prevent unauthorized account access even if credentials are leaked.
4. Bandwidth, Latency, and Throughput
Network performance is quantified using key metrics that dictate data transfer efficiency and user experience:
Note: Video calls suffer heavily when throughput drops or latency fluctuates jitterily, causing noticeable audio and video delays ("lag").
5. Data Transmission Modes: Simplex, Half-Duplex, and Full-Duplex
Communication channels are classified based on the direction and simultaneity of data flow between connected nodes:
- Simplex: Data flows in only one direction. One device is strictly a sender, and the other is strictly a receiver (e.g., a TV broadcast where the viewer cannot talk back to the news anchor).
- Half-Duplex: Data flows in both directions, but not simultaneously. When one device is transmitting, the other must wait (e.g., a walkie-talkie where users must say "Over" before the other person can speak).
- Full-Duplex: Data flows in both directions simultaneously (e.g., a telephone or video conference call where both parties can talk and hear each other at the same time).
6. Routing Protocols Overview
Routing protocols dictate how routers communicate with each other to discover optimal paths across a network internetwork:
- Routing Information Protocol (RIP): Uses the Bellman-Ford algorithm and operates on a Distance Vector approach, counting hops to determine the best path.
- Open Shortest Path First (OSPF): Uses Dijkstra's algorithm and operates on a Link State approach, maintaining a complete topological map of the network.
- Vendor-Specific Protocols: Enterprise networks often utilize proprietary protocols developed by networking giants like Cisco, such as Enhanced Interior Gateway Routing Protocol (EIGRP) and Border Gateway Protocol (BGP) variants, tailored for large-scale autonomous systems.
7. Sockets and Ports Architecture
A socket is the unique combination of an IP address and a port number, establishing an endpoint for communication between two programs running on a network.
For example, a local HTTP server socket can be represented as 127.0.0.1:80.
Port Number Ranges
Ports are 16-bit logical identifiers ( to ) categorized into three distinct ranges:
- 0 to 1023 (Well-Known / Reserved): Reserved for standard system-wide protocols (e.g., Port
80for HTTP,443for HTTPS,53for DNS). - 1024 to 49151 (Registered): Assigned by IANA for specific vendor applications and software services.
- 49152 to 65535 (Dynamic / Private): Temporary ephemeral ports allocated dynamically to client applications by the operating system during outgoing connections.
8. Comprehensive Networking Placement & Interview Prep Q&A
To solidify mastery for technical interviews, review the following rapid-fire conceptual questions and answers:
Q1: What is the primary difference between TCP and UDP?
- TCP (Transmission Control Protocol): Connection-oriented, guarantees delivery, provides error checking, handles flow control, and uses a 3-Way Handshake (SYN, SYN-ACK, ACK). Slower due to overhead.
- UDP (User Datagram Protocol): Connectionless, unreliable, fire-and-forget transmission without handshake verification. Faster, ideal for real-time streaming and gaming.
Q2: Name and explain the 7 layers of the OSI Model.
From top to bottom:
- Application Layer (Layer 7): End-user protocols (HTTP, FTP, SMTP).
- Presentation Layer (Layer 6): Data translation, encryption, and compression.
- Session Layer (Layer 5): Manages session establishment, maintenance, and termination.
- Transport Layer (Layer 4): End-to-end connections, reliability, and port multiplexing (TCP/UDP).
- Network Layer (Layer 3): Logical addressing (IP) and packet routing (Routers).
- Data Link Layer (Layer 2): Physical addressing (MAC) and framing (Switches).
- Physical Layer (Layer 1): Raw bit stream transmission over physical media (cables, hubs).
Q3: What happens step-by-step when you type google.com into your browser?
- Browser checks its local DNS cache; if missing, it queries the configured DNS resolver (ISP or 8.8.8.8).
- DNS resolves the domain name
google.comto its corresponding IP address. - The browser initiates a TCP 3-Way Handshake with the target server IP.
- If using HTTPS, a TLS handshake establishes an encrypted session.
- The browser sends an HTTP
GETrequest. - The server processes the request and returns the HTML/CSS/JS payload, which the browser renders into the visual webpage.
Q4: What is Subnet Masking and Subnetting?
Subnetting divides a large physical IP network into smaller, manageable logical subnetworks. The subnet mask is a 32-bit number that bitwise-masks an IP address, splitting it into a Network ID and a Host ID.
Q5: What is the difference between a Hub, a Switch, and a Router?
- Hub (Layer 1): Broadcasts incoming traffic blindly out of all ports. Inefficient and insecure.
- Switch (Layer 2): Inspects destination MAC addresses and forwards frames only to the specific target port using a MAC table.
- Router (Layer 3): Connects distinct networks together, inspecting IP packets to determine the optimal routed path across different subnets.
Q6: How does DHCP work?
DHCP (Dynamic Host Configuration Protocol) assigns IP configurations automatically using the DORA process:
- Discover: Client broadcasts a request for an IP.
- Offer: DHCP server offers an available IP address.
- Request: Client formally requests the offered IP.
- Acknowledgment: Server confirms lease assignment.
Q7: What is NAT (Network Address Translation)?
NAT maps private internal IP addresses to a single public IP address at the gateway router, conserving IPv4 address space and providing basic firewall concealment.
Q8: What is the difference between IPv4 and IPv6?
- IPv4: 32-bit address space supporting billion addresses, uses dotted-decimal notation (
192.168.1.1). - IPv6: 128-bit address space supporting virtually infinite addresses (), uses hexadecimal notation separated by colons (
2001:db8::1).
Q9: What is ARP (Address Resolution Protocol)?
ARP resolves a known Layer 3 IP address into its corresponding Layer 2 MAC address on a local network segment.
Q10: What is a Loopback Address?
The loopback IP address (127.0.0.1 or localhost) routes network traffic back to the local machine, allowing developers to test network applications internally without hitting an external network interface.
Summary and Key Takeaways
- Security Threat Vectors: Protect web infrastructure against MitM eavesdropping, phishing domain spoofing, and SQL injection using HTTPS, firewalls, VPNs, and multi-factor authentication.
- Performance Metrics: Distinguish between Bandwidth (maximum capacity), Latency (time delay), and Throughput (actual delivered data).
- Transmission Modes: Simplex transmits in one direction, half-duplex alternates directions, and full-duplex allows simultaneous bidirectional communication.
- Routing Protocols: RIP relies on Distance Vector and Bellman-Ford, while OSPF relies on Link State and Dijkstra's shortest path algorithm.
- Sockets & Ports: A socket combines an IP address and a port. Ports range from well-known () to registered and dynamic ephemeral ranges.
- OSI Layers: Master the 7 OSI layers from physical transmission (Layer 1) to application software interfaces (Layer 7).
- Core Networking Flow: Typing a URL triggers DNS resolution, TCP handshaking, routing via MAC/IP framing, and HTTP response rendering.
- Hardware Hierarchy: Hubs broadcast indiscriminately (Layer 1), switches filter by MAC addresses (Layer 2), and routers route across subnets using IP addresses (Layer 3).