110 lines
3.0 KiB
Markdown
110 lines
3.0 KiB
Markdown
# Computer Network Experiment: TCP vs QUIC (Linux Guide)
|
|
|
|
This guide adapts the Windows-based experiment manual for a Linux environment.
|
|
|
|
## 1. Prerequisites
|
|
|
|
Ensure you have the following installed:
|
|
- `gcc` (Compiler)
|
|
- `quiche` library (Headers and Shared Object installed)
|
|
- `openssl` (For certificates)
|
|
- `tcpdump` or `wireshark` (For packet capture)
|
|
- `iproute2` (For `tc` traffic control)
|
|
|
|
## 2. Compilation
|
|
|
|
Compile all programs using the provided Makefile:
|
|
|
|
```bash
|
|
make
|
|
```
|
|
|
|
This will generate:
|
|
- `tcp_server`, `tcp_client` (Task 1)
|
|
- `quic_server`, `quic_client` (Task 2)
|
|
- `tcp_perf_server`, `tcp_perf_client` (Task 3 Performance)
|
|
- `quic_perf_server`, `quic_perf_client` (Task 3 Performance)
|
|
|
|
*Note: If `quiche` is not in the standard system path, edit the `Makefile` to point to the include/lib directories.*
|
|
|
|
## 3. Task 1: Basic TCP Client-Server
|
|
|
|
1. **Start the Server:**
|
|
```bash
|
|
./tcp_server
|
|
```
|
|
2. **Run the Client (in a new terminal):**
|
|
```bash
|
|
./tcp_client
|
|
```
|
|
|
|
**Expected Output:** The client sends "Hello...", server receives it and replies.
|
|
|
|
## 4. Task 2: Basic QUIC Client-Server
|
|
|
|
1. **Start the Server:**
|
|
```bash
|
|
./quic_server
|
|
```
|
|
2. **Run the Client (in a new terminal):**
|
|
```bash
|
|
./quic_client
|
|
```
|
|
|
|
**Expected Output:** QUIC handshake completes, client sends data on a stream, server echoes it back.
|
|
|
|
## 5. Task 3: Performance Analysis
|
|
|
|
### 3.1 Connection Establishment Time
|
|
|
|
1. Start capture on loopback:
|
|
```bash
|
|
sudo tcpdump -i lo -w handshake.pcap
|
|
```
|
|
*(Or use Wireshark on the `lo` interface)*
|
|
|
|
2. Run the TCP or QUIC client/server pairs again.
|
|
3. Open `handshake.pcap` in Wireshark to analyze the time difference between the first packet (SYN for TCP, Initial for QUIC) and the completion of the handshake.
|
|
|
|
### 3.2 Throughput Test (100MB Transfer)
|
|
|
|
**Baseline (Normal Network):**
|
|
|
|
1. Run TCP Perf Server: `./tcp_perf_server`
|
|
2. Run TCP Perf Client: `./tcp_perf_client`
|
|
3. Record the MB/s output.
|
|
4. Repeat for QUIC (`./quic_perf_server`, `./quic_perf_client`).
|
|
|
|
**Simulating Network Conditions (Packet Loss / Delay):**
|
|
|
|
We use Linux `tc` (Traffic Control) with `netem` instead of `clumsy`.
|
|
|
|
**Scenario A: 5% Packet Loss**
|
|
|
|
1. Apply 5% loss to the loopback interface:
|
|
```bash
|
|
sudo tc qdisc add dev lo root netem loss 5%
|
|
```
|
|
2. Run the perf tests again.
|
|
3. **Important:** Remove the rule after testing!
|
|
```bash
|
|
sudo tc qdisc del dev lo root
|
|
```
|
|
|
|
**Scenario B: 100ms Delay**
|
|
|
|
1. Apply 100ms delay:
|
|
```bash
|
|
sudo tc qdisc add dev lo root netem delay 100ms
|
|
```
|
|
2. Run the perf tests again.
|
|
3. Remove the rule:
|
|
```bash
|
|
sudo tc qdisc del dev lo root
|
|
```
|
|
|
|
### 3.3 & 3.4 Advanced Tests
|
|
|
|
- **Multiplexing:** The current `quic_perf_client` uses a single stream (Stream ID 4). You can modify the code to launch multiple streams in parallel to test head-of-line blocking resilience.
|
|
- **Network Recovery:** Use `tc` to drop 100% packets (`loss 100%`) for 30 seconds during a long transfer, then remove the rule (`del`) to see if the connection recovers.
|