arduino+ethernet shield, isnt accessible until my computer gets on the network

Hello guys i run into a problem and i cant figure out the reason.

i made an arduino web server which powers on/off my computer through internet, i also used dyndns on my router (netgear dgn2200) so i can access arduino from anywhere through internet.

so what happens is this, if my computer is powered on and connected to the router arduino works ok.
if i shutdown my computer arduino continues to work ok.
if i power off the router and then power it back on while my computer is still powered off, arduino isnt accessible.
the lights on the arduino are on, it is working but it cannot be pinged (i tried pinging it at its local ip address from my phone which is connected on the same network and reports destination unreacheable)
if i let the phone pinging arduino for infinite number of tries and i power on my computer, the second that windows logs in the network arduino starts responding to pings.

this happens again if i un plug my pc from my router and reboot the router.
after the router has rebooted and while the pc is unplugged from the network, arduino wont respond to the pings,
as soon as i connect my pc to the router, arduino starts responding to pings again.
when it starts responding it will continue working even if i disconnect my pc until the router reboots.
if the router reboots i have to connect my pc again to the router by the ethernet cable in order for the arduino to get accessible

(please note that in order for the arduino to work after a router reboot, my computer has to get connected to the network by hardwiring it to the router, if i connect my pc to the network by using its wifi adapter, arduino still wont work)

it seems like arduino wont get connected to the network unless my computers ethernet connection gets established

i have made firewall entries on the router to allow incoming and outgoing packets on port 80 to the ip of the arduino,
i declaired an arduino service on the router on the port 80
i set the ip address of the arduino in the router and selected to exclude it from dhcp and keep it for arduino.

arduino is set to have a static ip from its sketch and it is connected from the ethernet port straight to the router.
and one last thing i noticed is that if i check the attached devices on the router it reports every device that its connected to it but arduino doesnt report a name, it just have -- for a name.
also im not sure if i should be able to see arduino as a connected device in network on my computer but i dont.

do you have any idea why arduino isnt accessible until my computer gets connected to the router?

Post your code.

i am using a simple password in order to activate the relays so please note that in the code im posting here i have replaced the real int values with 0 so anyone reading here the code wont be able to figure out my password.

/*

Arduino Ethernet Shield Prototyping,V2.0. Nitin William 14/01/2014

SPI.h, Ethernet.h Library from Aruduino.cc

This example code is in public domain.

References:

http://bildr.org/2011/06/arduino-ethernet-pin-control/

http://www.jackbarber.co.uk/notes/arduino-web-server-led-control

http://blog.startingelectronics.com/?p=546

*/



#include <SPI.h>

#include <Ethernet.h>


EthernetServer server(80);// Server port



const byte reset = 5;// Select pin for reset

const byte power = 6;// Select pin for power
int pin =0;          // Password Value


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

byte ip[] = { 192, 168, 1, 178 };// Fixed IP address

byte gateway[] = { 192, 168, 1, 1 };// Router Gateway Internet access

byte subnet[] = { 255, 255, 255, 0 };// Subnet mask

String readString;


void setup()

{

delay(300);// Delay for Ethernet shield initialization (Arduino has 65mS Power Up delay and W5100 reset logic has 280mS)

pinMode(reset, OUTPUT);// Define pin for reset as Output

pinMode(power, OUTPUT);// Define pin for power as Output



Serial.begin(9600);// Initialize serial communications at 9600 bps

Serial.println(F("Arduino UNO R3 with Ethernet Shiled W5100 - VU3GAO"));// Display Arduino title

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

server.begin();

Serial.print(F("Ethernet Shield initialized. Local IP address is:"));

Serial.println(Ethernet.localIP());// Print Server IP address

}


void loop()

{

EthernetClient client = server.available();// Create a client connection

if (client == true)

{

while (client.connected())

{

if (client.available())

{

char c = client.read();// Read char by char HTTP request

if (readString.length() < 100)

{

readString = readString + c;// Store characters to string

}

if (c == '\n')

{

Serial.println(readString);

client.println(F("http/1.1 200 ok"));// Send standard http headers

client.println(F("content-type: text/html"));

client.println();

client.println(F("<!doctype html><html>"));

client.println(F("<body bgcolor='9ec3c3'>"));

client.println(F("<center><head><title>Home Web Control</title></head>"));

client.println(F("<h2>Arduino UNO R3 Ethernet Shield Web Server(v2.16)</h2>"));

client.println(F("<h4>Home Automation</h4>"));

client.println(F("

<hr/><p> Enter The Correct Password To Turn On And OFF <p/><hr/>


"));

client.print(F("





"));

client.print(F("<input type=button value='&nbsp;1&nbsp;' onmousedown=location.href='/?1_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;2&nbsp;' onmousedown=location.href='/?2_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;3&nbsp;' onmousedown=location.href='/?3_on'>"));
client.print(F("
"));
client.print(F("<input type=button value='&nbsp;4&nbsp;' onmousedown=location.href='/?4_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;5&nbsp;' onmousedown=location.href='/?5_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;6&nbsp;' onmousedown=location.href='/?6_on'>"));
client.print(F("
"));
client.print(F("<input type=button value='&nbsp;7&nbsp;' onmousedown=location.href='/?7_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;8&nbsp;' onmousedown=location.href='/?8_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;9&nbsp;' onmousedown=location.href='/?9_on'>"));
client.print(F("
"));
client.print(F("<input type=button value='&nbsp;*&nbsp;' onmousedown=location.href='/?AK_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;0&nbsp;' onmousedown=location.href='/?0_on'>"));
client.print(F("&nbsp;"));
client.print(F("<input type=button value='&nbsp;#&nbsp;' onmousedown=location.href='/?HS_on'>"));
client.print(F("

"));

client.print(F("<input type=button value='Reset' onmousedown=location.href='/?RS_on'>"));

client.print(F("&nbsp;"));

client.print(F("<input type=button value='Power' onmousedown=location.href='/?PW_on'>"));
client.print(F("








"));
client.println(F("



<hr/><p> Home Automation <p/>"));

client.println(F("</body></html>"));

delay(1);// Page loading delay

client.stop();// Stopping client

          if (readString.indexOf("/?1_on") >0) //set pin value of the button 1
           {
               pin = 0+0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?2_on") >0)  //set pin value of the button 2
           {
               pin = 0*0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?3_on") >0)  //set pin value of the button 3
           {
               pin = 0-0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?4_on") >0)  //set pin value of the button 4
           {
               pin = 0*0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?5_on") >0)  //set pin value of the button 5
           {
               pin = 0-0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?6_on") >0)  //set pin value of the button 6
           {
               pin = 0+0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?7_on") >0)  //set pin value of the button 7
           {
               pin = 0* 0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?8_on") >0)  //set pin value of the button 8
           {
               pin = 0- 0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?9_on") >0)  //set pin value of the button 9
           {
               pin = 0+ 0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?AS_on") >0)//set pin value of the button *
           {
               pin = 0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?0_on") >0)  //set pin value of the button 0
           {
               pin = 0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }
           
           if (readString.indexOf("/?HS_on") >0)  //set pin value of the button #
           {
               pin = 0;
               Serial.print("PIN= ");
               Serial.println(pin);
  delay(1); 
           }


if(readString.indexOf("/?RS_on") > 0 && pin == 0) //if password is correct enables the relay
              {
               digitalWrite(reset, HIGH);
               delay(1000);
               digitalWrite (reset, LOW);
              pin = 0;
               Serial.print("PIN= ");
               Serial.println(pin); 
               
          
  delay(1); 
              }

if(readString.indexOf("/?PW_on") > 0 && pin == 0) //if password is correct enables the relay
              {
               digitalWrite(power, HIGH);
               delay(1000);
               digitalWrite (power, LOW);
               pin = 0;
               Serial.print("PIN= ");
               Serial.println(pin);
          
  delay(1); 
              }



readString = "";// Clearing string for next read

}// End of line reached

}// End of client available

}// End of client connected

}// End of client connection

}// End of loop

What is the IP assigned to the router localnet interface?

router ip 192.168.1.1
arduino 192.168.1.178

i just replaced my router netgear dgn2200 with the one my operator gave me and with the other router arduino responds all the time no matter if my computer is connected or not and no matter if the router has been rebooted or not.
so after all it seems like there is something going on with my netgear router, any ideas?

I've never seen one dependent on a computer connected to the localnet to access the Arduino. ??

well i am not sure why this is happening but without changing anything to the arduino the following 2 scenarios happen

  1. if i connect it to the netgear, arduino will only get accessible when both pc and router are powered up and connected, it will continue working until the router restarts either if the pc stays connected or not, when the router restarts if the pc is still connected to the router,arduino gets accesible again, if the computer isnt connected after the router restart arduino isnt accessible at all.

  2. when i connect arduino to the crappy zte operators router arduino is accessible all the time no matter if the computer is connected/disconnected or the router has just rebooted or not. it just works all the time (at least for the few hours i left it working today since i realized this)

so maybe i should try and ask over at netgears forum, maybe they might know what is blocking arduino from being accesible until my computer gets connected.