Ethernet.begin(mac, ip) or only Ethernet.begin

Hello,I have a question:

If i have in variable settings for ethernet:

IPAddress ip(192, 168, 5, 92);
IPAddress gateway(192,168,5,1);
IPAddress subnet(255,255,255,0);
EthernetServer server(80);

Is required in the setup:

Ethernet.begin(mac, ip);

or just

Ethernet.begin;

Thanks for the answer!

The begin() method takes, at a minimum, the MAC address.

this means, correct is:

byte mac[] = { 0x84, 0x42, 0x8B, 0xBA, 0xB2, 0x31 };
IPAddress ip(192, 168, 5, 92);
IPAddress gateway(192,168,5,1);
IPAddress subnet(255,255,255,0);
EthernetServer server(80); 

void setup() {

Ethernet.begin(mac, ip, gateway, subnet);
....
...

You have two choices:

byte mac[] = { 0x84, 0x42, 0x8B, 0xBA, 0xB2, 0x31 };
void setup() {
    Ethernet.begin(mac);

This will use DHCP to ask for an address to be assigned.

or

byte mac[] = { 0x84, 0x42, 0x8B, 0xBA, 0xB2, 0x31 };
IPAddress ip(192, 168, 5, 92);
IPAddress gateway(192,168,5,1);
IPAddress DNSserver(192,168,5,1);
IPAddress subnet(255,255,255,0);

void setup() {
    Ethernet.begin(mac, ip, gateway, DNSserver, subnet);

This will assign a fixed address. Note: You can leave out the last 1, 2, or 3 parameters. The subnet mask will default to 255.255.255.0 while the gateway address and DNS server address will default to x.x.x.1 where x.x.x matches the IP address.

WARNING: If you use the old syntax of "Ethernet.begin(mac, ip, gateway, subnet);" your DNS server address will be set to 255.255.255.0 and the name server won't work. You won't be able to connect to any server by name.

Hi @johnwasser, thanks for the good answer, but you write

Ethernet.begin(mac, ip, gateway, DNSserver, subnet);

isnt the order

Ethernet.begin(mac, ip, DNSserver, gateway, subnet);

?
(just trying to save someone else wasting deadTime trying to resolve)
thx
dB

sixD:
Hi @johnwasser, thanks for the good answer, but you write

Ethernet.begin(mac, ip, gateway, DNSserver, subnet);

isnt the order

Ethernet.begin(mac, ip, DNSserver, gateway, subnet);

?
(just trying to save someone else wasting deadTime trying to resolve)
thx dB

You are right. According to the reference manual (Arduino - EthernetBegin) the order is “Ethernet.begin(mac, ip, dns, gateway, subnet);” The old style did not have a separate DNS Server address so it was:
“Ethernet.begin(mac, ip, gateway, subnet);” If that old syntax is used today one would be using the Gateway Router address for the DNS Server (not usually a problem) and using the Subnet Mask for the Gateway Router address.