Ethernet Shield: failed to configure ethernet using dhcp

I haven't used before Arduino Ethernet Shield and trying just test it.

I used Examples->Ethernet->DhcpAddressPrinter. Also I used command prompt and typed ipconfig /all. Where is said: DCHP's enabled.

When example runs serial prints: failed to configure ethernet using dhcp. So it not working.

I tryed configure any mac-address to arduino. Should I put it "ethernet-adapter-ethernet"-mac address?

How to fix it so it could work?

If you have a w5100 based ethernet shield and it is connected to a router, below is some client test code you can try without modification to see if you can get a response from the ip server.

//zoomkat 11-04-13
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test client GET
//for use with W5100 based ethernet shields
//remove SD card if inserted
//data from myIP server captured in readString 

#include <SPI.h>
#include <Ethernet.h>
String readString;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "checkip.dyndns.com"; // myIP server test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("client readString test 11/04/13"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  Serial.println();
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET / HTTP/1.1"); //download text
    client.println("Host: checkip.dyndns.com");
    client.println("Connection: close");  //close 1.1 persistent connection  
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    readString += c; //places captured byte in readString
  }

  //Serial.println();
  client.stop(); //stop client
  Serial.println("client disconnected.");
  Serial.println("Data from server captured in readString:");
  Serial.println();
  Serial.print(readString); //prints readString to serial monitor 
  Serial.println();  
  Serial.println();
  Serial.println("End of readString");
  Serial.println("==================");
  Serial.println();
  readString=""; //clear readString variable

}

Yeah. It's w5100 based ethernet shield + arduino mega 2560 chip. I will try that. Also trying figure out better my router settings.

Some other people have got also a same problem but didnt find help from them.

zoomkat:
If you have a w5100 based ethernet shield and it is connected to a router, below is some client test code you can try without modification to see if you can get a response from the ip server.

When I use your code. I dont get any feedback. Serial printing nothing.

I tryed also this kind of code:

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,2,2);

void setup() {
  Serial.begin(9600);

  // disable SD card if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.println("Starting w5100");
  Ethernet.begin(mac,ip);

  Serial.println(Ethernet.localIP());
}

void loop() {
}

Serial prints:

Starting w5100
255.255.255.255 (ethernet shield was installed badly, after reinstall it worked fine and showed ip)

Sorry. I had my ethernet shield installed bad. So of corse it not works…!

I got this message from your code:

connected
client disconnected.
Data from server captured in readString:

HTTP/1.1 200 OK
Content-Type: text/html
Server: DynDNS-CheckIP/1.0
Connection: close
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 106

Current IP CheckCurrent IP Address: xx.xxx.xxx.xxx

End of readString

Seems it working fine. It was a my fault.

It is easy to misalign the the ethernet shield pins when installing it on an arduino. Been there, done that.