Destination Host Unreachable Ethernet Shield - Arduino UNO

Hi,

I have been trying to ping my Arduino with an attached Ethernet shield. I keep on getting the gateway address : Destination Host Unreachable.

example:
192.168.20.1: Destination Host Unreachable
192.168.20.1: Destination Host Unreachable
192.168.20.1: Destination Host Unreachable

This is what I did thus far:

  1. Logged into my router and changed the IP address
  2. Created a static IP address on my PC

In addition made sure that the arduino was on the same network as the PC & Router.

Also, the Ethernet Shield is from a 3rd party vendor and is using hanrun hr91105a

Here is my code (keep in mind its exactly the same code that is from the Ethernet example, except the IP address & Gateway address is different)

/*
DHCP Chat Server

A simple server that distributes any incoming messages to all
connected clients. To use, telnet to your device’s IP address and type.
You can see the client’s input in the serial monitor as well.
Using an Arduino Wiznet Ethernet shield.

THis version attempts to get an IP address using DHCP

Circuit:

  • Ethernet shield attached to pins 10, 11, 12, 13

created 21 May 2011
modified 9 Apr 2012
by Tom Igoe
modified 02 Sept 2015
by Arturo Guadalupi
Based on ChatServer example by David A. Mellis

*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};
IPAddress ip(192, 168, 20, 205);
IPAddress myDns(75,75,75, 75);
IPAddress gateway(192, 168, 20, 1);
IPAddress subnet(255, 255, 255, 0);

// telnet defaults to port 23
EthernetServer server(23);
boolean gotAMessage = false; // whether or not you got a message from the client yet

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:
Serial.println(“Trying to get an IP address using DHCP”);
if (Ethernet.begin(mac) == 0) {
Serial.println(“Failed to configure Ethernet using DHCP”);
// initialize the Ethernet device not using DHCP:
Ethernet.begin(mac, ip, myDns, gateway, subnet);
}
// print your local IP address:
Serial.print(“My IP address: “);
ip = Ethernet.localIP();
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(ip[thisByte], DEC);
Serial.print(”.”);
}
Serial.println();
// start listening for clients
server.begin();

}

void loop() {
// wait for a new client:
EthernetClient client = server.available();

// when the client sends the first byte, say hello:
if (client) {
if (!gotAMessage) {
Serial.println(“We have a new client”);
client.println(“Hello, client!”);
gotAMessage = true;
}

// read the bytes incoming from the client:
char thisChar = client.read();
// echo the bytes back to the client:
server.write(thisChar);
// echo the bytes to the server as well:
Serial.print(thisChar);
Ethernet.maintain();
}
}
]

Which IP adresses have you changed on your router and why?
You have made a static IP on your PC - which IP address?
Have you changed the default gateway on your PC to point on the routers IP address?
The IP net you are using 192.168.20.x, is it the same as your router uses for DHCP adresses?

I forgot to ask what you receive on your Serial monitor.
Are you sure your Ethernet Shield contains a Wiznet controller like the W5100.
The HANRUN hr91105a is only the Socket for you Ethernet cable and used by several suppliers

ffur:
Which IP adresses have you changed on your router and why?
You have made a static IP on your PC - which IP address?
Have you changed the default gateway on your PC to point on the routers IP address?
The IP net you are using 192.168.20.x, is it the same as your router uses for DHCP adresses?

Hi ffur

I changed the router address from the default address and I changed the IP address of my PC to be in the same neighborhood of the router's IP address which is 192.168.20.xx. When I logged into the router I tried reserving the IP address for the Arduino. I have noticed the router on VERY rare occasions detects the W5100 chip and it's MAC address and even gives it an IP address, but it doesn't stay online for very long.

On the Serial monitor I get:

Trying to get an IP address using DHCP

But then that's it, no address, nothing.

Does the shield have a SD card slot? If so, do you have a card in it?

SurferTim:
Does the shield have a SD card slot? If so, do you have a card in it?

Hi SurferTim,

I do have a SD card slot on this shield but I don't have a card inside of it.

Did you try a known good CAT5 cable?

SurferTim:
Did you try a known good CAT5 cable?

I tried it and it worked, however, when I unplug it, I won't be able to get back on again. Why is that? However, I suspect tomorrow I will be able to get on, again.

I still think you have a problem with your IP adresses.
Your DHCP address range must be in the same range/net as the fixed net you have configured. Likewise the
DHCP server must give you the correct gateway address and the correct subnetmask.
Another thing - are your Ethernet/SD shield an Arduino shield? If not you must check the termination resistors
placed close to the HanRun connector.
See : https://forum.arduino.cc/index.php?topic=351477.15