There are a bunch of tutorials out there on how to build your own router based on Linux or one of the BSDs. I’d recommend such a tutorial as a good starting point for a top-down view.
The lower-level is very visible through Wireshark, with which you can capture all network traffic.
Does that help?