[Ethercard] DNS for arduino local server

Hi everybody,

forgive me if it-s not the correct category for my post

I’m interfacing arduino Nano with a ENC28J60 LAN module to control multiple digital inputs via web on local network using the EtherCard.h library (I was not able to make my board work with other software)

Now I’m trying to assign a local domain name to my arduino server, such as /ledcontrol .

The purpose is be able to reach the arduino server webpage typing /ledcontrol in the browser instead the IP address.

Someone has experience with this ?

Thanks in advance

PS I attach my code here, it is very similar to examples on web

#include <EtherCard.h>

static byte mymac[] = {0xDD,0xDD,0xDD,0x00,0x00,0x01};
static byte myip[] = {192,168,1,200};
byte Ethernet::buffer[700];

const int ledPin = 4;
boolean ledStatus;

char* on = "ON";
char* off = "OFF";
char* statusLabel;
char* buttonLabel;

void setup () {
  Serial.println("WebLed Demo");
  if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
    Serial.println( "Failed to access Ethernet controller");
   Serial.println("Ethernet controller initialized");
  if (!ether.staticSetup(myip))
    Serial.println("Failed to set IP address");

  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
  ledStatus = false;
void loop() {
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  if(pos) {
    if(strstr((char *)Ethernet::buffer + pos, "GET /?status=ON") != 0) {
      Serial.println("Received ON command");
      ledStatus = true;

    if(strstr((char *)Ethernet::buffer + pos, "GET /?status=OFF") != 0) {
      Serial.println("Received OFF command");
      ledStatus = false;
    if(ledStatus) {
      digitalWrite(ledPin, HIGH);
      statusLabel = off;
      buttonLabel = on;
    } else {
      digitalWrite(ledPin, LOW);
      statusLabel = on;
      buttonLabel = off;
    BufferFiller bfill = ether.tcpOffset();
    bfill.emit_p(PSTR("HTTP/1.0 200 OK\r\n"
      "Content-Type: text/html\r\nPragma: no-cache\r\n\r\n"
      "<body>LED Status: $S "
      "<a href=\"/?status=$S\"><input type=\"button\" value=\"$S\"></a>"
      ), statusLabel, buttonLabel, buttonLabel);

Not sure what you are trying to access the Arduino webpage from, but assuming it is a PC then all you should need to do is put an entry for the Arduino into your dns server. If you are not using a local dns server then you could put an entry into your hosts file instead. The hosts file is read before dns. No changes needed on teh Arduino.

Thank you very much, I modified the host file, and it works !