dhcp client & server

$ a DHCP protocol implementation in C

overview

A two-part networking project: first implementing a complete DHCP client, then a multithreaded DHCP server. Built incrementally across multiple phases, both components follow RFC 2131 and RFC 2132 specifications and involve deep binary data manipulation and socket programming in C.

The server handles concurrent client connections using pthreads and manages IP address lease pools. The client completes the full DORA handshake (Discover, Offer, Request, Acknowledge) and processes option fields per spec.

tech stack

  • C: pointer manipulation, memory management, struct design
  • Network programming: UDP sockets, custom port handling
  • DHCP protocol: RFC 2131, RFC 2132 compliance
  • Multithreading: pthreads for concurrent server handling
  • Binary data processing: byte-level manipulation, network byte order

takeaways

This project series provided deep exposure to systems-level network programming and protocol implementation. The incremental development approach, spanning multiple phases, allowed for thorough understanding of each component before building upon it.

Working directly from RFC specifications taught the importance of precise protocol implementation and attention to detail in network programming. The binary data manipulation aspects significantly strengthened my understanding of memory management and low-level programming concepts in C.

The multithreading component introduced valuable concepts in concurrent programming and resource management, while the comprehensive testing requirements emphasized the importance of robust error handling in networked applications.

  • Understanding of DHCP protocol mechanics end to end
  • Experience with socket programming in C
  • Concurrent server design with pthreads