Ethernet Shield W5100 Not working with Arduino UNO

Hi,

I'm new to Arduino and have little knowledge on programming and configuring Networks. However I have a Arduino UNO with W5100 Ethernet Shield connected to my PC LAN using a crossover cable. PC has the internet connection through a WiFi dongle (I don't have router or switches at the moment) I have uploaded the DHCP Address printer code which comes pre installed in the examples and it shows "Failed to configure Ethernet using DHCP" in serial monitor.

In W5100 board the power, 100M, FULLD LEDs are on and LINK LED blinks fast. Also the RX and TX LEDs blinks occasionally. Also the LEDs in both PC and W5100 RJ45 connectors blinks.

In my PC's network connection window the LAN adapter shows "Unidentified Network" when I connect RJ45 cable to LAN port.
In the status of the network it shows following

Connection-specific DNS Suffix:
Description: Realtek PCIe GBE Family Controller
Physical Address: ‎40-16-7E-73-DC-97
DHCP Enabled: Yes
Autoconfiguration IPv4 Address: 169.254.17.253
IPv4 Subnet Mask: 255.255.0.0
IPv4 Default Gateway:
IPv4 DNS Server:
IPv4 WINS Server:
NetBIOS over Tcpip Enabled: Yes
Link-local IPv6 Address: fe80::25ae:5382:1e6c:11fd%3
IPv6 Default Gateway:
IPv6 DNS Servers: fec0:0:0:ffff::1%1, fec0:0:0:ffff::2%1, fec0:0:0:ffff::3%1

Does anyone know how to solve this issue? I have tried many solutions found by googling, and I have seen people using W5100 with a crossover cable and LAN ports even in laptops. any help to solve the issue greatly appreciated.

The "DHCP Enabled: Yes" means the DHCP client is enabled on the PC, not a DHCP server.

You can try assigning a manual IP to the shield within the localnet range of the PC.

Thank you for the reply. Could you please let me know how to assign a manual IP to the shield?

the code as follows,

/*
  DHCP-based IP printer

  This sketch uses the DHCP extensions to the Ethernet library
  to get an IP address via DHCP and print the address obtained.
  using an Arduino Wiznet Ethernet shield.

  Circuit:
   Ethernet shield attached to pins 10, 11, 12, 13

  created 12 April 2011
  modified 9 Apr 2012
  by Tom Igoe
  modified 02 Sept 2015
  by Arturo Guadalupi

*/

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // this check is only needed on the Leonardo:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for (;;)
      ;
  }
  // print your local IP address:
  printIPAddress();
}

void loop() {

  switch (Ethernet.maintain())
  {
    case 1:
      //renewed fail
      Serial.println("Error: renewed fail");
      break;

    case 2:
      //renewed success
      Serial.println("Renewed success");

      //print your local IP address:
      printIPAddress();
      break;

    case 3:
      //rebind fail
      Serial.println("Error: rebind fail");
      break;

    case 4:
      //rebind success
      Serial.println("Rebind success");

      //print your local IP address:
      printIPAddress();
      break;

    default:
      //nothing happened
      break;

  }
}

void printIPAddress()
{
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }

  Serial.println();
}

Considering the IP of the PC, then this should work.

// this must be unique
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEC };

// change to your network settings

IPAddress ip( 169,254,2,2 );
IPAddress gateway( 169,254,0,1 );
IPAddress subnet( 255,255,0,0 );

Ethernet.begin(mac,ip,gateway,gateway,subnet);

Hello thank you very much for helping me. However I have found that its not a issue with configuring DHCP but a Hardware issue. This is a Chinese W5100 board and there is a resistor array "511" (510R) behind the RJ45 socket. However it should be a 510 (51R) resistor array. I have replaced the array and now it works! I found the solution in here >

https://forum.arduino.cc/index.php?topic=351477.0

Hope it helps anyone with the same problem.

If the device seller's web page has a review section, I recommend posting a review and mention your findings.