Arduino Ethernet DHCP Server Library Collaboration

Alright let me kick this off with a warning to those who would reply to this thread with "Just use a router" or other unhelpful comments, there are many potential projects where multiple Arduinos are required to speak with one another and will not be close enough to one another to make use of protocols such as I2C. Some of these projects might be able to use WiFi shields, in which case they can rely on a router to handle DHCP for them, some might be plugged into a router through Ethernet with the same result. Some of these projects however cannot rely on a router, and it is for these projects that I have decided to try and create a standard DHCP Server library for use with Arduinos.

Now with that out of the way, please allow me to share what I have found to date. In my efforts to get an Arduino Mega2560 to act as a DHCP server for two UNO clients, all are using the Wiznet W5100 Ethernet shield, I dove into the DHCP client code contained within the Ethernet library. A little reverse engineering of that and I think I am close to a working, albeit ridiculously simple, DHCP server that is compatible with clients employing the Ethernet library. Now as I'm sure a quick review of the forums will tell you, not everyone who is connecting their Arduino to a network is using hardware that is compatible with the Ethernet library. For this reason I would like to reach out and see if there is anyone out there who would be willing to work with me in creating a standardized, and well abstracted, DHCP Server library to be used with Arduinos. Some of the features of this library that I have in mind are using preprocessor defines prior to the library include in order to dynamically include various features by abstracting the features to individual .h and .cpp files. This would allow the library to be as complex or small as required based on the device that it is intended to run on. These would of course be clearly demonstrated in the examples that would be included with the library.

If you are interested in contributing to this please let me know. Some areas that could be helpful are testing the DHCP server functionality on various Arduino devices, I only have access to an UNO and a Mega2560 so testing the base functionality on other devices would be extremely helpful. Code contributions are of course always welcome as well.

Since my code is not yet fully functional as even the simplest of DHCP servers I have not included a link to the Github repo for it here however I would be willing to share it upon request. At the moment I am not ready to make the library public as I am not yet prepared to support it since it is as I mentioned still not complete, there might be a bug or two lurking in there lol XD

An aside: I did look at pkulchenko's DHCPLite library, available at GitHub - pkulchenko/DHCPLite: DHCP/DNS server for Arduino, and managed to get it to work with the Ethernet library and a single client however the introduction of a second client resulted in two clients who thought they had the same IP address. This is when I decided it was time to write my own library, and seeing so many threads on this forum asking about DHCP servers on Arduinos being met with flippant replies to "Just use a router" I am even more determined to get a DHCP server library working for Arduinos.

To contact me please either reply to this thread, send me a DM, or if you really need to you can contact me directly via email at

Why use a wooden wheel when you have a car wheel with a tire?
Use CAN bus for exchange:

  1. It is reliable. 2) Distance further. 3) You can use bad wires. 4) Programming is easier. 5) Cheaper.
    I have a comfortable apartment (smart home). I use many modules in different places and all modules can exchange among themselves.
    I am only using one W5100 board to display html. (Remember, the W5100 has a hardware problem with the SPI bus, see how to fix it here: )

I'll have to look further into CAN bus, never heard of it before now to be honest. As for why use DHCP and ethernet, my particular use case is because my devices are using PoE which is supplied by the Mega2560 and I want them to be "Plug-and-Play" so dynamic address allocation is required. As for the W5100 fix I actually came across your post a little while ago, though I got there not for the SD card not working but because using LCD screens without I2C resulted in some weird behaviour even when using pins 8 and 9 instead of 10 and 11.

All that said a part of building a DHCP Server library for Arduino is also because why not.

Just what I am looking for. At least mostly.
I am happy to help if I can.

I am looking to make a sketch that will show the MAC address of a connected host. In my situation, I need the MAC addresses off computers without a screen, keyboard, mouse, etc. Just want to turn it on, plug this thing in and have it show the MAC address of the hardware it is plugged in to. The only way I can think of getting this is to act as a DHCP server, so when the host requests an IP, it will get the MAC of the HOST in the request. The sketch can reply what a bogus IP, it doesn't matter. Just want the MAC of the host.

If your Library will get me there, happy to help out. :slight_smile: