Ethernet.begin() With DNS and Without static ip

Hi., i think this is actually a very small problem and probably easy to solve , but i can't find anything about it.

I own an arduino ethernet board and i want it to get an ip adres from the DHCP server but i want to manually set the DNS server

to get a dynamic ip i know i uwe ethernet.begin(mac) ;

and to set the DNS server ethernet.begin( mac, ip , dns) but i don't want to set an IP adress because in my case i'ts not possible
to receive a static IP.
I've tried to leave it blank like this ethernet.begin( mac , , dns )

but that doesn't work..

Any suggestion is welcome

Greetings Sam

Looks like it's not supported but you can change Ethernet.h in the library to make "IPAddress _dnsServerAddress" public. Then you can overwrite it with the address you want to use.

It's ugly, but would it be possible to call ethernet.begin() once to get a dynamic address, and then again to use that as a static address with your required DNS server?

I suppose the proper solution would be to configure your DHCP server to nominate the DNS server you want to use (which is something that I wouldn't expect an embedded DHCP server to support), or configure your default DNS server to delegate to the DNS server you want to use (which even an embedded DHCP server may support).

Thanks , I'll definitly try both your options :slight_smile:

Call Ethernet.begin() twice...