Pages: [1]   Go Down
Author Topic: Ethernet.begin() With DNS and Without static ip  (Read 920 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8706
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks , I'll definitly try both your options smiley
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5351
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Call Ethernet.begin() twice...

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Pages: [1]   Go Up
Jump to: