Designing a Simulated Physical Layer for a TCP/IP Stack Written in Rust

⚓ Rust    📅 2026-03-12    👤 surdeus    👁️ 5      

surdeus

Hi,

I have tried several tutorials, books, and other resources about networking, but none of them really satisfied me. I do not just want to understand how something works; I want to understand what problem it solves in the first place. I prefer learning from first principles.

This question is not specifically about Rust, but I previously had a good experience asking about how to implement a VM in Rust. People were very helpful, so I decided to ask here again.

For learning and as a hobby project, I want to rebuild the entire TCP/IP stack from scratch in Rust.

My plan is to start from the lowest level by simulating a physical layer that is unreliable. I have already written a small library that simulates unreliable communication, but I would like something that feels closer to real hardware. My idea is to simulate a very basic hardware interface in code and then build the higher layers on top of it.

However, I am not sure what the best approach is. The physical layer feels especially important since everything else is built on top of it.

Does anyone have recommendations for how to simulate a physical layer in a meaningful way for learning purposes? For example, what kind of abstractions or constraints should I model to make the simulation realistic enough to support building higher network layers?

Any advice or references would be greatly appreciated. Thank you.

5 posts - 4 participants

Read full topic

🏷️ Rust_feed