Actually I'm using a W5100 Hanrun HR911105A 16/02 Ethernet shield with an Arduino Uno (original).

I tried this code from the examples:

#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, 1, 177);
IPAddress myDns(192,168,1, 1);
IPAddress gateway(192, 168, 1, 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() {
  // 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);
  // start listening for clients

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:
    // echo the bytes to the server as well:

That code prints the following on the serial monitor:

Trying to get an IP address using DHCP
Failed to configure Ethernet using DHCP
My IP address:

So what is the problem? Why it is not connecting? I tried all the ethernet examples, but not one works. I don't know, maybe the problem is that I don't have a sticker of MAC address on the shield and I'm using the MAC address of the examples. Or maybe I'm writing the IP address wrong? Here is the data from the network connection details.

Connection-specific DNS Suffix: zte.com.cn
Description: Intel(R) Dual Band Wireless-AC 3165
Physical Address: ‎72-57-C5-BC-66-07
DHCP Enabled: Yes
IPv4 Address:
IPv4 Subnet Mask:
IPv4 Default Gateway:
IPv4 DHCP Server:
IPv4 DNS Server:
IPv4 WINS Server: 
NetBIOS over Tcpip Enabled: Yes
Link-local IPv6 Address: fe80::b523:b9f2:b43c:6a8a%14
IPv6 Default Gateway: 
IPv6 DNS Server:  

My router is a ZTE model ZXHNH108N.

  • Are you using the right sort of cable, Cat5e straight through, not crossed. DHCP seems enabled of the router, so do you have any spare addresses in your pool? Do you use mac address filtering? It looks like your router can't/won't give the board an address rather than there being anything wrong with the shield. Jul 4, 2017 at 7:54
  • No i don't make anything from that because I don't know what is that . May be if you discuss it to me we can solve it . Actually i don't know if there is any permission i should make from the router every thing here is on its difficult . And i don't know what is the filtring of the mac address Jul 4, 2017 at 9:42
  • Your doomed then! :) Hopefully the answer clears things up for you. Jul 4, 2017 at 10:07

1 Answer 1


If your Arduino can not get an IP address, it could be because there is a problem with your code, your shield or your network.

There doesn't seem to be a problem with your code from a quick glance, so let's look at the network.

  1. The cable. Are you using the right sort of cable? You should be using a Cat5e straight through cable. Cat5e is the type of cable for Ethernet, if it is plugged into the router and you didn't make it yourself, it is probably either a CAT5e or CAT6 cable, so it will be OK. There are two types of cable and they are almost impossible to tell apart, the normal sort is a "straight through" cable, which means the Transmit and Receive pins at one end go to the Transmit and Receive pins at the other end. The other sort is a "crossed" cable where the Transmit goes to the Receive, this is for connecting a computer to a computer. Since you are plugging to a router you should have a straight cable, if in doubt test it with a working device, ie plug it into your PC.
  2. DHCP - I see from your PC output DHCP is enabled on and I guess this is your router. A DHCP server needs to know what addresses it can give out to devices, these addresses are called "the DHCP pool". If you have no more free addresses in the pool then you can't connect anymore devices. It sounds like you haven't restricted your pool, but it might be worth logging onto your router and seeing if you can see what addresses are in the pool or range.
  3. MAC Filtering - For security some routers only allow certain MAC addresses to connect to the router and request a DHCP address. If you have it turned on then add your MAC address to the white list. If you don't have it turned on, don't worry.
  4. Speed - I suspect that your shield has a maximum speed of 10MBs. Most modern networking equipment only supports 100/1000MBs so the shield just won't work with your router. Your router should have the numbers near the wired sockets to confirm or deny this.

If none of that works the you are going to need to see if you can read the data from the shield and see if you can work out what is going wrong. You will need a network snooper like WireShark and a HUB. An Ethernet switch will not work, it must be an Ethernet Hub, because switches don't rebroadcast the data on all ports. If your PC has two network cards you could set it up as a 'bridge' and you can snoop on the data as it passes across the bridge.

Sorry if some of these terms are confusing, but you should be able to Google them and get a better explanation than I can give you in the space here.

One final thought: are you running the Arduino from a battery? If so it might be worth using a mains supply, because the battery might not be able to support the Ethernet transmissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.