Ethernetshield automatic connect with every lan

Dear all.
I am noop .. sorry.. dut i try to do my best..:slight_smile: :frowning:
Only hope you can help me. where is this forum otherwise for... :confused:

I will try to make a universal part of the sketch for the ethernet shield.
Now i need to set the shield to work with:


Only when i use the board in a other lan where i need internet i need to set every time the ip and the gateway etc,

Is there no solution to start the shield with a Dhcp option.
So the board always connect the lan and get internet, from DHCP.
something like:

I now thet there is then no static ip..
No problem, when the shield get internet automatic

Hope you have a sketch example for me.


   Serial.println("No dhcp. Setting static");
   Serial.print("DHCP IP ");