How networking is asked in technical interviews
Networking questions in fresher interviews start with layers and protocols and quickly move to cause and effect: why TCP needs a handshake, why DNS uses UDP for most queries, what breaks if the subnet mask is wrong. Product and cloud roles push into HTTP, TLS and load balancing. Support and infrastructure roles ask more about IP addressing, DHCP and troubleshooting with ping and traceroute.
Network models and basics: 10 questions
What are the seven layers of the OSI model?
From the bottom: physical, data link, network, transport, session, presentation and application. Physical moves bits, data link moves frames between neighbours, network routes packets between networks, transport gives end-to-end delivery, session manages conversations, presentation handles formats and encryption, and application is what programs use.
How does the TCP/IP model map to OSI?
TCP/IP has four layers: link, which covers OSI physical and data link; internet, which matches the network layer with IP; transport, with TCP and UDP; and application, which folds in OSI session, presentation and application. The internet runs on TCP/IP; OSI is mainly a teaching and reference model.
What is encapsulation?
As data goes down the stack, each layer adds its own header. Application data gets a TCP or UDP header to form a segment or datagram, then an IP header to form a packet, then an Ethernet header and trailer to form a frame. The receiver strips the headers in reverse order.
What is the difference between a hub, a switch and a router?
A hub is a physical-layer device that repeats every signal to all ports. A switch works at the data link layer and forwards frames only to the port where the destination MAC address lives. A router works at the network layer and forwards packets between different networks using IP addresses.
What are collision and broadcast domains?
A collision domain is the part of a network where simultaneous transmissions collide; every switch port is its own collision domain, while a hub's ports all share one. A broadcast domain is the set of devices that receive a broadcast; a switch keeps one broadcast domain per VLAN, and a router separates them.
What are the common network topologies?
Bus, where all devices share one cable; star, where every device connects to a central switch, which is the norm for office LANs; ring; mesh, where devices have multiple paths for redundancy; and hybrid combinations. Star is easy to manage, but the central device is a single point of failure.
What is the difference between LAN, MAN and WAN?
A LAN covers a small area such as a home, office or campus, with high speed and private ownership. A MAN covers a city, such as a cable operator's network. A WAN spans countries, like the links that connect a company's offices in Bengaluru and Pune, or the internet itself.
What is the difference between bandwidth, throughput and latency?
Bandwidth is the maximum data rate a link can carry. Throughput is the rate actually achieved, which is lower because of overhead, congestion and loss. Latency is the time a bit takes to travel from sender to receiver. A high-bandwidth satellite link can still feel slow because of high latency.
What are unicast, multicast, broadcast and anycast?
Unicast sends to one host. Broadcast sends to every host on the local network, as ARP requests do. Multicast sends to a group of interested hosts, as in IPTV. Anycast sends to the nearest of several hosts sharing one address, which is how many public DNS services serve users from nearby servers.
What is a socket?
A socket is an endpoint for communication, identified by an IP address, a port and a protocol. A TCP connection is identified by the pair of sockets at both ends. Programs use the socket API to listen, connect, send and receive.
Physical and data link layers: 8 questions
What is a MAC address?
A MAC address is a 48-bit hardware address assigned to a network interface, written as six pairs of hexadecimal digits. The first half usually identifies the manufacturer. It is used for delivery within a local network, while IP addresses are used to route between networks.
What does ARP do?
ARP finds the MAC address for a known IPv4 address on the local network. A host broadcasts who has 192.168.1.1, and the owner replies with its MAC address, which the host caches. IPv6 does the same job with Neighbor Discovery instead of ARP.
How does a switch learn where to send frames?
When a frame arrives, the switch records the source MAC address against the incoming port in its MAC table. To forward, it looks up the destination MAC; if it is known, the frame goes only to that port, and if not, the switch floods it to all ports in the VLAN except the incoming one.
What is a VLAN?
A VLAN splits one physical switch into several logical networks, each its own broadcast domain. An office can put finance, engineering and guest Wi-Fi on separate VLANs for security and less broadcast traffic. Traffic between VLANs must go through a router or a layer 3 switch.
What is the difference between CSMA/CD and CSMA/CA?
Both listen before sending. CSMA/CD, used in classic shared Ethernet, detects collisions while sending and retries after a random back-off. CSMA/CA, used in Wi-Fi, tries to avoid collisions in the first place with random waits and acknowledgements, because a wireless radio cannot easily detect a collision while transmitting.
How are transmission errors detected?
Parity bits catch single-bit errors. Checksums, used in IP, TCP and UDP headers, add up data words. Cyclic redundancy checks, used in Ethernet frames, divide the data by a generator polynomial and catch burst errors very reliably. Detection triggers a retransmission; correction needs codes such as Hamming codes.
What are stop-and-wait, Go-Back-N and Selective Repeat?
Stop-and-wait sends one frame and waits for its acknowledgement, which wastes long links. Go-Back-N sends a window of frames and, on an error, resends that frame and everything after it. Selective Repeat resends only the lost frames, at the cost of buffering out-of-order frames at the receiver.
What is the difference between half-duplex and full-duplex?
In half-duplex, both sides can transmit but not at the same time, like a walkie-talkie. In full-duplex, both can transmit simultaneously, like a phone call. Modern switched Ethernet links are full-duplex, which is why collisions no longer happen on them.
IP addressing, subnetting and routing: 13 questions
What is the difference between IPv4 and IPv6?
IPv4 uses 32-bit addresses, about 4.3 billion, which have run short; NAT stretches them. IPv6 uses 128-bit addresses, written in hexadecimal groups, which removes the shortage. IPv6 also simplifies the header, drops broadcast in favour of multicast, and supports automatic address configuration.
What are the private IPv4 address ranges?
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, defined in RFC 1918. They are not routed on the public internet, so homes and offices reuse them freely behind NAT. 127.0.0.0/8 is separately reserved for loopback.
What is a subnet mask and CIDR notation?
A subnet mask marks which bits of an address are the network part. In CIDR notation, /24 means the first 24 bits are the network, the same as 255.255.255.0, leaving 8 bits, or 256 addresses, for hosts. Smaller prefixes mean bigger networks.
Subnet 192.168.10.0/24 into /26 networks. How many subnets and usable hosts per subnet are there?
Moving from /24 to /26 borrows 2 bits, giving 4 subnets. Each has 6 host bits, so 64 addresses, of which 62 are usable after removing the network and broadcast addresses. The subnets start at .0, .64, .128 and .192, and the mask is 255.255.255.192.
For host 192.168.10.70/26, find the network address and the broadcast address.
A /26 block holds 64 addresses, so blocks start at multiples of 64. 70 falls in the block from 64 to 127. The network address is 192.168.10.64, the broadcast address is 192.168.10.127, and usable hosts run from .65 to .126.
How many usable hosts does a /20 network have?
A /20 leaves 32 minus 20, which is 12, host bits. 2 to the power 12 is 4,096 addresses, and subtracting the network and broadcast addresses leaves 4,094 usable hosts. A /30 leaves only 2 usable hosts, which is why it suits point-to-point links.
What is NAT, and what is PAT?
NAT translates private addresses to a public address at the router so internal hosts can reach the internet. PAT, or NAT overload, lets many internal hosts share one public IP by tracking each connection's port number. Most home routers use PAT.
What is the default gateway?
The default gateway is the router a host sends packets to when the destination is outside its own subnet. If my laptop is 192.168.1.20/24 and I open a website, the packet goes to the gateway, often 192.168.1.1, which routes it onward. A wrong gateway means local traffic works but the internet does not.
What is the difference between static and dynamic routing?
Static routes are configured by hand; they are simple and predictable but do not adapt to failures. Dynamic routing protocols let routers share information and recompute paths automatically when links change. Small networks often use a static default route; larger ones use OSPF or BGP.
Distance vector vs link state routing: what is the difference?
In distance vector routing, such as RIP, each router shares its distance table with neighbours and trusts their view; it is simple but converges slowly, and RIP limits paths to 15 hops. In link state routing, such as OSPF, every router learns the full topology and runs Dijkstra's shortest path algorithm, converging faster.
What is BGP?
BGP is the path vector protocol that routes between autonomous systems, the separately managed networks of ISPs and large companies that form the internet. It chooses routes by policy and path attributes rather than just shortest distance. A misconfigured BGP announcement can make large services unreachable.
What is ICMP, and how do ping and traceroute use it?
ICMP carries error and diagnostic messages for IP. Ping sends echo requests and measures replies to test reachability and round-trip time. Traceroute sends packets with increasing TTL values; each router that drops a packet when TTL hits zero sends back a time-exceeded message, revealing the path hop by hop.
What is TTL in an IP packet?
Time to live is a counter that each router decreases by one. When it reaches zero, the packet is discarded and an ICMP message goes back to the sender. It stops packets from looping forever when routing goes wrong. IPv6 calls the same field the hop limit.
TCP, UDP and the transport layer: 10 questions
What is the difference between TCP and UDP?
TCP is connection-oriented and reliable: it orders bytes, retransmits losses, and controls flow and congestion, which suits web pages, email and file transfer. UDP is connectionless with no delivery guarantee but very low overhead, which suits DNS queries, voice and video calls, and online games, where a late packet is useless anyway.
Explain the TCP three-way handshake.
The client sends SYN with its initial sequence number. The server replies with SYN-ACK, acknowledging the client's number and sending its own. The client sends ACK. Both sides now agree on sequence numbers and the connection is established. The handshake costs one round trip before data flows.
How is a TCP connection closed, and what is TIME_WAIT?
Each side closes its direction separately: one sends FIN and gets an ACK, then the other sends FIN and gets an ACK, which is four messages. The side that closes first enters TIME_WAIT for twice the maximum segment lifetime, so delayed packets from the old connection cannot be mistaken for a new one.
What is the difference between flow control and congestion control?
Flow control protects the receiver: it advertises a window saying how much more data it can buffer. Congestion control protects the network: the sender limits its rate based on signs of congestion such as packet loss or delay. TCP sends no more than the smaller of the two windows.
How does TCP congestion control work?
TCP starts with slow start, where the congestion window roughly doubles every round trip until a threshold or loss. It then enters congestion avoidance, growing the window by about one segment per round trip. On loss it cuts the window, which is the additive increase, multiplicative decrease idea. Modern variants such as CUBIC refine the growth curve.
How does TCP guarantee reliable delivery?
Every byte has a sequence number. The receiver sends cumulative acknowledgements, and the sender keeps a retransmission timer for unacknowledged data. Lost segments are resent after a timeout or after three duplicate acknowledgements, which triggers fast retransmit. Checksums catch corrupted segments.
Name common well-known ports.
HTTP uses 80 and HTTPS 443. SSH uses 22, FTP 20 and 21, SMTP 25, and DNS 53 over both UDP and TCP. DHCP uses UDP 67 for the server and 68 for the client. Ports up to 1023 are the well-known range.
Why does DNS mostly use UDP?
A typical query and answer each fit in one small packet, so UDP's single round trip with no handshake is faster. DNS switches to TCP when responses are too large, for zone transfers between servers, and for encrypted transports such as DNS over TLS.
What is a port, and how does the OS deliver a packet to the right application?
A port is a 16-bit number identifying an application endpoint on a host. The OS uses the protocol, destination IP and destination port, and for TCP also the source IP and port, to find the matching socket and hand the data to the program that owns it.
What is QUIC?
QUIC is a transport protocol that runs over UDP and builds in reliability, congestion control and TLS 1.3 encryption. It combines connection set-up and encryption, avoids head-of-line blocking between streams and survives network changes such as moving from Wi-Fi to mobile data. HTTP/3 runs on QUIC.
DNS, HTTP, DHCP and the application layer: 12 questions
How does DNS resolution work?
The browser and OS check their caches. If there is no answer, a recursive resolver, usually from the ISP or a public service, asks a root server, which points to the top-level domain server for .com or .in, which points to the domain's authoritative server, which returns the address. The resolver caches the answer for its TTL.
What are the common DNS record types?
A maps a name to an IPv4 address and AAAA to an IPv6 address. CNAME makes one name an alias of another. MX names the mail servers for a domain. NS names the authoritative name servers. TXT holds text, often used for domain verification and email security policies.
What are the common HTTP methods?
GET retrieves a resource and should not change anything. POST creates or submits data. PUT replaces a resource and PATCH partly updates it. DELETE removes it. GET, PUT and DELETE are meant to be idempotent, so repeating them has the same effect as doing them once; POST is not.
What do HTTP status code classes mean?
1xx is informational, 2xx success such as 200 OK and 201 Created, 3xx redirection such as 301 and 302, 4xx client errors such as 400, 401, 403 and 404, and 5xx server errors such as 500, 502 and 503. 401 means not authenticated and 403 means authenticated but not allowed.
How do HTTP/1.1, HTTP/2 and HTTP/3 differ?
HTTP/1.1 is text-based and handles one request at a time per connection, so browsers open several connections. HTTP/2 is binary and multiplexes many streams over one TCP connection with header compression. HTTP/3 keeps those ideas but runs over QUIC on UDP, so one lost packet does not stall every stream.
What is the difference between HTTP and HTTPS?
HTTPS is HTTP sent inside a TLS-encrypted connection, usually on port 443. TLS gives confidentiality so others cannot read the traffic, integrity so it cannot be changed unnoticed, and authentication through the server's certificate, so you know you reached the real site.
What happens in a TLS handshake, briefly?
The client and server agree on a protocol version and cipher suite, perform a key exchange, typically ephemeral Diffie-Hellman, to derive shared session keys, and the server proves its identity with a certificate signed by a trusted authority. TLS 1.3 completes this in one round trip, after which data is encrypted with fast symmetric keys.
What is the difference between cookies and sessions?
A cookie is a small piece of data the server asks the browser to store and send back with later requests. A session keeps user state on the server, and the browser holds only a session id, usually in a cookie. Sensitive cookies should be marked Secure and HttpOnly.
How does DHCP assign an IP address?
Through four messages, often remembered as DORA. The client broadcasts Discover, a server replies with an Offer, the client broadcasts a Request for that offer, and the server confirms with an Acknowledgement. The lease includes the IP address, subnet mask, default gateway and DNS servers, and expires unless renewed.
Which protocols are used for email?
SMTP sends mail from a client to a server and between servers. IMAP lets a client read mail that stays on the server and syncs across devices. POP3 downloads mail to one device and usually removes it from the server. Webmail uses HTTPS between the browser and the provider.
What is REST?
REST is an architectural style for web APIs in which resources are identified by URLs and manipulated with standard HTTP methods, with each request carrying all the state it needs. For example, GET /students/42 fetches a student and DELETE /students/42 removes one. Responses are usually JSON.
What is the difference between a forward proxy and a reverse proxy?
A forward proxy sits in front of clients and makes requests on their behalf, as in a college network that filters sites. A reverse proxy sits in front of servers and receives requests on their behalf, handling TLS, caching and load balancing. Nginx is often used as a reverse proxy.
Network security: 7 questions
What is the difference between symmetric and asymmetric encryption?
Symmetric encryption uses one shared key for encryption and decryption, as AES does; it is fast but the key must be shared securely. Asymmetric encryption uses a public and private key pair, as RSA and elliptic-curve schemes do; it solves key distribution but is slower. TLS uses asymmetric methods to agree keys, then symmetric encryption for data.
What is a digital certificate?
A certificate binds a public key to an identity such as a domain name, and is signed by a certificate authority that browsers trust. When I visit a bank's site, my browser checks the signature chain, the domain name and the validity dates before trusting the connection.
What is a firewall?
A firewall filters traffic according to rules. A packet filter checks addresses, ports and protocols. A stateful firewall also tracks connections, allowing replies to traffic that went out. Application-level firewalls inspect content such as HTTP requests to block attacks like SQL injection.
What is a DDoS attack, and how is it mitigated?
In a distributed denial-of-service attack, many compromised machines flood a target with traffic or requests until it cannot serve real users. Mitigation includes rate limiting, filtering at the network edge, absorbing traffic with large anycast networks and content delivery networks, and scaling out.
What is a VPN?
A VPN creates an encrypted tunnel between a device and a VPN server or between two networks, so traffic crossing untrusted networks cannot be read or altered. Companies use it to give remote employees access to internal systems as if they were in the office.
What is a man-in-the-middle attack?
An attacker secretly relays and possibly changes traffic between two parties who believe they are talking directly, for example on a fake public Wi-Fi hotspot. TLS with proper certificate checking defeats it, which is why ignoring browser certificate warnings is dangerous.
What is the difference between a layer 4 and a layer 7 load balancer?
A layer 4 load balancer routes connections using IP addresses and ports without reading the content, which is fast and protocol-agnostic. A layer 7 load balancer reads HTTP and can route by path, header or cookie, terminate TLS and apply retries, at a higher processing cost.
The classic: what happens when you type a URL? 4 questions
What happens when you type a URL into a browser and press Enter?
The browser parses the URL and resolves the domain through DNS caches and, if needed, a recursive resolver. It opens a TCP connection to port 443 with the three-way handshake, or QUIC for HTTP/3, and completes a TLS handshake. It sends an HTTP GET request, the server or a CDN responds, and the browser parses the HTML, fetches CSS, scripts and images, and renders the page.
In that flow, where do ARP and the default gateway come in?
Before the first packet leaves, the laptop sees that the server is outside its subnet, so it must send the packet to the default gateway. It uses ARP, or Neighbor Discovery on IPv6, to find the gateway's MAC address and puts that in the Ethernet frame, while the IP header still carries the server's address.
Where can caching shorten that flow?
At many points: the browser's DNS and HTTP caches, the OS resolver cache, the ISP's recursive resolver, a CDN edge server close to the user, and server-side caches. A page that loads instantly on the second visit is usually served largely from the browser's own cache.
A user says a website will not open, but other sites work. How would you troubleshoot?
I would check whether the name resolves with nslookup, whether the server answers with ping or a direct HTTPS request, and where the path stops with traceroute. If DNS fails, I look at the resolver or the domain's records; if the connection fails, at firewalls or the server; if the browser shows a certificate error, at TLS.
What the interviewer, and the AI panel, checks
- Layer discipline: can you place each protocol and device at the right layer and say why?
- Calculations: subnet, host count, network and broadcast addresses, done aloud without panic.
- Cause and effect: what breaks when DNS, the gateway or the mask is wrong.
- End-to-end thinking: the URL walkthrough with DNS, TCP, TLS and HTTP in the right order.
Check your basics on the free computer networks basics test and the drawn placement CS fundamentals test, then explain these answers aloud with the ExamPilot AI interviewer. For lab-level definitions, the computer networks viva questions guide is the short companion.
Two-week networking preparation plan
- 1
Days 1 to 3: models and data link
Learn the OSI and TCP/IP layers with one protocol and one device each. Run ipconfig or ip addr and arp on your own laptop and read the output.
- 2
Days 4 to 7: IP and subnetting
Solve 20 subnetting problems by hand: network, broadcast, host range and host count. Learn the private ranges and what NAT does on your home router.
- 3
Days 8 to 10: TCP and UDP
Draw the handshake and teardown, then explain flow control, congestion control and retransmission in your own words.
- 4
Days 11 to 14: application layer and mock rounds
Trace DNS with nslookup, read HTTP headers in your browser's developer tools, and practise the URL walkthrough aloud until it takes about two minutes.
Frequently asked questions
- What are the most asked computer networks interview questions for freshers?
- The OSI layers, TCP vs UDP, the three-way handshake, IPv4 vs IPv6, subnetting, how DNS works, HTTP vs HTTPS, the difference between a hub, switch and router, and what happens when you type a URL. Expect at least one calculation and one end-to-end explanation.
- How much subnetting do I need for a fresher interview?
- You should be able to convert a CIDR prefix to a mask, count usable hosts, and find the network and broadcast addresses for a given host, as in the worked examples above. Networking and support roles may ask you to split a network into subnets of given sizes.
- How is a networking interview different from a CN viva?
- A viva checks definitions and lab experiments from your syllabus. An interview asks why and what if: why TCP needs a handshake, what happens if the gateway is wrong, how HTTPS protects a login. Use the viva guide for definitions and this page for depth.
- Do software developer roles ask networking questions?
- Yes, usually at a practical level: HTTP methods and status codes, REST, DNS, TCP vs UDP, TLS basics and the URL walkthrough. Backend, cloud and security roles go deeper into load balancing, proxies and congestion control.
- Where can I practise networking questions for free?
- ExamPilot's computer networks basics test and placement CS fundamentals test are free, with explanations after each attempt. For spoken practice, run a fresher technical mock interview with the AI interviewer, which follows up like a real panel.
Practise out loud
Practise a networking technical round
The AI interviewer asks networking and CS fundamentals questions in a fresher technical round, follows up on your answers and flags where you were vague.
Placements · Fresher — IT services
