Okay, let's explore some common Computer Networks interview questions with their answers
and explanations.
1. What is the OSI model? What are its layers?
● Answer: The Open Systems Interconnection (OSI) model is a conceptual framework that
characterizes and standardizes the communication functions of a telecommunication or
computing system without regard to their underlying internal structure and technology. It
divides the communication system into seven distinct layers.
● Layers (from top to bottom):
1. Application: Provides network access to end-user applications (e.g., HTTP, SMTP,
DNS).
2. Presentation: Handles data formatting, encryption, and compression.
3. Session: Manages connections and sessions between applications.
4. Transport: Provides reliable (TCP) or unreliable (UDP) end-to-end data delivery.
5. Network: Handles routing of packets across networks (IP).
6. Data Link: Provides error-free data transfer between adjacent network nodes (e.g.,
Ethernet, Wi-Fi).
7. Physical: Defines the physical medium and the signals used to transmit data.
● Explanation: The OSI model provides a structured way to understand how network
communication occurs. Each layer has specific responsibilities, making it easier to design,
implement, and troubleshoot network systems.
2. What is the TCP/IP model? How does it compare to the OSI model?
● Answer: The TCP/IP model is another conceptual framework for network communication,
widely used in the internet. It has fewer layers than the OSI model.
● Layers (common representation):
1. Application: Combines the Application, Presentation, and Session layers of the
OSI model (e.g., HTTP, SMTP, DNS).
2. Transport: Similar to the OSI Transport layer (TCP, UDP).
3. Internet: Similar to the OSI Network layer (IP).
4. Link/Network Access: Combines the Data Link and Physical layers of the OSI
model (e.g., Ethernet, Wi-Fi).
● Comparison to OSI: The TCP/IP model is more practical and closely reflects the
architecture of the internet. The OSI model is more theoretical and provides a more
detailed breakdown of functionalities. The TCP/IP model collapses some layers,
particularly at the top and bottom.
● Explanation: While the OSI model is a good reference, the TCP/IP model is the one that
governs how the internet and many modern networks operate.
3. What is the difference between TCP and UDP?
● Answer: TCP (Transmission Control Protocol) is a connection-oriented, reliable, ordered,
and error-checked protocol. UDP (User Datagram Protocol) is a connectionless,
unreliable, and unordered protocol.
● Key Differences:
○ Connection: TCP establishes a connection before data transfer (three-way
handshake), while UDP does not.
○ Reliability: TCP guarantees delivery through acknowledgements and
retransmissions, while UDP does not.
○ Ordering: TCP ensures packets arrive in the order they were sent, while UDP does
not.
○ Overhead: TCP has more overhead due to connection establishment,
acknowledgements, etc., making UDP faster for applications where reliability isn't
critical.
● Explanation: The choice between TCP and UDP depends on the application's
requirements. TCP is suitable for applications needing reliable data transfer (e.g., web
browsing, file transfer), while UDP is better for applications where speed is more
important than guaranteed delivery (e.g., streaming, online gaming).
4. What is an IP address? What is the difference between IPv4 and IPv6?
● Answer: An IP (Internet Protocol) address is a numerical label assigned to each device
connected to a computer network that uses the Internet Protocol for communication.
● IPv4 vs. IPv6:
○ Address Size: IPv4 uses 32-bit addresses (approximately 4.3 billion unique
addresses), while IPv6 uses 128-bit addresses (vastly larger address space).
○ Notation: IPv4 addresses are typically written in dotted decimal notation (e.g.,
192.168.1.1), while IPv6 addresses are written in hexadecimal with colons (e.g.,
2001:0db8:85a3:0000:0000:8a2e:0370:7334).
○ Header Format: IPv6 has a simplified header compared to IPv4.
○ Security: IPv6 has built-in support for security features like IPSec.
● Explanation: The primary reason for IPv6 is to overcome the address exhaustion
problem of IPv4. It also offers improvements in terms of addressing, routing, and security.
5. What is a subnet mask? How does it help in networking?
● Answer: A subnet mask is a 32-bit number (in IPv4) that separates the network portion of
an IP address from the host portion. It is used to determine which part of the IP address
identifies the network and which part identifies the specific host within that network.
● How it helps: Subnet masks enable the division of a single network into smaller
subnetworks (subnets). This improves network organization, security, and efficiency by
reducing broadcast traffic within a larger network. Routers use subnet masks to determine
the destination network for a packet.
● Explanation: By using subnet masks, network administrators can logically segment a
network without needing physically separate networks.
6. What is a default gateway? Why is it needed?
● Answer: A default gateway is a router on a network that serves as an access point to
other networks (e.g., the internet). It's the IP address of the device that a host sends
packets to when the destination IP address is outside of its local network.
● Why it's needed: When a host needs to communicate with a device on a different
network, it needs a way to reach that network. The default gateway provides this path.
The host knows that if the destination IP is not on its local subnet, it should forward the
packet to the default gateway router, which then takes responsibility for routing it further.
● Explanation: Without a default gateway configured, a host on a local network would not
be able to communicate with devices on external networks.
7. Explain the process of how a web browser requests and receives a webpage.
● Answer:
1. URL Input: The user enters a URL (e.g., www.example.com) into the browser.
2. DNS Resolution: The browser sends a DNS (Domain Name System) query to a
DNS server to find the IP address associated with the domain name.
3. TCP Connection: Once the IP address is obtained, the browser initiates a TCP
connection with the web server on the standard HTTP (port 80) or HTTPS (port
443) port using a three-way handshake.
4. HTTP Request: The browser sends an HTTP request to the web server, asking for
the specific webpage.
5. HTTP Response: The web server processes the request and sends back an HTTP
response, which includes the HTML content of the webpage and possibly other
resources (CSS, JavaScript, images).
6. Rendering: The browser receives the HTTP response and renders the HTML
content to display the webpage to the user. It might make further requests for
embedded resources.
● Explanation: This process involves multiple layers of the TCP/IP model working together,
from the application layer (HTTP, DNS) down to the transport layer (TCP) and network
layer (IP).
8. What are network topologies? Give some examples.
● Answer: A network topology refers to the way in which network nodes (devices) are
interconnected.
● Examples:
○ Bus: All devices are connected to a single cable (the bus).
○ Star: All devices connect to a central hub or switch.
○ Ring: Each device connects to exactly two other devices, forming a ring.
○ Mesh: Devices are interconnected with many redundant connections.
○ Tree: A hierarchical structure of star networks.
● Explanation: The choice of topology affects factors like cost, ease of installation, fault
tolerance, and performance.
9. What is the difference between a hub, a switch, and a router?
● Answer:
○ Hub: Operates at the Physical layer (Layer 1). It's a simple device that broadcasts
any incoming signal out to all other connected ports.
○ Switch: Operates at the Data Link layer (Layer 2). It learns the MAC addresses of
connected devices and forwards traffic only to the intended destination port.
○ Router: Operates at the Network layer (Layer 3). It routes traffic between different
networks based on IP addresses.
● Explanation: Switches are more efficient than hubs because they reduce collisions and
unnecessary traffic. Routers are essential for communication between different IP
networks.
10. What is a firewall? How does it work?
● Answer: A firewall is a network security system that monitors and controls incoming and
outgoing network traffic based on pre-defined security rules. Its primary purpose is to
establish a barrier between a trusted, secure internal network and an untrusted external
network, such as the internet.
● How it works: Firewalls typically examine network traffic (packets) and compare it
against a set of rules. Based on these rules, they can either allow or block the traffic.
Rules can be based on source and destination IP addresses, port numbers, protocols,
and more.
● Explanation: Firewalls are a crucial component of network security, helping to prevent
unauthorized access and malicious attacks.
These are some fundamental questions in Computer Networks. Would you like to explore more
advanced topics or specific areas within networking?