connect an arduino to a server DNS/DHCP

Hello, I want to connect the arduino with Ethernet shield to a server DNS using DHCP. I have tried the examples of Arduino software, but they don't work. I specify that it's the server DNS of a high school.

how could i connect my arduino to this server?

Thanks for your answers.

You may want to talk to the network admin of your school if that is even possible and if they'd allow it. I could imagine plenty of reasons why they would not allow it ;-)

Client test code you can try.

//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = ""; // zoomkat's test web page server
EthernetClient client;


void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:

  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
    byte inChar; // sets inChar as a byte
    inChar =; //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
      sendGET(); // call sendGET function below when byte is an e


void sendGET() //client function to send/receive GET request data.
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  else {
    Serial.println("connection failed"); //error message if no client connect

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c =; //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 

  client.stop(); //stop client


From your own description, the DNS server's address is provided by the DHCP server. So it is primarily a matter of configuring the DHCP server. Then you may not be authorized to use that DNS server from outside its own network; you can check whether this is the case using a pc. If you can make it work from a pc, but not from the arduino, try posting the code that doesn't work.

thank you very much, i have tried your program, but it doesn't work. I think that the rights are not enable. Good bye.