Ethernet Hostname: Ethernet 2.

Hello I'm setting up multiple arduino's with Ethernet shields using the Ethernet2 library. Everything is working great. However I'm using Advance ip scanner so i can scan my network for the arduino devices. And what comes up under every device is Atmel Corporation on it. I can not tell what device goes to what. Because I'm using DHCP to get a address. Everything i found so far doesn't work in changing the hostname on the arduino network. Is it possible to change it. So i can name each server in the hostname?

Joseph

You haven't posted your code, but you should be able to put the hostname in the begin call.
From Ethernet library: added ability to set/get hostname by mykh · Pull Request #5701 · arduino/Arduino · GitHub

while (Ethernet.begin(mac, hostname) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    delay(10000);
    Serial.println("Reconnecting...");
  }

Hello Sorry for the late reply. I’m just using the normal arduino Ethernet webserver hello world. Only thing i added to it is the dht22 temperature sensor. Sketch is below. That i have found online a one time.

 http://www.bajdi.com
 Web Server showing the values from a DHT22 sensor
*/

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

dht DHT;

#define DHTTYPE DHT22 // Sensor type
#define DHT22_PIN 4 // Data pin of DHT22 sensor

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 153 };

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
Server server(80);

void setup()
{
 
 // start the Ethernet connection and the server:
 Ethernet.begin(mac, ip);
 server.begin();
}

void loop()
{
 int chk = DHT.read22(DHT22_PIN);
 // listen for incoming clients
 Client client = server.available();
 if (client) {
 // an http request ends with a blank line
 boolean currentLineIsBlank = true;
 while (client.connected()) {
 if (client.available()) {
 char c = client.read();
 // if you've gotten to the end of the line (received a newline
 // character) and the line is blank, the http request has ended,
 // so you can send a reply
 if (c == '\n' && currentLineIsBlank) {
 // send a standard http response header
 client.println("HTTP/1.1 200 OK");
 client.println("Content-Type: text/html");
 client.println();

 // output the value of the DHT22 sensor
 client.print("Arduino powered webserver");
 client.println("
");
 client.print("Serving temperature and humidity values from a DHT22 sensor");
 client.println("
");
 client.print("Temperature (oC): ");
 client.print(DHT.temperature);
 client.println("
");
 client.print("Humidity (%): ");
 client.print(DHT.humidity); 
 client.println("
"); 
 
 break;
 }
 if (c == '\n') {
 // you're starting a new line
 currentLineIsBlank = true;
 } 
 else if (c != '\r') {
 // you've gotten a character on the current line
 currentLineIsBlank = false;
 }
 }
 }
 // give the web browser time to receive the data
 delay(1);
 // close the connection:
 client.stop();
 }
}

If you want to stay with the standard library that appears to set the hostname to WizNetxxx where xxx is the last 3 digits of the MAC address you will have set accept the xxx. If you define your own host name then it will still append the last 3 digits of the mac address. So, for example,
#define HOST_NAME "Neptune"
the hostname you see should be Neptunexxx
The #define will need to come after the #include Ethernet.H but before any executable code.

If you want anything more specific you will have to alter Dhcp.cpp in your ethernet library
or use a different library.

I can't actualy test this at the moment since I have misplaced my Uno with Ethernet shield. I am slightly concerned by your comment that they all appear as "Atmel Corporation" as that suggests that the HOST_NAME is ignored, or possibly you have scanned the network before the sketch has started on the Arduino.

Hello that is the original code before a change a few things. But mostly the sketch is the same.

When i put Ethernet.begin(mac,ip, hostname); i get this error 'hostname' was not declared in this scope. I did look at that site link and saw const char* hostname = "myarduino"; so i have added that and i still get that error message. I have tired adding the #define HOST_NAME "Neptune" and i still ge tthe same eror. But i change the Ethernet.begin(mac,ip, hostname); to Ethernet.begin(mac,ip, HOST_NAME); and i get this error exit status 1
conversion from 'const char [8]' to 'IPAddress' is ambiguous.

I thought you will need
const char hostname = "myarduino";

Is this still with the default library, or the one from the site I linked to?

I suspect the last erro message is because it is calling Ethernet.begin(map, IP, DNS IP) by passing "Neptune" as a const char when it is expecting an IP address.