Computer networks interview questions
OSI and TCP/IP models, TCP versus UDP, IP, DNS, HTTP and network devices.
1. What are the seven layers of the OSI model?
Physical, Data Link, Network, Transport, Session, Presentation and Application. For example, cables and signals work at the physical layer, switches and MAC addresses at the data link layer, routers and IP at the network layer, and TCP/UDP at the transport layer. The TCP/IP model combines them into four layers.
Asked in: Infosys
2. What is the difference between TCP and UDP?
TCP is connection-oriented and reliable: it uses a three-way handshake, keeps order and resends lost data (used for web, email, file transfer). UDP is connectionless and faster with no guarantee of delivery or order (used for video calls, streaming, gaming and DNS).
Asked in: LTIMindtree
3. What is the TCP three-way handshake?
The client sends SYN, the server replies SYN-ACK, and the client sends ACK. After that the connection is open and data can flow.
4. What is an IP address? IPv4 versus IPv6?
A numeric address that identifies a device on a network. IPv4 is 32 bits written as four numbers (192.168.1.10), about 4.3 billion addresses. IPv6 is 128 bits written in hexadecimal groups, giving vastly more addresses.
5. What is the difference between a MAC address and an IP address?
A MAC address is a fixed 48-bit hardware address of a network card, used inside a local network (data link layer). An IP address is a logical address that can change and is used to route data between networks (network layer).
6. What is DNS?
The Domain Name System translates names like ouallinone.com into IP addresses so browsers can connect. It works like a phone book, with caching at several levels to make lookups fast.
7. What is the difference between HTTP and HTTPS?
HTTP sends data as plain text (port 80). HTTPS encrypts it with TLS (port 443), so passwords and payments cannot be read or changed in transit, and it verifies the website with a certificate.
8. What is the difference between a hub, a switch and a router?
A hub sends incoming data to every port. A switch learns MAC addresses and sends data only to the right device in a local network. A router connects different networks and forwards packets using IP addresses, such as your home network to the internet.
9. What happens when you type a URL into a browser?
The browser finds the IP address with DNS, opens a TCP connection (and a TLS handshake for HTTPS), sends an HTTP request, the server responds with HTML, and the browser downloads the CSS, JavaScript and images it needs and renders the page.
10. What is DHCP?
A protocol that automatically gives a device an IP address, subnet mask, gateway and DNS server when it joins a network, so you do not configure them by hand.
11. What is subnetting?
Dividing a network into smaller networks using a subnet mask (for example /24 = 255.255.255.0). It improves organisation and security and reduces broadcast traffic.
12. What is a firewall?
Hardware or software that filters network traffic by rules (allowed ports, addresses, protocols) to block unauthorised access while letting normal traffic through.