Ethernet - Ethernet.setDnsServerIP()

Description

Set the IP address of the DNS server. Not for use with DHCP.

Syntax

Ethernet.setDnsServerIP(dns_server)

Parameters

dns_server: the IP address of the DNS server (IPAddress)

Returns

Nothing

Example

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

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);

void setup() {
  Ethernet.begin(mac, ip, myDns);
  IPAddress newDns(192, 168, 1, 1);
  Ethernet.setDnsServerIP(newDns);  // change the DNS server IP address
}

void loop () {}