Explain the OSI and TCP/IP models. Highlight key differences.
OSI Model: A 7-layer conceptual model that standardizes the functions of a telecommunication or computing system without regard to its underlying internal structure and technology.
TCP/IP Model: A 4-layer model that is a more practical implementation of the OSI model. It is the model used for the internet.
Key Differences:
- OSI has 7 layers, while TCP/IP has 4.
- TCP/IP is more practical and widely used, while OSI is a more theoretical model.
- The OSI model has separate Presentation and Session layers, which are combined into the Application layer in the TCP/IP model.
What are the differences between circuit switching and packet switching?
Circuit Switching: A dedicated communication path is established between two devices for the duration of the communication. Resources are reserved for the entire session. Example: Traditional telephone network.
Packet Switching: Data is broken down into small packets, which are sent independently over the network and reassembled at the destination. Resources are not reserved and are used on demand. Example: The Internet.
How does DNS work?
DNS (Domain Name System) translates human-readable domain names (like www.google.com) into machine-readable IP addresses (like 172.217.168.68).
When you type a domain name into your browser, your computer sends a request to a DNS resolver, which then queries a series of DNS servers (root, TLD, and authoritative) to find the corresponding IP address. The IP address is then returned to your computer so it can connect to the website.
Describe the functioning of TCP’s three-way handshake.
The TCP three-way handshake is a process used to establish a reliable connection between two devices over a network. The three steps are:
- SYN: The client sends a SYN (synchronize) packet to the server to initiate the connection.
- SYN-ACK: The server responds with a SYN-ACK (synchronize-acknowledge) packet to acknowledge the client's request.
- ACK: The client sends an ACK (acknowledge) packet back to the server, confirming the connection is established.
Explain congestion control in TCP.
TCP congestion control is a mechanism that helps prevent network congestion by limiting the amount of data a sender can transmit into the network without receiving an acknowledgment. It uses several algorithms, including:
- Slow Start: Gradually increases the amount of data sent until it reaches a threshold.
- Congestion Avoidance: Increases the amount of data sent linearly once the slow start threshold is reached.
- Fast Retransmit and Fast Recovery: Detect and recover from packet loss without waiting for a timeout.
How do firewalls and NATs work?
Firewalls: A network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.
NAT (Network Address Translation): A method of remapping one IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device. It allows multiple devices on a private network to share a single public IP address.
What is the difference between IPv4 and IPv6 addressing?
IPv4 (Internet Protocol version 4):
- 32-bit address space (e.g., 192.168.1.1).
- About 4.3 billion addresses.
IPv6 (Internet Protocol version 6):
- 128-bit address space (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).
- Vastly larger address space.
- Includes improvements like built-in security (IPsec) and simplified header format.