DHCP server: how to make a teensy give IP addresses to other devices?

olivierdemoustier

Active member
Is it possible to make a Teensy with ethernet adapter to give Ip-adresses to other device(s)?
I know how to do it with ESP32 in wifi mode. But can't find a solution for wired ethernet.
Thanks in advance for tips on this.
Olivier
 
There's two ways:
1. Use a lower-layer stack such as lwIP or FNET and write the server on top of that. There's a few Teensy 4.1 libraries that include an IP stack: QNEthernet (lwIP) and NativeEthernet (FNET). You'll likely write this in C and conform to the stack's API.
2. Use the Arduino-style Ethernet API to accept and respond to DHCP messages. You'll likely write this in C++ and conform to the API of whichever library you're using.

I haven't done a search, but I'm fairly certain you'll find both types of examples if you search for something like "dhcp server lwip" or "dhcp server arduino" or something.

(I could probably write or adapt one if you need one quickly, but that's a discussion for off-list.)
 
Thanks for the tip's. I will try looking for dhcp server lwip.
I did search for "dhcp server arduino", and got lots of results, all for receiver IP-adress from DHCP server, never the other way around.
 
If you wanted to give it a shot yourself, the protocol specification is in RFC 2131, “Dynamic Host Configuration Protocol.”
 
Back
Top