For anyone experimenting with the Internet of Things with Arduino one of the bigger missing pieces in the standard Arduino distribution is the lack of DHCP and DNS. DHCP means you don't have to hard-code the IP address of your Arduino, it can just ask the nearest router to give it one, and DNS lets you connect to sites by providing the domain name (e.g. www.mcqn.com) rather than having to find the IP address (e.g. 80.82.118.27).

For the past eighteen months or so, I've been using Jordan Terrell's DHCP library, coupled with the DNS client that I've written, and which has been available on the MCQN googlecode site.

It's always been my intention to help get these pretty essential parts of the Ethernet library moved into the official distribution, but client work had conspired to keep me too busy until recently.

Just as I was getting back to tidying up the rough edges on the code Arduino 0019 was released, which contained a much reworked Ethernet library which uses the SPI library. Unfortunately, that also broke both Jordan's DHCP code and my DNS client.

I've now finished porting both the DHCP (with Jordan's permission) and DNS code to the new Ethernet library, and will be working out if we can get it added to the official distribution over the coming weeks. In the meantime, it would be useful to get feedback on whether anyone has problems with it, and also provide it for people who want to use it.

To use it, unpack either the zip or the tar.gz file below into the arduino/libraries/ folder on your machine. Both the zip and the tar.gz contain the same files, I'm just providing two versions so you can choose your preferred compression type.

Ethernet-DHCP-DNS.zip

Ethernet-DHCP-DNS.tar.gz

There's a new example included, DNSExample, which shows how you'd modify the standard WebClient example to use both DHCP and DNS.

There have also been a few changes to the UDP code - it now supports more than one UDP instance (and doesn't have the global one defined, you'll need a "UdpClass Udp;" line in your sketch if you've been using it) and has extra methods to support sending and receiving large datagrams (which wouldn't otherwise fit into memory).

It has been tested on Arduino 0021 on Linux, but should work on any of the Arduino releases after 0018. If you use it I'd be grateful to hear details of how you get on and what systems you use it against (what router for example).