Computer NetworksComputer Networksbeginner

Computer Networks Interview Questions

25 CN questions for campus rounds and vivas: OSI vs TCP/IP, IP addressing, subnet masks, DNS, DHCP, the TCP handshake, ports and HTTP, each with a short answer.

Published
TL;DR – Quick Answer

Computer networks interviews for freshers cover the OSI and TCP/IP models, devices such as switches and routers, IP and MAC addresses, subnetting, DNS, TCP vs UDP, common ports and HTTP basics. Learn the layers with one protocol example each, and be able to explain what happens when you open a website.

On This Page

Computer networks interview questions for freshers start with the OSI model and end with what happens when you open a website. In between come IP addresses, DNS, TCP vs UDP and HTTP. This page has 25 CN questions with short answers that you can say in an interview or write in a viva.

How to answer networking questions

Attach every concept to one real example. "DNS turns a name into an IP address. When I open example.com, my laptop first asks a DNS server for its address."

When a question is about layers, name the layer, its job and one protocol or device. That three-part answer is easy to follow.

Pro tip: Run ping, nslookup and tracert (or traceroute) once before your interview. Seeing real output makes these answers stick.

Networking basics questions

Q1. What is a computer network, and what are its types?

30-second answer: A computer network is a group of devices connected to share data and resources. Types are usually grouped by area.

Type Area Example
PAN A few metres Phone to Bluetooth earphones
LAN A room, building or campus College computer lab
MAN A city Cable network across a city
WAN Countries or the world The internet

Q2. What are network topologies?

30-second answer: Topology is the layout of connections. Common ones are bus, star, ring, mesh, tree and hybrid. Star is the most common in offices: every device connects to a central switch, so one broken cable affects only one device. But if the switch fails, the whole star goes down.

Q3. What is the difference between a hub, a switch and a router?

Device Works at What it does
Hub Physical layer Sends incoming data to every port
Switch Data link layer Sends frames only to the port with the right MAC address
Router Network layer Moves packets between different networks using IP addresses

30-second answer: A hub repeats everything, a switch delivers inside a LAN, and a router connects networks, such as your home LAN and your internet provider.

OSI and TCP/IP model questions

Q4. What is the OSI model? Explain its seven layers.

30-second answer: The OSI model is a reference model that splits network communication into seven layers, each with one job.

No. Layer Job Example
7 Application Services for user programs HTTP, FTP, SMTP, DNS
6 Presentation Format, encryption, compression TLS encryption, JPEG
5 Session Start, manage and end sessions Session checkpoints
4 Transport End-to-end delivery, ports TCP, UDP
3 Network Logical addressing and routing IP, router
2 Data link Frames, MAC addressing Ethernet, switch
1 Physical Bits on the wire or air Cables, Wi-Fi signals

Data goes down the layers at the sender and up the layers at the receiver. Each layer adds its own header on the way down.

Q5. What is the TCP/IP model, and how is it different from OSI?

30-second answer: The TCP/IP model is the practical model the internet uses. It usually has four layers: application, transport, internet and network access (link).

TCP/IP layer Matching OSI layers
Application Application, presentation, session
Transport Transport
Internet Network
Network access Data link, physical

OSI is a teaching and reference model. TCP/IP grew from real protocols. Some books show TCP/IP with five layers by splitting the bottom layer into data link and physical.

Q6. What is encapsulation in networking?

30-second answer: Encapsulation means each layer wraps the data from the layer above with its own header. Application data becomes a TCP segment, then an IP packet, then an Ethernet frame, then bits. The receiver removes the headers in reverse order.

IP addressing questions

Q7. What is the difference between a MAC address and an IP address?

Point MAC address IP address
Layer Data link Network
Size 48 bits 32 bits (IPv4) or 128 bits (IPv6)
Assigned by Set on the network card by the maker (can be changed in software) Network admin or DHCP
Scope Local network Across networks
Example 00:1A:2B:3C:4D:5E 192.168.1.10

30-second answer: The MAC address identifies a network card on the local network. The IP address identifies a device's position on a network so data can be routed to it.

Q8. What is the difference between IPv4 and IPv6?

30-second answer: IPv4 uses 32-bit addresses written as four decimal numbers, such as 192.168.1.10. IPv6 uses 128-bit addresses written in hexadecimal groups, such as 2001:db8::1. IPv6 was created because IPv4 addresses were running out.

Q9. What are private IP addresses?

30-second answer: Private addresses are used inside local networks and are not routed on the public internet. The IPv4 private ranges are:

Range Block
10.0.0.0 to 10.255.255.255 10.0.0.0/8
172.16.0.0 to 172.31.255.255 172.16.0.0/12
192.168.0.0 to 192.168.255.255 192.168.0.0/16

Your home Wi-Fi usually gives devices addresses such as 192.168.1.x.

Q10. What is a subnet mask?

30-second answer: A subnet mask splits an IP address into a network part and a host part. 255.255.255.0, written as /24, means the first 24 bits are the network.

A /24 network has 256 addresses. Two are reserved, one for the network address and one for the broadcast address, so 254 can be given to hosts. The general formula is 2 to the power of host bits, minus 2.

Q11. What is NAT?

30-second answer: Network Address Translation lets many devices with private IP addresses share one public IP address. The router replaces the private source address with its public address on the way out and reverses it for replies. This is why every phone on your home Wi-Fi can use the internet through one connection.

Core protocol questions

Q12. What is DNS, and how does it work?

30-second answer: DNS (Domain Name System) translates domain names such as example.com into IP addresses. Your device first checks its cache. If the answer is not there, it asks a DNS resolver, which may ask a root server, then a top-level domain server such as the one for .com, and finally the domain's authoritative server. The answer is cached for a set time.

nslookup example.com

This command shows the IP address your resolver returns. DNS mostly uses port 53.

Q13. What is DHCP?

30-second answer: DHCP (Dynamic Host Configuration Protocol) gives a device an IP address, subnet mask, default gateway and DNS server automatically when it joins a network. The four steps are Discover, Offer, Request and Acknowledge, often remembered as DORA.

Q14. What is ARP?

30-second answer: ARP (Address Resolution Protocol) finds the MAC address for a known IPv4 address on the local network. A device broadcasts "who has 192.168.1.1?", and the owner replies with its MAC address. IPv6 uses Neighbor Discovery for the same job.

Q15. What is the difference between TCP and UDP?

Point TCP UDP
Connection Connection-oriented Connectionless
Reliability Retransmits lost data, keeps order No guarantee of delivery or order
Speed More overhead Less overhead
Used for Web pages, email, file transfer Video calls, online games, DNS queries

30-second answer: TCP is reliable and ordered. UDP is lighter and faster but does not promise delivery. Read TCP vs UDP for more examples.

Q16. Explain the TCP three-way handshake.

30-second answer: TCP sets up a connection in three steps before sending data.

Client  --- SYN --->      Server
Client  <-- SYN-ACK ---   Server
Client  --- ACK --->      Server

The client sends SYN, the server replies with SYN-ACK, and the client confirms with ACK. Both sides now agree on starting sequence numbers. Closing a connection normally uses FIN and ACK messages from both sides.

Q17. What are port numbers? Name some common ones.

30-second answer: A port number identifies a specific service or program on a device. The IP address finds the device, and the port finds the program.

Port Service
20, 21 FTP
22 SSH
23 Telnet
25 SMTP
53 DNS
80 HTTP
443 HTTPS

Q18. What are ping and traceroute?

30-second answer: ping checks whether a host can be reached and shows the round-trip time. traceroute (tracert on Windows) shows the routers a packet passes through on the way. Both commonly use ICMP messages, although some traceroute tools use UDP or TCP probes.

HTTP and web questions

Q19. What is the difference between HTTP and HTTPS?

30-second answer: HTTP sends data as plain text, usually on port 80. HTTPS is HTTP over TLS, usually on port 443. TLS encrypts the data, checks the server's identity with a certificate and detects tampering. Login and payment pages must use HTTPS.

Q20. What are the common HTTP methods?

Method Use
GET Read data
POST Create data or submit a form
PUT Replace a resource
PATCH Change part of a resource
DELETE Remove a resource

30-second answer: GET reads and should not change data. POST sends data in the request body. See GET vs POST for the full difference.

Q21. What do HTTP status code classes mean?

Class Meaning Example
1xx Informational 101 Switching Protocols
2xx Success 200 OK, 201 Created
3xx Redirection 301 Moved Permanently
4xx Client error 400 Bad Request, 404 Not Found
5xx Server error 500 Internal Server Error

30-second answer: 2xx means it worked, 4xx means the request was wrong, and 5xx means the server failed. Testers check these codes in API testing interview questions.

Q22. What happens when you type a URL in the browser and press Enter?

30-second answer:

  1. The browser reads the URL and finds the domain name.
  2. DNS turns the domain into an IP address, using a cache if possible.
  3. The browser opens a TCP connection to the server, usually on port 443.
  4. For HTTPS, a TLS handshake sets up encryption.
  5. The browser sends an HTTP GET request.
  6. The server sends back a response with a status code and HTML.
  7. The browser renders the page and requests CSS, JavaScript and images.

This one question checks DNS, TCP, TLS and HTTP together, so practise saying it in under a minute.

Other common questions

Q23. What is a firewall?

30-second answer: A firewall allows or blocks network traffic based on rules, such as IP address, port and protocol. It can be hardware, software on a device, or a cloud service. For example, a server firewall may allow only ports 22 and 443 from outside.

Q24. What is the difference between bandwidth and latency?

30-second answer: Bandwidth is how much data can be sent per second, such as 100 Mbps. Latency is how long data takes to travel, usually measured in milliseconds. A video download needs bandwidth. A video call or online game also needs low latency.

Q25. What are unicast, broadcast and multicast?

30-second answer: Unicast sends data from one sender to one receiver. Broadcast sends it to every device on the local network, as ARP requests do. Multicast sends it to a chosen group of devices that joined that group. IPv6 has no broadcast and uses multicast instead.

Quick revision table

Topic One line to remember
OSI Seven layers, Physical to Application
TCP/IP Four layers used by the internet
Switch vs router Inside a LAN vs between networks
/24 254 usable host addresses
DNS Name to IP, port 53
TCP Reliable, handshake first
UDP Fast, no delivery promise
HTTPS HTTP plus TLS, port 443

How to prepare for CN questions

Learn the OSI table until you can draw it from memory. Then practise the "type a URL" answer aloud and run the commands from the tips above. Solve two subnet questions by hand.

Next, revise the other core subjects with operating system interview questions. If you are aiming for web or API roles, read what is a REST API, because HTTP methods and status codes come up again there.

Frequently Asked Questions

Which computer networks topics are asked most in fresher interviews?
The OSI model, OSI vs TCP/IP, TCP vs UDP, the three-way handshake, IP addressing and subnet masks, DNS, common port numbers and what happens when you type a URL. These cover most viva and technical round questions.
Do I need to memorise all port numbers?
No. Know the common ones: 20 and 21 for FTP, 22 for SSH, 23 for Telnet, 25 for SMTP, 53 for DNS, 80 for HTTP and 443 for HTTPS. That list is enough for most fresher interviews.
How do I remember the seven OSI layers?
Use a memory phrase from bottom to top, such as 'Please Do Not Throw Sausage Pizza Away' for Physical, Data link, Network, Transport, Session, Presentation and Application. Then attach one protocol or device to each layer.
Are networking questions asked for software developer roles?
Yes, especially in campus rounds. Web developers also use HTTP methods, status codes, DNS and HTTPS daily, so those topics often come up again in later rounds.
How can I practise networking without lab equipment?
Use the commands already on your laptop: ping, tracert or traceroute, nslookup and ipconfig or ip addr. Your browser's developer tools also show every HTTP request, its method, status code and headers.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 4 December 2026 LinkedIn
Chat with us