Configuration problem?

Hi all X(… i have this kind o problem:
“Ethernet Shield is not getting IP from DHCP”.

I use:

  • arduino1
  • ethshield (W5100) without memory card inserted

my lan is composed by:
A router connected to modem. The router is connected to pc and arduino + eth shield

The router has dhcp enabled and in dhcp setting i added the arduino mac and his ip.

If i connect arduino + ethShield to the router the router gave to arduin ip: 0.0.0.0,
but if i connect the arduino directly to the modem arduino “reach” the internet.

i try to run This code with arduino + ethShield connected
to the router:

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

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0, 50);
IPAddress gateway(192,168,0, 1);
IPAddress subnet(255, 255, 255, 0);
byte server[] = { 192, 168, 0, 1 };
int incommingdata = 0;
EthernetClient client;

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT); 
  Serial.println("Initialising Ethernet...");
  Ethernet.begin(mac);//, ip, gateway, subnet);  
  delay(1000);
  Serial.println(Ethernet.localIP());
  Serial.println("connecting...");
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
  }
  else {
    // kf you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
}

but on serial monitor i read only:
Initialising Ethernet…
0.0.0.0
connecting…
connection failed

what should I do? …
I think it’s a router configuration problem but I do not know how to fix it

sorry for my english

Hello

Do you mean switch instead of router and router instead of modem? (Switches create a network. Routers connect networks)

Describe your appliances , maybe that will help understand your config