Ethernet shield No internet connection

when i connect my ethernet shield i see on Serial Monitor 'No internet connection' i try connecting to a power bank instead of usb PC power and changed ethernet cable nothing helps. maybe there is something very simple to make it work or to make it function? I am new to this so any help would be appricated.

Thank you in advance

What is the other end of the cable connected to?

Router, same as main PC.

Then the ethernet connection is working perfectly. There is something wrong with the messaging to the router. Where did you get the procedure to connect to the internet?


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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 177);
EthernetClient client;

const char server[] = "www.gstatic.com";
const int port = 80;
unsigned long lastCheck = 0;
const unsigned long interval = 60000ul; // 60 seconds in ms = 1 minute

const int redLedPin = 2;
const int greenLedPin = 3;

void setup() {
  pinMode(redLedPin, OUTPUT);
  pinMode(greenLedPin, OUTPUT);
  digitalWrite(redLedPin, LOW);
  digitalWrite(greenLedPin, LOW);

  Ethernet.begin(mac, ip);
  delay(1000);
}

void loop() {
  unsigned long now = millis();
  if (now - lastCheck >= interval) {
    lastCheck = now;

    bool connected = false;
    if (client.connect(server, port)) {
      client.println("GET /generate_204 HTTP/1.1");
      client.println("Host: www.gstatic.com");
      client.println("Connection: close");
      client.println();

      while (client.connected() && !client.available()) delay(1);

      if (client.available()) {
        String line = client.readStringUntil('\n');
        if (line.indexOf("HTTP/1.1 204") >= 0) {
          connected = true;
        }
      }
      client.stop();
    }

    if (connected) {
      digitalWrite(greenLedPin, HIGH);
      digitalWrite(redLedPin, LOW);
    } else {
      digitalWrite(greenLedPin, LOW);
      digitalWrite(redLedPin, HIGH);
    }
  }
}

It’s a code someone gave me through forum. It’s to check if there is internet signal or not. If yes glow green led and if no glow red led.

Here is the original post link
: Newbee need help Ethernet - #12 by J-M-L

That code does not send any messages to the serial.print, so where does the message cone from, really?

Does this address make sense in your lan ?

If it’s related to the other post, there was no need to open a new discussion.

Is it different or should we merge both threads?

The IP address I left as it’s on the op, I did change on my end.

I thought the issue was different I need to open a new topic, is it best to continue on the old post? Please bear patience with me since I am new to this universe I might to these sorta mistake and thank you for your advice.

If you think it’s different enough for people to help without the context of the other post then it’s fine.

This means your ISP can not be contacted...

  • Recently there was a worldwide internet outage, CloudFlare
  • Maybe your ISP is down
  • Maybe some outside comm cables or microwave equipment is down
  • Is your router connected to your ISP?
  • is your ethernet connection to your PC working (ping)

My pc is fully connected to internet and working. I check my router information and I see the ip of my Ethernet shield display including the port it is connected to and one thing I notice odd is only green led glows on the shield and router port. I try connecting different ports it’s the same result. Feels like something is blocking from reaching to internet.

Is there a way to hard rest the whole boards? Like completely wipe out all data?

Is that two LEDs on two devices or one LED on one of the devices?

I agree. Networks have built-in security so hacking takes effort. You probably are facing an unsuccessful network setup with your shield.

I am certain the router has a factory-reset sequence... but then you need the administrator password to re-enter the router. Sometimes it is admin sometimes administrator sometimes <CR> sometimes it is the company name... you should find the answer to that before resetting the router.

1 led on the router 1 led on ethernet shield which is lightgreent/lightyellow one. usuall orange and light green blick on both end of the devices, is it normal for Arduino ethernet?

I didnt meant the rounter, more the Ethernet shield or the UNO board, is there a way to hard reset so if there is anything software related it will go away?

Please do not restore the factory defaults on the router, you will lose all internet access and have to reconfigure your router.

If you have internet access from your PC via the router then I doubt there's a problem with your router.

As @J-M-L asked in post #8, is that IP address on your subnet? If not then it won't work. If you answered this then I missed it.

All that tells you is that the electrical connection is working and data can pass, it doesn't tell you anything about the integrity of that data or whether the router can do anything with it.

Try using DHCP:

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 177);
EthernetClient client;

const char server[] = "www.gstatic.com";
const int port = 80;
unsigned long lastCheck = 0;
const unsigned long interval = 60000ul; // 60 seconds in ms = 1 minute

const int redLedPin = 2;
const int greenLedPin = 3;

void setup() {
  pinMode(redLedPin, OUTPUT);
  pinMode(greenLedPin, OUTPUT);
  digitalWrite(redLedPin, LOW);
  digitalWrite(greenLedPin, LOW);

  Serial.println("Initialize Ethernet with DHCP:");

  if (Ethernet.begin(mac) == 0) {

    Serial.println("Failed to configure Ethernet using DHCP");

    if (Ethernet.hardwareStatus() == EthernetNoHardware) {

      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");

    } else if (Ethernet.linkStatus() == LinkOFF) {

      Serial.println("Ethernet cable is not connected.");

    }

    // no point in carrying on, so do nothing forevermore:

    while (true) {

      delay(1);

    }
  }
}

void loop() {
  unsigned long now = millis();
  if (now - lastCheck >= interval) {
    lastCheck = now;

    bool connected = false;
    if (client.connect(server, port)) {
      client.println("GET /generate_204 HTTP/1.1");
      client.println("Host: www.gstatic.com");
      client.println("Connection: close");
      client.println();

      while (client.connected() && !client.available()) delay(1);

      if (client.available()) {
        String line = client.readStringUntil('\n');
        if (line.indexOf("HTTP/1.1 204") >= 0) {
          connected = true;
        }
      }
      client.stop();
    }

    if (connected) {
      digitalWrite(greenLedPin, HIGH);
      digitalWrite(redLedPin, LOW);
    } else {
      digitalWrite(greenLedPin, LOW);
      digitalWrite(redLedPin, HIGH);
    }
  }
}

it doesnt show any information on Serial Monitor, i tried removing ethernet cable and connecting. Both options show nothing so i guess my hardware it broken?

There is no Serial.begin() in setup(). Sorry, I should have spotted that!

I was already getting ready to buy original boards, since the problem could be other brands. Does usually both led suppose to blink or is it normal only yellow to blink? Also could it be other brand boards cause these problems? This is my 2nd set of boards. Uno + Ethernet shield.

Let me know what happens when you make the change I suggested in post #18