title: Arduino local DNS problems
body: <p>I'm trying to build a little project using the Arduino Ethernet library, but I'm having a weird DNS issue: </p>
  
  <p><strong>It cannot resolve any domain name that is local to my network, but it has no problem resolving public domain names</strong>. </p>
  
  <p>No other system on my network has problems with these local domain names. It just seems to be the Arduino.</p>
  
  <p>Here's what I'm using:</p>
  
  <ul>
  <li><a href="http://arduino.cc/en/Main/arduinoBoardUno" rel="nofollow noreferrer">Arduino Uno R3</a></li>
  <li><a href="http://arduino.cc/en/Main/ArduinoEthernetShield" rel="nofollow noreferrer">Arduino Ethernet Shield R3</a></li>
  <li>Arduino IDE 1.0.3</li>
  <li><a href="http://www.asus.com/Networking/RTN66U/" rel="nofollow noreferrer">Asus RT-N66U Router</a> (provides the DNS server)</li>
  </ul>
  
  <p>Here's my test sketch:</p>
  
  <pre><code>#include &lt;SPI.h&gt;
  #include &lt;Ethernet.h&gt;
  #include &lt;Dns.h&gt;
  #include &lt;EthernetUdp.h&gt;
  
  byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
  
  EthernetClient client;
  
  void setup() {
    Serial.begin(9600);
  
    if (Ethernet.begin(mac) == 0) {
      Serial.println("Failed to configure Ethernet using DHCP");
      while(true);
    }
  
    delay(1000);
    Serial.println("connecting...");
    DNSClient dnsClient;
  
    // Router IP address
    byte dnsIp[] = {192, 168, 11, 1};
  
    dnsClient.begin(dnsIp);
  
    // Regular DNS names work...
    IPAddress ip1;
    dnsClient.getHostByName("www.google.com", ip1);
    Serial.print("www.google.com: ");
    Serial.println(ip1);
  
    // However local ones defined by my router do not (but they work fine everywhere else)...
    IPAddress ip2;
    dnsClient.getHostByName("Tycho.localnet", ip2);
    Serial.print("Tycho.localnet: ");
    Serial.println(ip2);
  }
  
  void loop() {
  
  }
  </code></pre>
  
  <p>Here's its output (the second IP address is incorrect):</p>
  
  <pre><code>connecting...
  www.google.com: 74.125.227.84
  Tycho.localnet: 195.158.0.0
  </code></pre>
  
  <p>Here's the correct information given from a Linux machine connected to the same network:</p>
  
  <pre><code>$ nslookup www.google.com
  Server:         192.168.11.1
  Address:        192.168.11.1#53
  
  Non-authoritative answer:
  Name:   www.google.com
  Address: 74.125.227.80
  Name:   www.google.com
  Address: 74.125.227.84
  Name:   www.google.com
  Address: 74.125.227.82
  Name:   www.google.com
  Address: 74.125.227.83
  Name:   www.google.com
  Address: 74.125.227.81
  
  $ nslookup Tycho.localnet
  Server:         192.168.11.1
  Address:        192.168.11.1#53
  
  Name:   Tycho.localnet
  Address: 192.168.11.2
  </code></pre>
  
  <p>What's going on?</p>