Build a TCP/IP Stack from Scratch · Module 01

Setup: Repository & File Layout

Setup: Repository & File Layout

Let's get our hands dirty and build the foundation for your lab.

This is where your project starts taking shape on disk — nothing fancy yet, just the structure that every future module will live inside.

We're going to set up a minimal Docker Compose environment: one "client" container, one "stack" container, and a shared network between them.

Project Structure

Here's the layout we're aiming for:

netstack/
├─ lab/
│ ├─ docker-compose.yml
│ ├─ client.Dockerfile
│ └─ stack.Dockerfile
├─ stack/
│ └─ (your future C code lives here)
├─ .gitignore
└─ README.md

Let's walk through each piece.

Component Breakdown

1. The lab/ folder

This folder holds everything related to your Docker lab environment — configs, Dockerfiles, test scripts. It's like the "infrastructure" layer of your project.

2. The stack/ folder

This is where your future TCP/IP stack code will live.

Right now it's empty, but soon it'll contain C source files, headers, and a Makefile.

3. The .gitignore

You'll want to ignore build artifacts and binary files so Git doesn't clutter your history later. Add this simple one at the root:

# Build outputs
*.o
*.out
*.log
/build/
/bin/
/obj/

4. The README.md

Just a short intro to remind you (and anyone who clones the repo) what this project is, you can put whatever you want in here.

5. Initialize Git

Inside your netstack folder, run:

git init
git add .
git commit -m "Module 1: repo and lab folders created" 

We'll tag this as v01_setup at the end, once the containers actually run.

You've now got a clean workspace with a place for both your environment and your code — time to fill those Dockerfiles and bring your mini-network to life. /bin/ /obj/


### 4. The `README.md`
Just a short intro to remind you (and anyone who clones the repo) what this project is.

### 5. Initialize Git
Inside your `netstack` folder, run:

```bash
git init
git add .
git commit -m "Module 1: repo and lab folders created"

Success: We'll tag this as v01_setup at the end, once the containers actually run.

You've now got a clean workspace with a place for both your environment and your code — time to fill those Dockerfiles and bring your mini-network to life.