Ethernet shield w5100 getting IP as 255.255.255.255

Hi guys, check out the code that I'm using to assign IP address to my arduino ethernet shield:

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

// network configuration. dns server, gateway and subnet are optional.

 // the media access control (ethernet hardware) address for the shield:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  

// the dns server ip
IPAddress dnServer(150, 236, 18, 59);
// the router's gateway address:
IPAddress gateway(100, 96, 1, 1);
// the subnet:
IPAddress subnet(255, 255, 255, 0);

//the IP address is dependent on your network
IPAddress ip(100, 96, 1, 4);

void setup() {
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  Serial.begin(9600);

  // initialize the ethernet device
  Ethernet.begin(mac, ip);
  //print out the IP address
  Serial.print("IP = ");
  Serial.println(Ethernet.localIP());
}

void loop() {
}

After uploading this, my output was:
IP = 255.255.255.255

Note: I've tried with Ethernet.begin(mac, ip, dns, gateway, subnet) also. It resulted in the same problem.
I was unsuccessful in getting the IP assigned dynamically using DhcpAddressPrinter.
I've checked the following links in the forum already:
W5100 Probleme ethernet
Ethernet Shield is not getting IP from DHCP
I Googled a lot, but, I couldn't solve my problem. I have two ethernet shields. Both of them are resulting into the same problem.
There was no MAC address sticker on my product, so I used the one specified in the Ethernet examples. I read in the forum somewhere that this doesn't usually matter unless more than one device on the network possesses the same MAC, of which the probability is low.
I request you guys to help me out with this.

Thanks,
Nikhil Clement

Do you know what is dynamic IP?
You got it.
Check you routrer settings for more information.

IPAddress ip(100, 96, 1, 4);

You ip configuration is very odd.This ip address is not valid to a private network ...
I doubt you router have dhcp configured to offer ips in this subnet.

Whether or not it is a valid IP, the code you posted should assign it.

Are you certain it is a w5100 IC? Can you post a link to that shield?

Do you have a SD card in the shield's slot? If so, remove it and try again, just as a test.

Hello,
Removing SD card it works, thanks! Do you now why? How can I use SD card?

void setup()
{
   // disable SD SPI
   digitalWrite(4,HIGH);

   // disable w5100 SPI
   digitalWrite(10,HIGH);

   // rest of your setup code
}

Hello. I apologize for recycling an old post but I'm having the same issue, except that I don't have any SD card in the slot.
I'm using an Arduino UNO with an Ethernet Shield W5100.

I don't have the code right now but I tried with the one in the examples.

I tried disabling the SD by writing HIGH in the pin 4 and getting an IP from the router but none work but I keep getting 255.255.255.255 when I print the Ethernet.localIP() in the serial monitor.
When I assign an static IP I can ping it from my computer and I can also see it in the DHCP table of my router.

i have this problem
i test with code .... my shield ethernet w5100 does not get mac