# DNS & HTTP — Name Resolution and Web Delivery

## DNS — Domain Name System

### What is DNS?
DNS translates human-readable hostnames (e.g. `www.example.com`) into IP addresses (e.g. `192.168.1.1`). It operates at the **Application Layer** and uses **UDP port 53** for queries.

### DNS Resolution Process
```
Client                    DNS Server
  |--- DNS Query (UDP) -->|   "What is the IP for www.example.com?"
  |<-- DNS Reply (UDP) ---|   "It's 192.168.1.10"
  |   [IP resolved]       |
```

1. Client sends a DNS query to the configured DNS server.
2. DNS server looks up the hostname in its records.
3. DNS server replies with the resolved IP address.
4. Client uses the IP to establish a connection.

---

## HTTP — HyperText Transfer Protocol

### What is HTTP?
HTTP is the protocol used to request and deliver web content. It operates at the **Application Layer** and uses **TCP port 80**.

### HTTP Request-Response Flow
```
Client                    Web Server
  |--- TCP SYN ---------->|   (Three-way handshake)
  |<-- TCP SYN-ACK -------|
  |--- TCP ACK ---------->|
  |--- HTTP GET / ------->|   "Give me the homepage"
  |<-- HTTP 200 OK --------|   "Here it is: <html>..."
```

---

## DNS + HTTP Together (Full URL Flow)
When you type a URL in a browser:

1. Browser checks local DNS cache.
2. If not cached → sends DNS query (UDP) to DNS server.
3. DNS replies with IP address.
4. Browser opens TCP connection to server on port 80.
5. Browser sends HTTP GET request.
6. Server responds with the webpage content.

## Observed in
- Activity 3.2.3 — Client-Server Interaction
- Activity 3.3.2 — Configuring DNS and HTTP on a Server
- Activity 3.5.1 — Skills Integration: Configuring Hosts and Services
