# Computer Network Interview Questions
## What is a Computer Network
A computer network is a collection of devices such as computers, servers, printers, and routers that are connected together to share resources and communicate with each other. Networks can be wired or wireless. They allow users to share files, printers, internet connections, and applications.
## What is the difference between LAN, MAN, and WAN
LAN stands for Local Area Network and covers a small area like a building or office. MAN stands for Metropolitan Area Network and covers a city. WAN stands for Wide Area Network and covers a large geographic area like a country or the entire world. The internet is the largest WAN.
## What are the layers of the OSI model
The OSI model has seven layers. Layer 1 is the Physical layer which handles raw bit transmission. Layer 2 is the Data Link layer which handles framing and MAC addresses. Layer 3 is the Network layer which handles IP addressing and routing. Layer 4 is the Transport layer which handles TCP and UDP. Layer 5 is the Session layer which manages sessions. Layer 6 is the Presentation layer which handles encryption and formatting. Layer 7 is the Application layer which handles HTTP, FTP, DNS and other application protocols.
## What is the difference between TCP and UDP
TCP is connection-oriented and provides reliable, ordered delivery. It uses a three-way handshake to establish a connection and acknowledges every segment received. UDP is connectionless and does not guarantee delivery or ordering. UDP is faster because it has less overhead. TCP is used for web browsing, email, and file transfer. UDP is used for DNS, video streaming, and online gaming.
## What is an IP address and what are its types
An IP address is a unique numerical label assigned to every device on a network. IPv4 is a 32-bit address written as four octets separated by dots such as 192.168.1.1. IPv6 is a 128-bit address written in hexadecimal. IP addresses can be public or private, and static or dynamic.
## What is subnetting
Subnetting is the process of dividing a large network into smaller subnetworks called subnets. It is done by borrowing bits from the host portion of the IP address. Subnetting reduces broadcast traffic, improves security, and allows better management of IP addresses.
## What is the difference between a hub, switch, and router
A hub operates at Layer 1 and broadcasts all received data to all ports. A switch operates at Layer 2 and forwards data only to the port connected to the destination MAC address. A router operates at Layer 3 and routes packets between different networks using IP addresses.
## What is DNS
DNS stands for Domain Name System. It translates human-readable domain names like www.google.com into IP addresses that computers use to communicate. Without DNS, users would have to remember the IP address of every website.
## What is DHCP
DHCP stands for Dynamic Host Configuration Protocol. It automatically assigns IP addresses and other network configuration like subnet mask, default gateway, and DNS server to devices when they connect to a network.
## What is NAT
NAT stands for Network Address Translation. It translates private IP addresses to a public IP address when traffic goes to the internet. It allows many devices with private addresses to share a single public IP address. NAT conserves public IP addresses and hides internal network addresses.
## What is the three-way handshake in TCP
The three-way handshake is the process TCP uses to establish a connection. First the client sends a SYN packet. Second the server responds with a SYN-ACK packet. Third the client sends an ACK packet. After this the connection is established and data transfer can begin.
## What is ARP
ARP stands for Address Resolution Protocol. It resolves IP addresses to MAC addresses within a local network. When a device knows the IP address of another device but needs its MAC address, it broadcasts an ARP request. The device with that IP address replies with its MAC address.
## What is ICMP
ICMP stands for Internet Control Message Protocol. It is used for error reporting and diagnostics. The ping utility uses ICMP echo request and echo reply messages to test connectivity. Traceroute uses ICMP time exceeded messages to trace the path of packets.
## What is a firewall
A firewall is a network security device that monitors and controls incoming and outgoing traffic based on security rules. It creates a barrier between a trusted internal network and untrusted external networks. Firewalls can be hardware devices, software, or both.
## What is the difference between IPv4 and IPv6
IPv4 uses 32-bit addresses allowing about 4.3 billion unique addresses. IPv6 uses 128-bit addresses providing an enormously larger address space. IPv4 is written in decimal as four octets. IPv6 is written in hexadecimal with colons. IPv6 was created because IPv4 addresses have been exhausted.
## What is a MAC address
A MAC address is a 48-bit hardware address assigned to every network interface card by its manufacturer. It is written as 12 hexadecimal digits. The first 24 bits identify the manufacturer and the last 24 bits identify the specific device. MAC addresses are used for communication within a local network.
## What is a default gateway
A default gateway is the IP address of the router that a device sends packets to when the destination is outside the local network. It is the exit point from the local network to other networks including the internet.
## What is VPN
VPN stands for Virtual Private Network. It creates an encrypted tunnel over the internet between two endpoints. VPNs allow remote employees to securely access company resources and allow organizations to connect multiple offices over the internet securely.
## What is the OSI model used for
The OSI model is used as a reference framework for understanding how different network protocols work together. It is used for teaching networking concepts and for troubleshooting network problems by isolating which layer a problem exists at.
## What is bandwidth and latency
Bandwidth is the maximum amount of data that can be transmitted over a network connection per unit of time, measured in bits per second. Latency is the time it takes for a packet to travel from source to destination, measured in milliseconds. High bandwidth with low latency provides the best network performance.Back to Course