Can't connect to the internet

Hi,
So i need to open a web page but i just couldn't figure it out, I used dozens of programes i found but every time the Serial just return "Failed to configure Ethernet using DHCP"

So I tried with the exemples you get directly in the arduino.. Guess what ?

"Initialize Ethernet with DHCP:
Failed to configure Ethernet using DHCP
connecting to www.google.com...
connection failed

disconnecting.
Received 0 bytes in 0.0000, rate = 0.00 kbytes/second"

So I'm short of options, so if you guys have any ideas, please let me know

(sorry for bad english)

... and we're short on details.

Back to you.

I believe he asks; Please, friend, post diagram (not fritzi), formatted code (using < / > button in textbox), and serial monitor if so configured. Thank you.

Well, I use this code, wich is an official arduino code

/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}

And it returns :
"Initialize Ethernet with DHCP:
Failed to configure Ethernet using DHCP
connecting to www.google.com...
connection failed

disconnecting.
Received 0 bytes in 0.0000, rate = 0.00 kbytes/second"

What ?

It means "we need details from you, to be able to help you"

Missing full stop(.) has taken away my opportunity of asking a question very much pertaining to the English Language Grammatical Rule.

I use a UNO and a Ethernet shield, pluged on switch.

Oh, and my IP is a class B (172.16.X.X) I don't know if it change anything but, at least you know

I don't know what other kind of details you need, maybe some thing like "i'm trying to open this web site "http://localhost/projet/dht.php?humidite=X" (X being a value I got with a sensor), but that's not really relevant cause my problem here is just conecting to the internet

  1. What's a stop(.) ?
    2.I'm french so yeah my english sucks

Nothing to do with being French, just blame yourself there :grimacing:

There is a pretty active French forum here if you feel better writing in French

Is there a DHCP server on your network? is that an actively managed network (like school or business)?

PS: (the stop was the "point final" / dot - @GolamMostafa is not a native English speaker either (neither am I) and is not apologetic about it, even asks questions about grammar and spelling from time to time :slight_smile: ).

using a Ethernet Shield V1 (W5100 chip) with a UNO I had problems connecting to a new router (previous router worked OK) - in particular DHCP lookup timed out

I found replacing the Ethernet library with the following worked

Is there a DHCP server on your network? is that an actively managed network (like school or business)?

Yes, i'm on school network

have you asked the school administrator if you can connect any device to the network without some strong authentication?

all right, imma try that tomorow when i'll get the arduino back, i'll tell you how it went

if it is anything like the University you have to fill in forms with the device MAC address, what access you require thru the firewall (TCP and UDP ports), etc etc

and they might also have an authentication process with certificates

Well, now it works, i haven't changed anythingn it just work

good. You should still talk to the school admin to find out what is the normal process to connect anything to an ethernet port and get proper support