This project is a hands-on learning journey into low-level network programming with C. The goal is to understand how networks operate at their core by directly interacting with hardware network interfaces, packets, and protocol stacks. Through implementing networking fundamentals from the ground up, this project develops a deep understanding of the mechanisms that make modern networks function.
This study focuses on the Data Link Layer (OSI Layer 2) and Network Layer (OSI Layer 3), building a foundation for creating custom network applications and, ultimately, a functional router implementation.
-
Understand Network Fundamentals - Learn how data frames move across physical network media and how they are processed at each layer of the network stack.
-
Master Low-Level Routines - Develop proficiency with kernel-level networking APIs, packet structures, and hardware interface programming using C.
-
Work with Real Network Hardware - Interact directly with network devices, capture live traffic, and manipulate network packets at the byte level.
-
Build Protocol Understanding - Implement basic protocol handlers (Ethernet, IP, ARP, ICMP) to understand how protocols work in practice.
-
Create a Custom Router - Apply learned concepts to design and implement a functional router application that can forward packets between network interfaces.
This project is developed and tested for Linux environments. To build and run the programs, you must have the following installed:
- GNU Compiler Collection (GCC) or Clang
- Linux kernel development headers (for socket definitions)
- libpcap development library
sudo apt-get update
sudo apt-get install build-essential libpcap-devTo compile the project, use the following command:
gcc main.c -o main -lpcapSince the programs access hardware network interfaces directly, they require administrative privileges to run:
sudo ./mainEduardo